[linux-audio-dev] How hard is it to write a pitch shifter?

Erik de Castro Lopo erikd-lad at mega-nerd.com
Wed Apr 7 05:42:25 UTC 2004

On Wed, 7 Apr 2004 14:29:25 +1000
"Earle" <earle at ezi123.com> wrote:

> But ST doesnt support plugins, and I need to be able to do a "quick and
> dirty" pitchshift on the samples to see if it's gunna fit musically in the
> track.
> I tracked down a bit of code in ST that does a simple fade of the currently
> selected data. I want to change this to do a basic pitchshift.

Most tracker style programs do not do real pitch shifting. Real pitch shifting
(tm) modifies the pitch without affecting the playback duration.

Tracker style pitch shifting (which is more accurately called vari-speed) uses 
a faster or slower playback speed to vary the pitch. Playing a sample back slower
drops the pitch; faster raises the pitch.

Varispeed, can be very easily implemented using a sample rate converter such
as Secret Rabbit Code :


In fact, in the examples directory of the source code tarball there is an
example program called varispeed-play.

> But I cant find out how to deal with the missing data that is removed - to
> keep the original length. 

Changing the pitch without changing the length is true pitch shifting. The
code and concepts required to do this well is extremely complicated.

  Erik de Castro Lopo  nospam at mega-nerd.com (Yes it's valid)
"If you are going to SCO to license superior driver technology,
 you need to reevaluate your product."
  -- Comment about SUN and SCO on Linuxtoday.com

More information about the Linux-audio-dev mailing list