Arduino Audiovisual Sync detection


I’m completely new to Arduino, and would like to enter this new world.

As a way to learn, and to make something useful for me, I was thinking doing the following project.

To measure the sync of projected image and sound of a video. Is the image right in time with the sound or not? (depending on the video player not being able to play in sync, and to compensate any display delay of either image and sound).
Note: I know this kind of device already exist…

How to:
First, a test video needs to be projected. This test video will display both image and sound signal enabling a sync measure. The principle is the simple Bip test: a one white frame is displayed while a bip tone is played, rest of the time dark and silence.

So I need: a microphne that capture the bip sound (that is easy)
A phototransistor (I only need an On/off information, but I need a very fast response, so no LDR it seems) that capture the white frame flashing.

So I guess I could do a Arduino only device, with a display panel for displaying the sync offset in ms, but for a first try I’d like to keep it more simple, and just send audio signals to Max/MSP that will actually do the measurments (it also interrest me to see how Arduino can generate output sounds…). Then if all works and doesn’t seems too complicated, I’ll try the Arduino only route.

So for now, what I basically need is to control a burst of sound (1kHz sine for instance) when the phototransistor receives some light (the white frame). So I guess I might need a way to set a dark threshold and a White threshold for commuting…

Now, a few questions:

What is the best solution for a battery operated Arduino? Would a single 9V battery be enough? or would it be too much voltage dissipated in the 5V regulator? and not enough capacity? What are your tips about it?

Why are LDR so often mentionned and easy to find in Arduino “stores” and phototransistors (visible light, not IR on top of that) almost never mentionned in Arduino projects? is there something I overlooked on the subject?

As previously stated, I guess it would be doable to controll the gain of an oscillator (done by the Arduino chip) via the phototransistor response? Any difficuties there?

Would the response time be fast (at least just below the ms, as I would like to measure down to the ms). Any tricks for fast acurate response, or designs to avoid?

Now moving to a slightly different path: supposing I do not want anymore to send audio signals to Max/MSP, but instead to send signals via USB. Is it possible? Would I still achieve the ms accuracy? Can Arduino be powered by the USB bus of a computer? (supposing the USB bus to be normal, not underpowered itself)

Thanks for your comments!

thanks for your answer and all your informations.

About the part of my post that are unclear, I'll try to explain better:

First, Arduino is in no way is supposed to act as a video player. I always assume there is a video player somewhere (be it a daw with video out abilities, such as Pro Tools or else, or a simple Video Player, such as Quicktime, or else...), and that the test sigal is a Video file prepared in advance (all black and silent exept for a one frame white and bip). An .avi or .mov (possibly several of them, depending on codec, framerate etc...). The choice of the bip instead of the click is due to the use of this signal already in Audiovisual postproduction. At least with Max, I think it is enough to do the kind of measure I want, with the precision I look for.

So I intend to load the Test video file in the player, and then play it to do the measure.

The simplest (in my mind I could be wrong) way I found to achieve the measurement was to send audio to max/MSP (I already made a Max patch capable of measuring sync offsets between two audio bips, coming for instance thru an audio card).

So I already have an audio bip on my test file, easy to make it audio. I just need the White frame to be transformed into an audio bip also. (hence the idea of a phototransistor acting as an On/Off switch on a simple audio oscillator). Which would be Arduino's work.

Then if I do this first step, which interrest me in itself anyway, I could go further and do all the measurements inside Arduino, but that is much more complicated (connecting a mic to Arduino, and having Arduino detect a bip, And Arduino detect the flash, and Arduino calculating the offset between the two in ms).

So before going all that way, I was also thinking about still using MAX/MSP as the detector calculator, but instead of receiveing the signals in the form of audio, receiving them in another form thru USB maybe...

I hope it is more clear now.


In the first approach, Arduino would play the role of the interface that convert a flash of light into an audio bip that Max can then interpret. Then it vould be another form of signal that it sends to Max via USB. And finally, Arduino could do it all (capture, detection, calculation, display, when I've learned more...).

Kind of a progressive way to ask Arduino more and more difficult (for me) stuff, and explore areas I'd like to use with Arduino in other projects, later.

Plus, I already have the max patch done, it was also a good Max training ; )...