当前位置: 首页>>代码示例>>Python>>正文


Python Base.channels方法代码示例

本文整理汇总了Python中Base.channels方法的典型用法代码示例。如果您正苦于以下问题:Python Base.channels方法的具体用法?Python Base.channels怎么用?Python Base.channels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Base的用法示例。


在下文中一共展示了Base.channels方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: play

# 需要导入模块: import Base [as 别名]
# 或者: from Base import channels [as 别名]
	def play(self, repeats=1, bg=True, w=None, data=None, timeout=None, vol=None, pan=None):
		"""
		plays a wav object w, which defaults to the currently loaded instance p.wav

		Set repeats=-1 to loop forever.  Set bg=False to play synchronously.
		
		p.play(w=w2) sets p.wav = w2 and then plays it (which may involve closing and
		re-opening the stream if the bit depth, sampling rate or number of channels
		differs between w2 and the old p.wav).

		p.play(data=d) uses the raw data in numpy.array d instead of the default w.y,
		playing it at the sampling frequency and bit depth dictated by w.
		"""###
		if self.playing: return
		self.timestamps['play'] = prectime()
		self.open(w)
		w = self.wav
		if w == None: return
		if data == None: data = w.y
		if Base.channels(data) != Base.channels(w): raise ValueError, 'data array and wav object have mismatched numbers of channels'
		self.timeout=timeout
		self.kwargs = {'w':w, 'data':data, 'repeats':repeats}
		if vol != None: self.vol = vol
		if pan != None: self.pan = pan
		self.__playing = True
		self.go(bg=bg)
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:28,代码来源:PyAudioInterface.py


注:本文中的Base.channels方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。