calebporzio / click

The podcast recording and editing suite of your dreams. Featuring just the one button.
MIT License
18 stars 3 forks source link

Add support for resampling to Mixer #10

Open DanielCoulbourne opened 4 years ago

DanielCoulbourne commented 4 years ago

One of the most common "gotchas" with podcast editing is that different equipment records at different sample rates. The two most common are 44.1khz and 48khz

Usually @calebporzio and I are both at 44.1khz, but on our latest episode Caleb was using a different audio setup, and his audio recorded at 48khz. This introduces audio drift in the mix which gets worse as the episode goes on. By the end of the episode we are about a second out of sync.

This is actually a massive pain in the ass even in manual podcast editing. Simply bumping the speed by a constant percentage does not work, so what most people do is try very hard to enforce the same bitrate at recording time, and if this nightmare DOES occur, make a cut every 5 minutes or so and manually re-align the audio.

turns out FFMPEG has a flag called aresample that SEEMS to do this for you, but I'm not sure exactly if it will work for our purposes.

My best current plan is something like this (total pseudocode)

master_sample_rate = sample_rate_passed_in_arguments || assets[0].sample_rate

assets.each do |asset|
    if asset.sample_rate !== master_sample_rate
        resample(asset, master_sample_rate)
    end
end

where resample() is some sort of FFMPEG command to resample. We will need to fiddle with this to get it right.

calebporzio commented 4 years ago

Love it.

Sorry for the headache, but this would be a tight feature.