Re: [linux-audio-dev] MIDI sync issues; mmc, mtc, ...

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] MIDI sync issues; mmc, mtc, ...
From: Kai Vehmanen (kaiv_AT_wakkanet.fi)
Date: Fri Dec 22 2000 - 11:58:59 EET


On Thu, 21 Dec 2000, Dan Mills wrote:

> When I needed a timecode transmitter for a project I did it as follows
> There was a midi transmitter thread which could block on transmit, which
> was supplied with data from a linked list of midi messages.
> The trick is that when adding a message to the list the audio thread
> would prepare a structure:

Hmm, interesting. This is pretty close to what I've had in mind... except
I'd use a ringbuffer or some other statically allocated structure.
Allocating memory from the audio thread during processing wouldn't be a
good thing.

>> actually use when generating MTC. For a wall-clock sync, it's reasonable
>> to use the "engine-time", ie. how many samples have passed the main engine
>> loop. But this won't do if we want to use MTC for syncing audio. Then we
>> need to use soundcard's current pointer to calculate the current time...
> Humm, you should probably have a user adjustable 'slip' control so that
> you can accurately align the timecode with the audio. This would be so
> much easier under QNX or OS9.....

That would be nice, but unfortunately the delay can vary during
processing. :(

> Syncing to external MTC is another area which gets 'exciting', I ran a
> softwre PLL to de jitter the incomming timecode and to convert from
> 24/25/30/29.97 FPS into a sample number, then you have to somehow
> adjust the exact playout speed (soundcard sample rate), to bring the
> two clocks into alignment. I did this by simply repeating or dropping
> samples as needed, ugly but it worked. If your soundcard gives you
> control of the sample rate at the sub Hz level, then this becomes

Huh, this is some heavy stuff. :) On a average Linux box the situation is
even worse than that - you can't even _get_ the exact sample rate of the
soundcard. This leads us to the old problem of trying to use multiple
cheap consumer cards for multichannel playback or recording. Sounds
promising, but in reality the cards run at slightly different speeds and
your streams will sooner or later go out of sync.

-- 
 . http://www.eca.cx ... [ audio software for linux ] /\ . 
 . http://www.eca.cx/sculpscape [ my armchair-tunes mp3/ra/wav ]


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Fri Dec 22 2000 - 11:58:17 EET