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.)

  • $\begingroup$ I'm a bit confused: you already using the tag resampling, and that's exactly what you should be doing (and not are doing). $\endgroup$ Jul 31 '20 at 7:03
  • $\begingroup$ You need to do sample rate conversion. The process is well documented $\endgroup$
    – Hilmar
    Jul 31 '20 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.