Skip to content

Takes in a .wav file outputs a pitch shifted wav file of the same length

License

Notifications You must be signed in to change notification settings

cwoodall/pitch-shifter-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Pitch Shifter

Take an input .wav file and shift the pitch without changing the speed or length of the input file.

Install

Require: Python 3.7+

$ git clone https://github.com/cwoodall/pitch-shifter-py.git
$ cd pitch-shifter-py
$ pip install .

For development virtualenv is recommended:

$ virtualenv venv
$ . ./venv/bin/activate
$ pip install .

On systems where specific versions of scipy and numpy might be needed, those should be installed seperately (using conda or other means)

Usage

The following command will shift the tone up an octave (12 semitones) and blend it so that both have equal volume (.5)

$ pitchshifter -s ./samples/sample1.wav -o out.wav -p 12 -b .5

This example shifts up a fifth (7 semitones) and blends it so it is all the new shifted version:

$ pitchshifter -s ./samples/sample1.wav -o out.wav -p 7 -b 1

With some tweaking you can also use this script to slow down and speed up music using the --no-resample switch. To double the speed shift up and octave (12), but don't resample:

$ pitchshifter -s ./samples/sample1.wav -o out.wav -p 12 --no-resample

To half the speed shift down an octave (-12), but don't resample:

$ pitchshifter -s ./samples/sample1.wav -o out.wav -p -12 --no-resample

Basic Algorithm Flow

Input --> Phase Vocoder (Stretch or compress by 2^(n/12)) --> resample by 2^(n/12)

References

  1. Guitar Pitch Shifter by François Grondin
  2. Phase Vocoder Tutorial by Mark Dolson
  3. NEW PHASE-VOCODER TECHNIQUES FOR PITCH-SHIFTING, HARMONIZING AND OTHER EXOTIC EFFECTS by Laroche and Dolson
  4. Phase-Vocoder: About this phasing business by Laroche and Dolson
  5. Phase Locked Vocoder by Puckette
  6. Improved Phase Vocoder Time-Scale Modification of Audio by Laroche and Dolson

About

Takes in a .wav file outputs a pitch shifted wav file of the same length

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages