4

I need to be able to play a single local audio source from a RasPi over multiple USB headphones. I need to have independent control of which headphones are playing (1 at a time, 2 at a time, ... , all at a time).

I have been working with PulseAudio over the command prompt and have been able to get the audio to play over all the headsets at once, however I am lost on how I can turn headphones on/off independently WHILE the music is still playing. I'm not entirely sure its possible, hence why I am asking here.

Some ideas I've had: (A) Create groups of sinks for each case of headphones on/off and change input to different source groups on the fly (B) Have audio playing over all headphones at once, but adjust volume to 0 on the sinks (headphones) that need to be off

Note: many examples I have seen involve controlling a music stream attached to an IP address. I do not wish to do this, I wish to have audio files locally on the RasPi.

Any help would be appreciated, I am rather new to this.

1

1 Answer 1

1

If there is no other audio output to the headphones besides this single stream, you can use module-combine-sink to set up a combination sink for all the headphones, and then you can mute the headphone sinks themselves as needed.

List all sinks:

pacmd list-sinks | grep name:

Make a combined sink (of course with the sink names you need instead of example names):

pacmd load-module module-combine-sink sink_name=combined sink_properties=device.description="Combined Sink" slaves=alsa_output.usb-first-sink.analog-stereo,alsa_output.usb-second-sink.analog-stereo,...

Then play the stream on the combined sink, and mute

pacmd set-sink-mute alsa_output.usb-first-sink.analog-stereo true

or unmute

pacmd set-sink-mute alsa_output.usb-first-sink.analog-stereo false

as required.

If there is other audio output, I guess one can put a mutable null-sink between the combined sink and each headphone sink.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .