I am building a voice recognition algorithm, and the use case specifies that it should be able to identify the targeted speaker from various audio sources, which means that it must be able to process audiofiles with a different number of channels and originally recorded at varying sampling rates. Up to this point, I have been able to both convert all signals from stereo to mono by averaging the channels and standardize the sampling rate to 16 kHz by calling
soundfile.write(filename, signal, sr=16000); however, using this
soundfile method also changes the audio's speed and pitch, accordingly causing the neural net analyzing the input signal to throw a false-positive prediction (i.e. guess the incorrect speaker).
So, I was wondering:
How can I resample audiofiles in Python without changing either the speed or the pitch? (I am open to using an existing audio package or writing the code for a process from scratch.)