PyAudio尝试使用JACK

时间:2011-01-12 18:25:58

标签: python alsa portaudio pyaudio jack

我在Python 2.6.6下运行PyAudio并希望它使用ALSA而不是JACK。

In [1]: import pyaudio

In [2]: pa = pyaudio.pa

In [3]: pa.initialize()
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started

1 个答案:

答案 0 :(得分:6)

对于那些碰巧通过Google发现这个老问题的人:

pyaudio显示的消息......

jack server is not running or cannot be started

......提供信息,而不是错误。这意味着portaudio试图连接到Jack并且未能连接到Jack,但并不意味着它放弃了所有东西。

此时,您应该使用ALSA获得功能齐全的PyAudio对象。您可以通过查看可用设备列表来验证这一点:

>>> import pyaudio
>>> pa = pyaudio.PyAudio()
[...lots of crap from ALSA...]
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
>>> print '\n'.join([y['name'] 
... for y in [pa.get_device_info_by_index(x)
... for x in range(pa.get_device_count())]])
bcm2835 ALSA: - (hw:0,0)
bcm2835 ALSA: IEC958/HDMI (hw:0,1)
USB Audio Device: - (hw:2,0)
sysdefault
dmix
default