Syncing Variable Speed Audio

Hi guys,

So basically I have hundreds of FLAC audio files. Half of these are already in perfect sync to my video but have crappy audio quality, the second half of my files are much higher quality, but are not at all synced to my video. At this point, you might think that all I have to do is find a sharp audio spike and then manually sync the waves of the good audio to the bad audio (but in sync) audio. Unfortunately, this is where the problem gets difficult.

The huge problem I have is that the good audio is constantly changing its playback rate. If I sync up a certain segment with the bad audio, the waves are aligned initially but they will differ as time progresses. Let me stress that the playback rate is NOT different by some constant (in other words its not like a NTSC → PAL speed-up). The good audio will pull ahead of the bad audio sometimes, and then later it will fall behind. The rate is constantly changing.

So the best way I’ve come up with so far to sync them together is to sync them at the start of the file, and then stretch (by way of “Change Speed”) the good audio to match the waves of the bad audio in 1 minute segments. This kind of works, but if there’s ever any significant deviation of sync within that minute, then they will stay out of sync. Ideally, you would want to do this same thing in infinitesimal small chunks to ensure they are always in sync.

Is there any way with Audacity, or some other program, that I could sync these files together automatically? Or is there some other way to do it manually that might be better that I’m not thinking of?

Thanks!

The absence of replies suggests “no”. Can you find other copies of the music track that don’t change tempo?

If the music has heavy beats you may be able to use Quantization in some audio editing applications. Audacity doesn’t have that feature.


Gale

Thanks for the reply! Unfortunately, there is no chance of finding another copy of these tracks. These audio files are EXTREMELY rare and I have to work with them. I’ll have a look at the link u sent to see if that might help.

I think syncing this automatically is possible but I doubt a tool exists for it since its such a rare and unusual issue. I imagine it would be very possible to split the the files into X number of chunks and then analyze the waves of both tracks to figure out how much the broken track needs to be stretched to match the relative waves of the other. I’d code this myself if I had some idea of how to interract with audio files on a programming level :frowning:

There’s a program designed for this type of job. It’s called “Capstan” (by Celemony). Unfortunately it costs over $4000. :open_mouth:

Changing the speed in small chunks would be possible to script using “Nyquist” (a simple programming language that is built into Audacity). The really difficult part would be for the plug-in to know how much to change each chunk.

I presume that when you are fixing it manually, you look for “events” that can be identified in both the audio and video, then match them up. Neither Nyquist nor Audacity are able to see the video, so that approach won’t work in Audacity.

I suspect that your best approach would be to look for video editing software that allows you to stretch audio tracks. Perhaps Pinnacle Studio (about $100) can do this?
I doubt there will be an easy or quick way to do this :frowning:

Hey, thanks for the response.

It sucks that Capstan costs so much cos that sounds really handy!

When doing it manually, I would just observe the waves of the audio thats running at proper speed and look for any uniquely distinguishable visible part (like an audio spike for instance). Then I would speed up/slow down the broken audio so that the distinguishing feature is in line with the other audio file. I do this in 30s segments. It works…but its really time consuming. I spent about 45 minutes syncing a 21 minute clip. The result is pretty damn good, its just really painful to do for 100s of files.

I had a quick look at Nyquist and like you said, it seems the most difficult part would be to figure out how much it needs to stretch each chunk. It doesn’t look like its something I’d personally be able to code using this language (I’m not at all familiar with LISP and its derivatives). Thanks for bringing this up anyhow. Maybe if someone is bored or likes a challenge then they could try to make a plugin for it… :slight_smile:

So you are comparing two audio files? One being low quality but correct speed, and the other being better quality but the speed is drifting?

Roughly, how much and how rapidly is the speed drifting?

Yep, thats how I’m doing it.

It goes ahead and behind the correct speed by up to about 800ms. When modifying the chunks, I usually have to change the speed by about 1%. It might not sound like a lot, but it makes a massive difference

I don’t know if this will help, but you may find it a bit easier with this plug-in effect: https://forum.audacityteam.org/t/change-speed-stretch-audio-to-a-specified-length/23332/1
It is much like “Change Speed” but you can specify the desired duration rather than having to guess the percentage.
To install Nyquist plug-ins: http://wiki.audacityteam.org/wiki/Download_Nyquist_Plug-ins#Installing_Plug-ins