#10 Time Stretching/Pitch Shifting


bein ablt to slow down the song (or speed up) and keep
the same pitch would be awsome =)


  • Davy Durham

    Davy Durham - 2002-09-06

    Logged In: YES

    Well, I've got some ideas about this.. There are a couple of
    ways to do it.

    1) Break the audio into pretty small chunks and peice the
    chunks back together, except you overlap the edges so that
    it decreases the length or repeat the small chunks so it
    increases the length.
    This limits the amount you can alter the length before it
    starts to sound odd. And it usually requires some
    experimentation to get it to sound right based on the
    content of the recording.

    2) Use the FFT to convert the audio into the frequency
    domain, and shift the frequencies into higher or lower range
    (and it's not as simple as just shifting them, it also
    requres some exponential math) and then convert it back to
    the time domain. Now you have a higher or lower version of
    the sound, but the speed isn't altered, but you can then use
    traditional rate changing techniques to slow down or speed
    up the sound so that the pitch is normal again, but the
    length has changed.
    This is much more compilcated, and I'm not totally sure
    if it works in practice yet, but the idea seems feasible.
    I've actually just implemented some FFT stuff in the
    0.4.0beta release and this is a feature I've wanted to
    attempt to implement for a long time.

    So, we'll see... In the end I'll probably do it both ways if
    I can't get either one to always sound right.

  • Davy Durham

    Davy Durham - 2002-09-06
    • assigned_to: nobody --> ddurham
  • Alexandre Fayolle

    Logged In: YES

    You may want to give a look to SndStretch
    which is an XMMS plugin doing sound stretching I've found

    Alexandre Fayolle

  • Davy Durham

    Davy Durham - 2002-09-10

    Logged In: YES

    Ok, I looked at sndstretch and also looked at ogg123's -x/y
    parameters. Both seems to at least end the end repeat small
    sections or leave out small sections of sound to adjust the

    This is obviously a way to do it, but I've never been
    totally satisfied with the way it sounds.

    Also, yesterday I tried a very rough scheme to use the FFT
    and shift the pitch.. well, at least the way I was thinking
    of doing it is not going to work. (I could explain why if
    someone cares to know)

    So anyway, perhaps I will implement the way everyone else is
    doing it for now, with an intention of doing it a different
    way some time later. Heck, maybe there's not a generic way
    of doing it for all audio types. I've got some ideas about
    how to do it with speech, but everyone who's asked me for
    the feature is talking about using it for music.

  • Nobody/Anonymous

    Logged In: NO

    How about looking at the way CoolEdit does it? I've used
    CoolEdit quite a bit for time compression w/o altering
    pitch, and it does work quite well. I'd love to see an
    equivilent in Linux and ReZound.

    CoolEdit uses a splicing frequency, and overlaps.

    Kin Lau

  • Davy Durham

    Davy Durham - 2003-03-14

    Logged In: YES

    Can you explain this "splicing frequency, and overlaps" further?

    I have looked into several different methods... One looks

    But the BEST I've ever heard is done by a company at this

    WOW.. just check out the examples!

    This is really what I want to try to live up to, but I think
    they're keeping a tight lip on any details of how it works.

  • Nobody/Anonymous

    Logged In: NO

    >Can you explain this "splicing frequency, and overlaps"

    Download CoolEdit from www.syntrillium.com, you get to play
    with it for 30 days. Go into the "Transform/Time
    Pitch/Stretch" menu, and you'll see that when you select
    Speed Up or Slow Down, you have the option of a splicing
    frequency and overlap.

    I pulled this from the Help File:

    Splicing Frequency

    The Splicing Frequency determines the size of the chunk of
    audio data used when preserving pitch or tempo while
    elongating or truncating a waveform. The higher the value,
    the more precise the placement of stretched audio over time,
    however artifacts are more noticeable as rates go up. At
    higher precision, lower splicing frequencies may add stutter
    or echo; if the frequency is too high, it may sound tinny,
    or like talking through a tunnel.

    If the low precision mode is used, you can improve the
    quality of stretched mono-tonal (pure tone) samples by
    choosing an Interval Rate that's evenly divisible into the
    frequency of the sample. Use the Frequency Analysis window
    to find the sample's base frequency, then divide by an
    integer to get the Interval Rate. For example, if the tone
    was reported to be 438Hz, dividing by 20 gives 21.9Hz. Thus,
    using 21.9Hz as the Interval Rate will greatly improve the
    quality by reducing phase artifacts. For non-tonal or noisy
    samples, the Interval Rate doesn't matter as much.


    When stretching or compressing, 'chunks' of audio are
    overlapped with previously transformed chunks This setting
    determines how much the current chunk will overlap with the
    previous and next ones. If you find you are getting a chorus
    effect when Stretching, you can lower the overlapping
    percentage, however, doing so may produce a 'choppy' sound.
    If so, adjust the overlapping to strike a balance between
    choppiness and chorusing. Overlapping can be as high as
    about 400%, but you should only use this for really high
    speed increases (like 200% or more).

    Kin Lau

  • Davy Durham

    Davy Durham - 2003-08-30
    • summary: new effect slow down --> Time Stretching/Pitch Shifting
  • Davy Durham

    Davy Durham - 2003-08-30

    Logged In: YES

    I've got this working now. I'm only waiting on the
    libsoundtouch author to make the library more ready for
    distribution on major distros. I've sent him an
    autoconfiscated (using autoconf/automake) version of his
    lib, and he's looking at it.

  • Michael Kiermaier

    Logged In: YES

    I would like the possibility to have two adjustment wheels
    for time/pitch instead of the actual one wheel:

    One for speed adjustments, the other for pitch adjustments.

    Then ReZound would be a great tool for listening to music,
    and write it down:
    First use the pitch wheel to asjust the track to a
    instrument (f.e. if the track is a quartertone off), and
    then use the selection-play function and the slow-down
    function for difficult parts!


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks