I'm just trying to change the sampling rate of a audio dataset (in .wav format) from 32000Hz to 44100Hz but, doing this, the playback speed is changed too (very acceptable and logical). My point is, how can i do this change without modify the playback speed? Currenctly i'm using the Wave lib to do this. Look the follow code:
import wave
# First i open the file.wav on read mode
opened_audio = wave.open(caminho, 'rb')
# Then i get all information that will be maintained
channels = opened_audio.getnchannels()
swidth = opened_audio.getsampwidth()
signal = opened_audio.readframes(-1)
opened_audio.close()
# Here i open the file.wav on write mode
wf = wave.open(caminho, 'wb')
# Then i set all obtained data that will not be changed
wf.setnchannels(channels)
wf.setsampwidth(swidth)
# Here is the new sampling rate in Hz
wf.setframerate(44100)
wf.writeframes(signal)
wf.close()
Detail: i already read many posts here but no one resolve the problem.