本文整理汇总了Python中channel.Channel.set_frames方法的典型用法代码示例。如果您正苦于以下问题:Python Channel.set_frames方法的具体用法?Python Channel.set_frames怎么用?Python Channel.set_frames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类channel.Channel
的用法示例。
在下文中一共展示了Channel.set_frames方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: convert
# 需要导入模块: from channel import Channel [as 别名]
# 或者: from channel.Channel import set_frames [as 别名]
def convert(self):
"""
Convert the channel to the expected sample width and frame rate.
"""
newchannel = Channel()
newchannel.set_frames( self.__convert_frames( self.channel.frames ) )
newchannel.sampwidth = self.sampwidth
newchannel.framerate = self.framerate
self.channel = newchannel
示例2: remove_offset
# 需要导入模块: from channel import Channel [as 别名]
# 或者: from channel.Channel import set_frames [as 别名]
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
示例3: append_frames
# 需要导入模块: from channel import Channel [as 别名]
# 或者: from channel.Channel import set_frames [as 别名]
def append_frames(self, frames):
"""
Convert the channel by appending frames.
@param frames (string) the frames to append
"""
newchannel = Channel()
newchannel.set_frames( self.channel.frames + frames )
newchannel.sampwidth = self.sampwidth
newchannel.framerate = self.framerate
self.channel = newchannel
示例4: add_frames
# 需要导入模块: from channel import Channel [as 别名]
# 或者: from channel.Channel import set_frames [as 别名]
def add_frames(self, frames, position):
"""
Convert the channel by adding frames.
@param position (int) the position where the frames will be inserted
"""
newchannel = Channel()
newchannel.set_frames( self.channel.frames[:position*self.sampwidth] + frames + self.channel.frames[position*self.sampwidth:] )
newchannel.sampwidth = self.sampwidth
newchannel.framerate = self.framerate
self.channel = newchannel
示例5: mul
# 需要导入模块: from channel import Channel [as 别名]
# 或者: from channel.Channel import set_frames [as 别名]
def mul(self, factor):
"""
Multiply the frames by the factor
@param bias (int) the factor to multiply the frames
"""
newchannel = Channel()
newchannel.sampwidth = self.sampwidth
newchannel.framerate = self.framerate
newchannel.set_frames(audioutils.mul(self.channel.frames, self.sampwidth, factor))
self.channel = newchannel
示例6: bias
# 需要导入模块: from channel import Channel [as 别名]
# 或者: from channel.Channel import set_frames [as 别名]
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
示例7: remove_frames
# 需要导入模块: from channel import Channel [as 别名]
# 或者: from channel.Channel import set_frames [as 别名]
def remove_frames(self, begin, end):
"""
Convert the channel by removing frames.
@param begin (int) the position of the beggining of the frames to remove
@param end (int) the position of the end of the frames to remove
"""
newchannel = Channel()
newchannel.set_frames( self.channel.frames[:begin*self.sampwidth] + self.channel.frames[end*self.sampwidth:] )
newchannel.sampwidth = self.sampwidth
newchannel.framerate = self.framerate
self.channel = newchannel