[pulseaudio-discuss] Per (sink input, sink) volume control / routing

Raman Shishniou rommer at ibuffed.com
Mon Feb 19 16:05:27 UTC 2018


On 02/19/2018 06:46 PM, Andreas Hartmetz wrote:
> Hello!
> 
> I am currently developing an audio system for an automotive customer,
> based on PulseAudio where PulseAudio is applicable. It is part of the
> requirements that the volume of every input channel (sink input) to
> every output channel (sink) can be configured separately. There are
> good reasons for this, for example there can be two backseat info-
> tainment "terminals" which could send their audio to a headphone for
> each, or to the speakers in the whole car. The user-exposed volume
> controls will of course present a simplified vew, but for factory
> configuration, the described control is needed, and volume levels are 
> expected to change at runtime in response to some external events.
> 
> The problem is that PulseAudio does not support that. It could almost
> be "hacked" by using one module-combine-sink for every sink input,
> which at least allows sending a stream to an arbitrary collection of
> sinks. But it does not support volume control at all.
> 
> So:
> - Is there a way that I didn't think of  to piece together the
>   desired volume control using  existing modules and/or other
>   configuration? I don't want to resort to anything really weird
>   like creating lots of "loopback" devices using local sockets or
>   something like that (also for latency reasons), and running
>   multiple server instances also won't do it due to PA requiring to
>   open devices exclusively. Also, any hacky solution is not allowed
>   to significantly increase (or worse, hide from PA so it can't be
>   compensated) latency.
> - If not, what do you think would be the best way to do it? I'm
>   thinking of a potential "module-crossbar" that I would need to
>   write, which allows matrix-style (n, m) volume control, i.e.
>   set_volume(sink_input_index, sink_index, volume).
> 

Volume for each sink-input can configured separately:

$ pactl list sink-inputs
Sink Input #0
        Driver: module-loopback.c
        Owner Module: 4
        Client: n/a
        Sink: 0
        Sample Specification: s16le 2ch 96000Hz
        Channel Map: front-left,front-right
        Format: pcm, format.sample_format = "\"s16le\""  format.rate = "96000"  format.channels = "2"  format.channel_map = "\"front-left,front-right\""
        Corked: no
        Mute: no
        Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
                balance 0.00
        Buffer Latency: 133657 usec
        Sink Latency: 56936 usec
        Resample method: trivial
        Properties:
                media.role = "abstract"
                media.name = "Loopback from Null Input"
                media.icon_name = "audio-input-microphone"
$ pactl set-sink-input-volume 0 32768
$ pactl list sink-inputs
Sink Input #0
        Driver: module-loopback.c
        Owner Module: 4
        Client: n/a
        Sink: 0
        Sample Specification: s16le 2ch 96000Hz
        Channel Map: front-left,front-right
        Format: pcm, format.sample_format = "\"s16le\""  format.rate = "96000"  format.channels = "2"  format.channel_map = "\"front-left,front-right\""
        Corked: no
        Mute: no
        Volume: front-left: 32768 /  50% / -18.06 dB,   front-right: 32768 /  50% / -18.06 dB
                balance 0.00
        Buffer Latency: 133593 usec
        Sink Latency: 20936 usec
        Resample method: trivial
        Properties:
                media.role = "abstract"
                media.name = "Loopback from Null Input"
                media.icon_name = "audio-input-microphone"

> Thanks in advance!
> 
> Andreas Hartmetz
> 
> 
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
> 

--
Raman


More information about the pulseaudio-discuss mailing list