Skip to main content
 首页 » 编程设计

python之在 Ubuntu 14.04 上使用 python 读取音频时出错

2024年10月24日11thcjp

当使用 python 2.7(在 Ubuntu 14.04 中)运行以下代码时

import pyaudio 
p = pyaudio.PyAudio() 

我得到以下异常:

ALSA lib pcm_dsnoop.c:618:(snd_pcm_dsnoop_open) unable to open slave

ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side

bt_audio_service_open: connect() failed: Connection refused (111)

bt_audio_service_open: connect() failed: Connection refused (111)

bt_audio_service_open: connect() failed: Connection refused (111)

bt_audio_service_open: connect() failed: Connection refused (111)

ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave

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

非常感谢您的帮助

请您参考如下方法:

你有安装bluez-alsa包吗?如果是这样,请将其删除,然后重新测试。应该消除错误。

如果没有,这里还有一些讨论 ( https://github.com/Katee/quietnet/issues/18) 可能会有帮助。

ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred 
 
The underun is likely caused because pulseaudio is already accessing  
the card - you can pause it using http://linux.die.net/man/1 
/pasuspender. In general to avoid such deadlock, you need a  
soundserver like jackd https://help.ubuntu.com/community/What%20is%20JACK, but you already figured this out from the following log 
entries in your trace ;-) (apt-get install jackd)