[linux-audio-user] Stretching with very high accuracy

Nick Copeland nickycopeland at hotmail.com
Thu Jun 8 17:15:03 EDT 2006

If the two files are both mono and you want to make them stereo then 
judicious sample insertion will probably work reasonably well. If they are 
both stereo then you need to look further into resampling since you may not 
be able to insert samples at the same point in each of the respective 
channels, and excessive insertion into one channel will introduce skew into 
an otherwise synchronous pair of channels.

What is the format of the files? Raw audio, WAV, etc? What is the rough 
content - if the signal is constant than sample insertion is not easy since 
you may not have periods of silence. If the signal does have silent periods 
then the solution may be a noise gate that inserts samples - this would be 
all but inaudible. There is no reason why this should not work from file to 
file with 'cat oldfile | <program> > newfile so should not need to have the 
lot in memory.

Have you mailed the LAD list - somebody might be happy to bolt something 
together for you, its not actually a lot of work for mono tracks.


>From: "Alex Polite" <notmyprivateemail at gmail.com>
>Reply-To: A list for linux audio users 
><linux-audio-user at music.columbia.edu>
>To: "A list for linux audio users" <linux-audio-user at music.columbia.edu>
>Subject: [linux-audio-user] Stretching with very high accuracy
>Date: Thu, 8 Jun 2006 17:39:48 +0200
>Hi there.
>I'm developing a little tool to automatically sync two audio
>recordings of the same event made with two different recorders. I've
>got the algorithms worked out and can correctly  compute the drift and
>offset between the files in my test recording. The next step is to
>pad, stretch and mix the two files into one perfectly synced stereo
>The drift is very small. In my test recording the drift is only 53
>milliseconds over the course of an hour. My stretch factor is
>I've tried to stretch the file with sox:
>sox infile.wav outfile.wav stretch 0.99998525762821
>When I try to line up the files in a ardour I realise that the stretch
>sox makes is hugely inaccurate.
>For testing purposes I tried to stretch an hourly long file (44.1kHz)
>by some 2000 samples, but the resulting file was some 30000 samples
>longer. The stretch was off by more than 0.5 seconds!
>Is there anything I can do to increase the accuracy of sox? Is there
>any other tool out there that will do a better job at stretching with
>very high accuracy?
>Alex Polite
>http://flosspick.org - finding the right open source

Don't just search. Find. Check out the new MSN Search! 

More information about the Linux-audio-user mailing list