Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def set_sample_width(self, sample_width):
if sample_width == self.sample_width:
return self
data = self._data
if self.sample_width == 1:
data = audioop.bias(data, 1, -128)
if data:
data = audioop.lin2lin(data, self.sample_width, sample_width)
if sample_width == 1:
data = audioop.bias(data, 1, 128)
frame_width = self.channels * sample_width
return self._spawn(data, overrides={'sample_width': sample_width,
'frame_width': frame_width})
def remove_data_dc(data, off):
if not off:
off = audioop.avg(data, self.sample_width)
return audioop.bias(data, self.sample_width, -off)
def remove_data_dc(data, off):
if not off:
off = audioop.avg(data, self.sample_width)
return audioop.bias(data, self.sample_width, -off)
def set_sample_width(self, sample_width):
if sample_width == self.sample_width:
return self
data = self._data
if self.sample_width == 1:
data = audioop.bias(data, 1, -128)
if data:
data = audioop.lin2lin(data, self.sample_width, sample_width)
if sample_width == 1:
data = audioop.bias(data, 1, 128)
frame_width = self.channels * sample_width
return self._spawn(data, overrides={'sample_width': sample_width,
'frame_width': frame_width})
def set_sample_width(self, sample_width):
if sample_width == self.sample_width:
return self
data = self._data
if self.sample_width == 1:
data = audioop.bias(data, 1, -128)
if data:
data = audioop.lin2lin(data, self.sample_width, sample_width)
if sample_width == 1:
data = audioop.bias(data, 1, 128)
frame_width = self.channels * sample_width
return self._spawn(data, overrides={'sample_width': sample_width,
'frame_width': frame_width})