I need to be able to simultaneously play several files on my headless Raspberry Pi and dynamically changing their volumes, preferably with Python.

I managed to get it to work with the swmixer Python library but it is based on pyaudio (itself based on portaudio) which is known to stutter on the BCM chipset of the Pi.

sounddevice & soundfile libraries seems to play flawlessly but I'd have to port swmixer to use it instead of pyaudio and that's a lot of work.

Then I thought of going lower-level and use ALSA utils such as aplay to play and amixer to change the volume, using dmix to create a software mixer, but right now I can't make dmix work even with the official base configuration.

What other alternatives do I have to programmatically play/pause/stop and change volume of multiple tracks on a headless Raspberry Pi?

1 Answer 1


Pulse Audio was designed specifically for this use case.

Here is the Pulse Audio API Documentation.

Here is a Pulse Audio Python Library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.