问题
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 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
Before:
After:
Is this a problem that I can fix?
回答1:
You need the JACK daemon to which it's trying to connect:
jack server is not running or cannot be started
It should come with most of the major Linux distributions if it isn't installed already. You should probably take a look on their page and decide which audio architecture you need (probably ALSA) and at what rate you want it to run. I can also recommend running a GUI interface such as QJackCtl on top of it, since JACK sometimes needs some configuring depending on your sound card.
回答2:
You need to configure alsa properly, make sure that arecord works and default device properly records sound. If fixed it should start to work.
It is better to recompile PyAudio(Portaudio) without Jack and Alsa with Pulseaudio support.
Pulseaudio is a default sound framework in Ubuntu and should work without issues.
来源:https://stackoverflow.com/questions/15182336/pyaudio-does-not-work-and-breaks-sound-on-ubuntu