[linux-audio-dev] Audio synchronization, MIDI API

Benno Senoner sbenno at gardena.net
Sun Aug 15 11:58:49 UTC 2004


Steve Harris wrote:

>>>
>>>Any good suggestion how to best implement it ?
>>>      
>>>
>
>You can't just duplicate or drop samples, it will sound terrible. You need
>to do some resampling. For clusters this shouldn't be an issue, just
>make one device be the i/o machine and sync everything else off that.
>  
>
Of course sample skipping/duplucation sounds terrible if the resampling 
factor is large
(eg 1.2, 1.5 etc).
But we are talking of a samplerate delta of 2-3 samples.

If you add a sample  or skip one each half second or so I think it's 
impossible to hear.
For example (let's take the -1.0 to +1.0 range):

if you have

1.0 , 1.0 , 1.0  , 0.8 , 0.8

and you duplicate sample 3
you get
1.0 , 1.0 1.0 , 1.0 , 0.8 , 0.8
which is still the same shape as the original only stretched in time a 
bit (  by 1/44100 = by 0.002267 %).

Perhaps skipping is a bit more problematic when applied to high 
frequency content, basically
if the period of the frequency is covered by at least 3 points then 
removing one will not do much damage
(we remove only one point one each half second).
When you get near to the nyquist frequency it's perhaps more problematic 
because if you incur in a case
where you have
1.0 , -1.0  , 1.0 , -1.0

and you skip sample 2 you get
1.0 , 1.0 , -1.0
which would cause one period of the wave to disappear but since it's 
duration is limited to 1 sample and the
sample deltas are high I think it's impossible to hear.
If you are worried you could do an one time interpolation (not always 
interpolate the whole stream) but only
the points where you insert/skip samples.
For example in the above case if we skip sample 2 we would set sample 3 
of the new stream to (sample2 + sample3)/2
= (-1.0 + 1.0)/2 = 0.0

so you gett
1.0 , 0.0,  -1.0

still not the original shape but the transition from 1.0 to -1.0 is 
smoothed so there are no hard jumps which could cause
audible artifacts.


>If you absolutly have to have multiple machines doing i/o then you will
>need some complicated resampling stuff. Fons has been working on it, to
>allow soft-sync between 2 jack systems, but I've not tried it yet.
>  
>

Interesting, any online pointers ?
Fons what's your take on the sample skipping/duplicating ?


cheers,
Benno
http://www.linuxsampler.org




More information about the Linux-audio-dev mailing list