我试图使输入输出对的sounddevice模块上的Raspberry Pi与4 USB声卡。我做了两个有线频道,但不断失败,从三个。理想情况下,我想建立多达4个通道的真实流(延迟并不重要。)
我使用回调和:,它似乎可以正常工作,最多两个频道。请查找以下代码:
import sounddevice as sd
def wirecall(indata,outdata,*stuff):
#sd.CallbackStop()
outdata[:]=indata
with sd.Stream(device=0,channels=1,callback=wirecall,samplerate=44100):
with sd.Stream(device=1, channels=1, callback=wirecall, samplerate=44100):
while True:
response=input()
if response in ('', 'q', 'Q'):
break
这很管用,但我再加上一个:它不管用。这是Raspberry还是Sounddevice模块的限制?我也尝试了PyAudio,但结果相同
当我试图打开下面的错误消息发生3流
>>> with sd.Stream(device=3,channels=1,callback=wirecall,samplerate=44100):
... with sd.Stream(device=1,channels=1,callback=wirecall,samplerate=44100):
... with sd.Stream(device=2, channels=1,callback=wirecall,samplerate=44100):
... while True:
... response=input()
... if response in ('', 'q', 'Q'):
... break
...
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
File "/home/pi/.local/lib/python2.7/site-packages/sounddevice.py", line 1662, in __init__
**_remove_self(locals()))
File "/home/pi/.local/lib/python2.7/site-packages/sounddevice.py", line 780, in __init__
'Error opening {0}'.format(self.__class__.__name__))
File "/home/pi/.local/lib/python2.7/site-packages/sounddevice.py", line 2570, in _check
raise PortAudioError(errormsg, err, hosterror_info)
sounddevice.PortAudioError: Error opening Stream: Unanticipated host error [PaErrorCode -9999]: 'Broken pipe' [ALSA error -32]
>>>
目前没有回答
相关问题 更多 >
编程相关推荐