當前位置: 首頁>>代碼示例>>Python>>正文


Python Channel.sampwidth方法代碼示例

本文整理匯總了Python中channel.Channel.sampwidth方法的典型用法代碼示例。如果您正苦於以下問題:Python Channel.sampwidth方法的具體用法?Python Channel.sampwidth怎麽用?Python Channel.sampwidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在channel.Channel的用法示例。


在下文中一共展示了Channel.sampwidth方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: convert

# 需要導入模塊: from channel import Channel [as 別名]
# 或者: from channel.Channel import sampwidth [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
開發者ID:drammock,項目名稱:sppas,代碼行數:13,代碼來源:channelformatter.py

示例2: remove_offset

# 需要導入模塊: from channel import Channel [as 別名]
# 或者: from channel.Channel import sampwidth [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
開發者ID:drammock,項目名稱:sppas,代碼行數:14,代碼來源:channelformatter.py

示例3: append_frames

# 需要導入模塊: from channel import Channel [as 別名]
# 或者: from channel.Channel import sampwidth [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
開發者ID:drammock,項目名稱:sppas,代碼行數:14,代碼來源:channelformatter.py

示例4: add_frames

# 需要導入模塊: from channel import Channel [as 別名]
# 或者: from channel.Channel import sampwidth [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
開發者ID:drammock,項目名稱:sppas,代碼行數:14,代碼來源:channelformatter.py

示例5: mul

# 需要導入模塊: from channel import Channel [as 別名]
# 或者: from channel.Channel import sampwidth [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
開發者ID:drammock,項目名稱:sppas,代碼行數:15,代碼來源:channelformatter.py

示例6: bias

# 需要導入模塊: from channel import Channel [as 別名]
# 或者: from channel.Channel import sampwidth [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
開發者ID:drammock,項目名稱:sppas,代碼行數:15,代碼來源:channelformatter.py

示例7: remove_frames

# 需要導入模塊: from channel import Channel [as 別名]
# 或者: from channel.Channel import sampwidth [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
開發者ID:drammock,項目名稱:sppas,代碼行數:15,代碼來源:channelformatter.py


注:本文中的channel.Channel.sampwidth方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。