import librosa import soundfile as sf import numpy as np y, sr = librosa.load('c:/tmp/source.wav', sr=44100) # y is a numpy array of the wav file, sr = sample rate y_shifted = librosa.effects.pitch_shift(y, sr, n_steps=0) # shifted by 4 half steps #librosa.write_wav('c:/tmp/test.wav', y_shifted, sr) # Write out audio as 24bit PCM WAV sf.write('c:/tmp/test.wav', y_shifted, sr, subtype='PCM_24')