7

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
Gus
  • 4,375
  • 5
  • 31
  • 50
  • What happens if you run JACK manually from a terminal, via `jackstart` ? You may also use http://qjackctl.sourceforge.net/ to control the JACK daemon if you like a graphical user interface better. Anyway, post the daemon's startup output. – Jim Brissom Jan 12 '11 at 20:23
  • From the docs at [http://people.csail.mit.edu/hubert/pyaudio/docs/](http://people.csail.mit.edu/hubert/pyaudio/docs/) I think you'll need to pass `pyaudio.paALSA` to `pa.open()` rather than relying on the system to choose. –  May 21 '13 at 01:41
  • Well, I had a similar problem, but the cause was insufficient permissions. On Ubuntu I needed to add myself to the `audio` group. And the error messages were about the same. – Tomasz Gandor Jul 21 '15 at 20:07
  • Related https://stackoverflow.com/questions/7088672/pyaudio-working-but-spits-out-error-messages-each-time – Nikolay Shmyrev Mar 13 '19 at 23:25

1 Answers1

12

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
larsks
  • 277,717
  • 41
  • 399
  • 399
  • 2
    Indeed! And if you want to get rid of the annoying messages, have a look at http://stackoverflow.com/q/36956083. – Matthias Dec 11 '16 at 08:49