PyAudio 尝试使用 JACK

发布于 2024-10-11 20:10:06 字数 299 浏览 4 评论 0原文

我在 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

I'm running PyAudio under Python 2.6.6 and would like it to use ALSA and not 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

李白 2024-10-18 20:10:06

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

pyaudio... 显示的消息

jack server is not running or cannot be started

是信息性的,而不是错误。这意味着 portaudio 尝试连接到 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

For those who happen to find themselves at this old question via Google:

The message displayed by pyaudio...

jack server is not running or cannot be started

...is informative, not an error. It means that portaudio tried and failed to connect to Jack, but doesn't mean that it gave up on everything.

At that point, you should have a fully functional PyAudio object using ALSA. You can verify this by, e.g., looking at a list of available devices:

>>> 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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文