bastibe/SoundCard

Can't use it on Raspberry Pi

josephernest opened this issue · 4 comments

Hello,
When doing import soundcard on a Raspberry Pi (RaspiOS Buster image "2020-08-20-raspios-buster-armhf-lite.zip", Python 3.7.3, numpy already installed), it blocks and never returns, so I have to CTRL+C to stop it:

>>> import soundcard
Python 3.7.3^CTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/.local/lib/python3.7/site-packages/soundcard/__init__.py", line 4, in <module>
    from soundcard.pulseaudio import *
  File "/home/pi/.local/lib/python3.7/site-packages/soundcard/pulseaudio.py", line 259, in <module>
    _pulse = _PulseAudio()
  File "/home/pi/.local/lib/python3.7/site-packages/soundcard/pulseaudio.py", line 71, in __init__
    time.sleep(0.001)
KeyboardInterrupt

Do you know the reason why doing just import soundcard makes it enter an infinite loop time.sleep(0.001) @bastibe?

All the best

It fails to find PulseAudio and initialize it. Do you have it installed and running when importing soundcard?

Desktop Linux typically has pulseaudio installed and configured by default. Apparently, Raspbian does not. Thank you for reporting, and figuring out your problem.

If you would like, I'd be grateful for a pull request that adds a note about running it on a Raspberry Pi in the readme (probably under an FAQ heading).

Good idea @bastibe.
Added here: #117