def remove_offset(self): """ Remove the offset in the channel """ newchannel = Channel() newchannel.sampwidth = self.sampwidth newchannel.framerate = self.framerate avg = audioutils.avg(self.channel.frames, self.sampwidth) newchannel.set_frames(audioutils.bias(self.channel.frames, self.sampwidth, - avg)) self.channel = newchannel
def bias(self, bias): """ Apply a bias on the frames @param bias (int) the value to bias the frames """ newchannel = Channel() newchannel.sampwidth = self.sampwidth newchannel.framerate = self.framerate newchannel.set_frames(audioutils.bias(self.channel.frames, self.sampwidth, bias)) self.channel = newchannel