Is it possible to play 2 sounds simultaneously?

For example: one via HDMI (audio from a video) and another one (custom audio, wav, or whatever) via analog output at the same time?



The Raspberry Pi can only use one output. This is by hardware design and is to do with DMA (Direct Memory Access)

You can plug in a USB audio device then you can use two output sounds at the same time.

The next best thing could be to play a sound out on HDMI, switch to Analog and play a sound there. But not at the same time and switching could make strange noises on both sources.

  • So, if I got an USB audio I can do it via python? – Caio Keto Jun 13 '13 at 14:22
  • Yes. One line of code will reference the internal sound channel and the other the USB one. They can play, record and even stream to each other independently then. – Piotr Kula Jun 13 '13 at 14:31
  • If it's not asking too much, could you link somewhere for me to learn how to make it? – Caio Keto Jun 13 '13 at 14:32
  • Sorry. I do not know. You can try a Python Q&A also found somewhere on stackexchange network, programming sites or something like that. It will be the same as sending music using Raspberry,, you just need to change the output device for the USB. – Piotr Kula Jun 13 '13 at 14:39
  • 1
    Try the PyAlsaAudio homepage: pyalsaaudio.sourceforge.net/pyalsaaudio.html -- Raspbian comes with a package for that as well. – Arne Jun 13 '13 at 16:41

It's possible (at least on Raspberry Pi 3). I have Kodi playing audio through HDMI and MPD playing audio through the analogue output. They can do so simultaneously. See my answer to a similar question.

In short, send one sound to card 0 device 0 (analogue) and another to card 0 device 1 (HDMI).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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