7
$\begingroup$

Non-physicist here.

From what I've learned in university and what common sense says, a shift in frequency of a signal results in a change in its length in time. For example, if a sinusoid signal of frequency $f$ and length $t$ is transferred to frequency domain, it's $f$ divided by $2$, then converted back to time domain, the length of the signal would be $2t$.

Correct me if I'm wrong! But this is quite intuitive. If you make a signal slower, it would take more time to finish and vice versa.

This is a reason why I've been told it's impossible to change frequency of a streaming signal and output it with the same speed. For example, it would be impossible to take a man's speech and change it to sound like a woman without making it faster.

Now I've had various observations:

  • In Coursera, you can increase the speed of course lectures and the sound is also of course sped up. However, there is no rise in the pitch of the voice of the speaker. In fact, the speaker sounds very similar to the normal speed. How is it possible to change in speed of the signal didn't affect its frequency?
  • My amplifier has a dial for shifting the pitch. So, while playing, you can here the output with a different pitch. Again, how is this possible? If the amplifier is rising the pitch, shouldn't its output be faster than its input? (i.e. a contradiction!) I'm suspecting some trick though, as the output sounds rather "artificial".

It seems that it is somewhat possible to change the frequency of a signal without affecting its length. One (theoretical) way I can think of would be to understand the current "notes" playing (i.e. the different frequencies making the signal) in very small intervals, change the note and replay them for the duration of that interval.

My question is, first if my understanding is at all correct. Either way, is there a mathematical way for changing the pitch of a signal without affecting its length in time? If not, how can they be doing it in practice?

$\endgroup$
  • $\begingroup$ I don't actually know the answer to this (I'll await someone with more signal processing knowledge to answer this), but I strongly suspect that it's not just a simple time-frequency domain stretch which is being applied. One way you could conceivably increase pitch without speeding things up would be to chop the signal into small patches to generate a spectrogram, apply frequency stretches to the patches, duplicate every patch, and then convert back to the time domain. In practice I feel this would have nasty "edge effects", so a more delicate procedure would probably be needed. $\endgroup$ – DumpsterDoofus Dec 26 '13 at 2:30
  • 1
    $\begingroup$ The trick is to use a Fourier transform. Instead changing the pitch by compressing the waveform (which affects the play time), the sound is converted into the frequency domain. Then all the pitches are shifted up, and the sound is converted back. You can think of this as slicing the sound up into a bunch of tiny time windows. Then compressing each time window to half the time (doubling the pitch), and then playing each time window twice. $\endgroup$ – Brandon Enright Dec 26 '13 at 2:31
  • $\begingroup$ -1; In the earlier part of your question, I dont get what you are trying to say. From what I know you are totally misinformed! Why would signal length depend on frequency? first of all what you mean by signal length? Wonder in which university did you study this wrong thing? $\endgroup$ – Rajesh Dachiraju Dec 26 '13 at 3:02
  • 1
    $\begingroup$ @RajeshD it seems easy enough to understand to me. $\endgroup$ – Nathaniel Dec 26 '13 at 3:11
  • 1
    $\begingroup$ @RajeshD, just to be clear on how *.SE.com series of websites works, one usually asks a question when they don't know something. Usually, being misinformed is not a reason for -1, as that is the reason for the question in the first place! -1 usually applies when the question is very low quality, or shows no effort in finding the solution whatsoever. No hard feelings, though. I just wanted to clear that up. $\endgroup$ – Shahbaz Dec 26 '13 at 17:56
3
$\begingroup$

You are correct that it's impossible to change the frequency of every component of a waveform while (a) preserving all the phase relationships between the frequencies and (b) preserving the length of the waveform. However, while it's mathematically impossible to do this precisely, it is possible to do things that sound quite a lot like it to the human ear. The most basic algorithms for this are fairly simple, but doing it well is pretty difficult, and the algorithms are being improved all the time. It is referred to as "pitch shifting" if the goal is to change the pitch but not the time, and "time stretching" if you want to change the time while keeping the pitch.

The reason this is possible is that the ear distinguishes rhythm and pitch as quite distinct things. A sequence of clicks will sound like a sequence of clicks until its frequency passses about 20-30 Hz, at which point it transitions into a buzzing sound that's perceived as having a pitch. Because of this, as DumpsterDoofus said, you can chop the sound up into little segments of short duration, change the pitch of each one individually, and then stitch them back together again, repeating things or leaving gaps where necessary.

By itself this doesn't sound so good, because you get a click at the end of each segment, where the waveforms don't line up. It can be improved a lot by overlapping "windows" of sound, which each have a fade-in and fade-out applied. That way you don't hear the clicks that the ends of the segments, but you do tend to hear phase-cancellation effects where thr windows are added back together again. For this reason this technique requires quite a bit of tuning to get it to sound good on any given input sound.

There are also Fourier-domain techniques, as Brandon Enright said. These also usually use overlapping windows; I guess the advantage of using the Fourier domain is that you have more control over the phase relationships. (I don't know very much about these techniques.)

A fairly recent development is the "pitch synchronous overlap-add" (PSOLA) algorithm. This uses overlapping windows as well, but it synchronises the length of the windows to the pitch of the input sound. This makes it much harder for the ear to perceive the individual windows. I call it "the algorithm that ruined music", because it's responsible for that nasty "autotune" effect that's been overused on the vocals of every pop record for the last ten years or so. However, it does also have peaceful applications, and the pitch dial on your amplifier probably uses some version of it.

You can find more details about these algorithms on Wikipedia.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.