def get_32bit_frames(self, scale_amplitude=True):
"""Returns the raw sample frames scaled to 32 bits. See make_32bit method for more info."""
if self.samplewidth == 4:
return self.__frames
frames = audioop.lin2lin(self.__frames, self.samplewidth, 4)
if not scale_amplitude:
# we need to scale back the sample amplitude to fit back into 24/16/8 bit range
factor = 1.0/2**(8*abs(self.samplewidth-4))
frames = audioop.mul(frames, 4, factor)
return frames
评论列表
文章目录