# Help! Seasick transmitters!January 14, 2008 8:09 PM   Subscribe

I need to do some highly sophisticated pitch-correction on some old reel-to-reel recordings. What software to use?

I have a project which requires me to do some rather elaborate pitch correction on some old reel-to-reel tapes which have not aged well. Here's one of the examples.

What on earth can I do with this to make the Morse tone steady? Is there a program which can do some sort of algorithmic calculation to account for the pitch warp (i.e., by taking an "image" of the tone and generating a perfect mirror algorithm)?

I know I could probably get all modern and "vocode" a new tone over it and keep the rhythm of the original recording, but these are historically important radio stations, so I can't just go remixing them for convenience.

Folks in the archival audio world must deal with this all the time. Thoughts?
posted by mykescipark to Media & Arts (13 answers total) 3 users marked this as a favorite

I don't have any answers for you. But I'm wondering...is the morse code the recording you are trying to fix, or some sort of a test tone for a different recording? Was that a radio station broadcasting morse code?
posted by sully75 at 8:19 PM on January 14, 2008

posted by mykescipark at 8:21 PM on January 14, 2008

How good are you with matlab or its equivalents? Should easy enough to solve even in C++ if you get fftw to do the FFT work. I should think a bit of hacking about would allow you to carve it up into chunks (say 8192 samples), FFT each chunk, interpolate around the highest bin to get the actual frequency and then fix the pitch of each frame individually.

The interpolation to accurately find frequency from an FFT is as follows. Assuming matlab syntax where i is the index of the greatest-magnitude bin and data is the complex output of the FFT:

x=data(i-1:i+1);
delta=(x(3)-x(1))/(2*x(2)-x(1)-x(3));
f=i-real(delta)-1;

f is your frequency in bins, i.e. you multiply it by the sample rate to get the true frequency in Hz.

What you want to do to fix the sound is not pitch shifting but plain old resampling. Because the tape has stretched or shrunk, the playback is not only changing in pitch but also speed, so a simple resample is the correct fix. Linear interpolation would be fine.

For each chunk of data, decide a new length (e.g if the pitch is 20% high, make the output 1.2 longer) and resample each block to that length.
posted by polyglot at 8:49 PM on January 14, 2008

Actually 8k bins is probably too many. It will give you very fine frequency accuracy but it won't change rapidly. If your pitch is changing noticeably within a second, reduce the FFT size to about 1024 so that you get 44 frames per second. Frequency accuracy should still be well better than 0.1Hz as long as there isn't too much noise (SNR>10dB).
posted by polyglot at 8:54 PM on January 14, 2008

Um, just throw away the frequency information entirely. It's morse code... you're only interested in amplitude. So use an envelope tracker and have it's output control an amplifier. Send a solid tone through that amplifier and you're done.
posted by phrontist at 8:57 PM on January 14, 2008

Phrontist, I think that's what mykescipark is saying when he says 'I know I could probably get all modern and "vocode" a new tone over it and keep the rhythm of the original recording' - but he doesn't want to do that if possible.

A quick play in Audacity suggests that the pitch variation, for the most part, is only half a cent or so - not much, really. There's also pitch changes due to keying variance, etc, but that's all part of morse code on old-style manually-keyed switched-oscillator transmitters. Modern gated-oscillator transmitters don't do that.

Is there a program which can do some sort of algorithmic calculation to account for the pitch warp (i.e., by taking an "image" of the tone and generating a perfect mirror algorithm)?

This is essentially what I tried in Audacity. I went so far as to hard-limit the recording (to remove the amplitude variations which, to my ear, do more to annoy the brain than the pitch changes) and/or did pitch correction against a continuous reference tone. The results, even without the limiting, to my mind weren't worth the ancillary damage done.

polyglot is spot on when saying the fundamental problem is the warped bits have been "resampled" - if you think of the tape as having marks like a ruler, then the tape streching has moved each mark further apart. I'm not sure, though, if his suggestion of doing a linear interpolation is worth it - by my calculations, the pitch is only varying by 2.5~3%.
posted by Pinback at 9:21 PM on January 14, 2008

posted by Pinback at 9:49 PM on January 14, 2008

(Gives up, goes back to bed...)
posted by Pinback at 9:50 PM on January 14, 2008

More careful interpolation is called for where the sampling ratio is closer to one than not. So if you were resampling by a factor of 4, it wouldn't matter. For a factor of 1.02 (i.e. 2% speedup/slowdown), then you probably do want to be careful with interpolation. Nearest neighbour = not cool. You might also want to only slowly change the interpolation factor so that you don't get sudden pitch changes at frame boundaries.
posted by polyglot at 10:17 PM on January 14, 2008

What you want is Melodyne.

It is unbelievably awesome.
posted by The World Famous at 10:52 PM on January 14, 2008 [1 favorite]

Seconding Melodyne. Hell, even the barebones Garageband pitch correction plug might do it. But Melodyne is amazingly cool (in addition to being unbelievably awesome).
posted by uncleozzy at 5:44 AM on January 15, 2008

Although I love Pinback and polyglot's more technical answers, Melodyne actually did the job perfectly. Totally amazing! Thanks all!
posted by mykescipark at 4:19 PM on January 15, 2008

Follow-up: For those of you who are curious, here's an mp3 with the original and corrected files back-to-back.
posted by mykescipark at 10:57 PM on January 15, 2008

« Older Speech Anxiety - What to do?   |   Making daylight? Newer »