def resample(self, samplerate):
"""
Resamples to a different sample rate, without changing the pitch and duration of the sound.
The algorithm used is simple, and it will cause a loss of sound quality.
"""
assert not self.__locked
if samplerate == self.__samplerate:
return self
self.__frames = audioop.ratecv(self.__frames, self.samplewidth, self.nchannels, self.samplerate, samplerate, None)[0]
self.__samplerate = samplerate
return self
评论列表
文章目录