[ardour-users] sync imported wav files
Paul Winkler
pw_lists at slinkp.com
Tue Dec 6 10:30:13 PST 2005
On Tue, Dec 06, 2005 at 04:24:19PM +0100, Petter Sundl??f wrote:
> I've done this exact thing, lined up a Microphone->MD recording with a
> mixer desk>MD recording. Fortunately I had to do very little fixing. I
> just zoomed in very close, and aligned them at the start. Then look for
> where I could start to hear the out-of-sync-ness, and aligned it there.
another thing you could do - this is a bit of work, but it should
avoid audible phase issues *and* save you some manual realignment
work if the recording is long. I've done things like this before - let
me see if I can remember the general procedure:
- Import both files
- Line up as precisely as you can at the start
(try to find a good strong peak that's obviously the same thing
in both files).
- Go to the end, zoom in very close, find some strong peak in both
tracks (it will be out of sync of course).
- Calculate the number of frames between the beginning peak and
the ending peak in the desk recording. Call this "d".
- calculate the number of frames between the beginning peak and
the ending peak in the audience recording; call this "a".
- Calculate the ratio of the two lengths: ratio = d / a
- use sndfile-resample (comes with libsamplerate) on your
audience recording, like so:
sndfile-resample -by <RATIO GOES HERE> audience.wav audience2.wav
Now you have a copy of audience2.wav that has the right number
of samples between the beginning and ending. Unfortunately it has a
funny sampling rate.
- What we want to do now is change the sampling rate in the header
WITHOUT changing the audio data at all. One way to fix that
is to use sox like so:
sox audience2.wav -t raw audience2.raw
Now you have the same audio data with no header.
You can use sox again to create a new header.
To do this, you need to know enough about the audio format
to tell sox what to do. For "cd quality" wav files, that
would be like so:
sox -r 44100 -c 2 -s -w audience2.raw audience_final.wav
The end result is that you have hopefully compensated for the
two different clock frequencies in your two recorders.
Now import audience_final.wav into your ardour session,
align the start with the desk recording as in step 1, and
hopefully you'll be in pretty good shape - check to
see if the endings are still in sync.
Let me know if it works :-)
if it's even further out of sync, that means I got the ratio
backwards :-) Invert and start again from the sndfile-resample step.
(e.g. if you were using a ratio of 0.99, use instead 1/0.99 = 1.010101...)
--
Paul Winkler
http://www.slinkp.com
More information about the Ardour-Users
mailing list