On Fri, Oct 20, 2006 at 03:51:09PM +0100, Dave Griffiths wrote: > > The tricky bit is of course getting a flash that's totally synchronous > > with the beep. Absolute synchrony is not achievable without dedicated > > hardware, but we need to get an approximation that's within the few ms > > range. > > I do things a bit like this for audiovisual performances. It is impossible > to get it precisely right as you say, but what I tend to do is run > everything slightly ahead of realtime - so you timestamp events to happen > in the future. Of course you can't do this if human input is involved, but > if the timing is machine generated you can tune the audio and visual > independantly so they are close enough for most purposes.
It *is* possible to get it exactly right (to within one audio sample), assuming - you know the audio round-trip latency of your sound card (jdelay will measure it to less than a microsec precision), - you can send triggers from the video to the audio processes with a delay less than say 1/4 of the frame time, (not difficult), Input the vertical video sync signal via the audio card and analyse its timing in terms of audio samples (e.g. using a DLL). This will enable you to predict where the next sync will be in the audio input. Using the known round trip audio delay, you also know to which sample that corresponds in the audio output. Now if the video process sends its triggers a few frames ahead then the audio process will be able to work out exactly where to put the corresponding samples. -- FA Lascia la spina, cogli la rosa.
