Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

sound controlled video

I'm working on a project where a series of .avi video clips is controlled by the amplitude of a music signal. It works by taking in a .wav file, reading the amplitude of the waveform and measuring the amplitude against a trigger value. If the amplitude exceeds the trigger value, it sets off a case structure that plays the video. Here's the tricky part:

 

  I've tried putting the example code for the avi player inside the case structure, but it pauses the song to play the clip. Realizing that this is because the while loop of the avi player is nested inside of the while loop of the song player, I removed the avi player's while loop and connected its loop index to the frame number on the open avi vi. This plays the song and the video at the same time, but the video doesn't play at the correct framerate. I suspect that this is some kind of synchronization issue where the song plays at one timestamp while the video plays at another, but I can't figure out how to fix it.

 

 

Here's what I have so far:

 

 

0 Kudos
Message 1 of 2
(3,401 Views)

Hi Julian,

 

The frames will display whatever the rate of the while loop is.  The sound play VI is a blocking call and you will have to make it work in parallel with the AVI player.  Perhaps by using a more complex architecture, like producer/consumer.

Stephen Meserve
National Instruments
0 Kudos
Message 2 of 2
(3,372 Views)