def make_16bit(self, maximize_amplitude=True):
"""
Convert to 16 bit sample width, usually by using a maximized amplification factor to
scale into the full 16 bit range without clipping or overflow.
This is used for example to downscale a 32 bits mixed sample back into 16 bit width.
"""
assert not self.__locked
assert self.samplewidth >= 2
if maximize_amplitude:
self.amplify_max()
if self.samplewidth > 2:
self.__frames = audioop.lin2lin(self.__frames, self.samplewidth, 2)
self.__samplewidth = 2
return self
评论列表
文章目录