本文整理汇总了Python中Base.silence方法的典型用法代码示例。如果您正苦于以下问题:Python Base.silence方法的具体用法?Python Base.silence怎么用?Python Base.silence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base
的用法示例。
在下文中一共展示了Base.silence方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import Base [as 别名]
# 或者: from Base import silence [as 别名]
def __init__(self, seconds=None, nchan=None, fs=None, bits=None, w=None, callback=None, packetRateHz=100):
Background.ongoing.__init__(self)
if isinstance(w,player): w = p.wav
if w == None:
if not nchan: nchan = 2
if not fs: fs = 44100
if not bits: bits = 16
w = Base.wav(fs=fs,bits=bits,nchan=nchan)
if seconds: w.y = Base.silence(round(seconds*w.fs), nchan)
else:
if not seconds: seconds = w.duration()
if not nchan: nchan = w.channels()
if not fs: fs = int(w.fs)
if not bits: bits = w.bits
w.fs = fs
w.bits = bits # nbytes should be updated automatically
self.wav = w
self.seconds = seconds
self.nchan = nchan
self.packetRateHz = packetRateHz
if callback != None:
self.handle_data = callback
self.samples_recorded = 0
self.packets_recorded = 0