PyAudio无法正常工作并在Ubuntu上中断声音 [英] PyAudio does not work and breaks sound on ubuntu

查看:394
本文介绍了PyAudio无法正常工作并在Ubuntu上中断声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好,所以我现在使用apt-get从软件包python-pyaudio中安装了pyaudio,现在我按如下所示进行导入和调用:

Ok, so I installed pyaudio from the package python-pyaudio using apt-get , now when I Import and Invoke as follows:

Python 2.7.3 (default, Sep 26 2012, 21:53:58) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyaudio
>>> p= pyaudio.PyAudio()
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_params.c:2162:(snd1_pcm_hw_refine_slave) Slave PCM not usable
ALSA lib pcm_params.c:2162:(snd1_pcm_hw_refine_slave) Slave PCM not usable
ALSA lib pcm_params.c:2162:(snd1_pcm_hw_refine_slave) Slave PCM not usable
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
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

它吐出那些错误消息.经过一番研究,我发现了这个问题:

It spits out those error messages. After some researching, I found this question:

PyAudio正常工作,但每次都会吐出错误消息 时间

PyAudio working, but spits out error messages each time

在答案中提到它们只是警告

And in the answers it is mentioned that they are just warnings

但是对我来说,音频实际上不起作用,并且破坏了系统上的音频,使声音"小程序显示所有空白,而没有音频输出

But for me, the audio actually does not work and breaks audio on my system, making the Sound applet show all blanks and no audio outs work

之前:

之后:

这是我可以解决的问题吗?

Is this a problem that I can fix?

推荐答案

您需要正确配置alsa,确保arecord有效并且默认设备正确记录了声音.如果已修复,则应开始工作.

You need to configure alsa properly, make sure that arecord works and default device properly records sound. If fixed it should start to work.

最好在不支持Jack和Alsa的情况下,在支持Pulseaudio的情况下重新编译PyAudio(Portaudio).

It is better to recompile PyAudio(Portaudio) without Jack and Alsa with Pulseaudio support.

Pulseaudio是Ubuntu中的默认声音框架,应该可以正常工作.

Pulseaudio is a default sound framework in Ubuntu and should work without issues.

这篇关于PyAudio无法正常工作并在Ubuntu上中断声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆