Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snapcast client, set media.role in the OPTS to use ducking with pulseaudio #829

Closed
gianfer14 opened this issue Mar 14, 2021 · 7 comments
Closed
Labels
feature request next release fixed in develop branch and will be part of the next release

Comments

@gianfer14
Copy link

Is your feature request related to a problem? Please describe.
I am using multiple input sink in pulseaudio and Snapcast client is one of them.
When I try to use pulseaudio ducking feature (lowering volume to allow a announcement stream to be heard), currently the snapcast stream does not get quiter.

Describe the solution you'd like
It would be great to pass the following option to snapcast and add a media.role parameter, for example:
snapclient -s 0 -h 192.168.1.10 --player pulse:server=127.0.0.1,stream-properties="props,media.role=music
current options for pulseaudio are limited to the following:

snapclient --player pulse:?
Options are a comma separated list of:
 "buffer_time=<buffer size [ms]>" - default 100, min 10
 "server=<PulseAudio server>" - default not-set: use the default server

Describe alternatives you've considered
I tried to set the ducking to operate on a global level, with no success.
I tried to send the string snapclient -s 0 -h 192.168.1.10 --player pulse:server=127.0.0.1,stream-properties="props,media.role=music in different ways, but as not currently supported it didn't set the media.role parameter.
I then ran into this page, and found out that:
every stream may have the “media.role” property provided by application

Additional context
Currently, caling pacmd list-sink-inputs shows the parameter whic needs to be updated is module-stream-restore.id.
Below a working input stream:
module-stream-restore.id = "sink-input-by-media-role:music"
And below current equivalent for Snapcast:
module-stream-restore.id = "sink-input-by-application-name:Snapcast"

@gianfer14 gianfer14 changed the title Snapcast client, set media.role in the OPTS in order use ducking with pulseaudio Snapcast client, set media.role in the OPTS to use ducking with pulseaudio Mar 14, 2021
@kingosticks
Copy link
Contributor

Could that media role property be hard-coded rather than a configuration option? Or is there a situation you wouldn't want this i.e. might you be using a snapcast stream as the actual announcement?

@badaix
Copy link
Owner

badaix commented Mar 14, 2021

Hi, would prefer hard coding, because the role will be music, any other role does not match:

PA_PROP_MEDIA_ROLE "media.role" For streams: logic role of this media.

One of the strings "video", "music", "game", "event", "phone", "animation", "production", "a11y", "test"

Plus: it will be just a one-liner

@gianfer14
Copy link
Author

gianfer14 commented Mar 15, 2021

Hi, Thanks for the feedback.
I thought about an user selectable option to make it more customisable by others, but I have now found the same limited list of options mentioned above....
it's interesting because I am using also the announce and phone options, to trigger the ducking in my case. I have found them on a tutorial on how to achieve ducking, but I cannot find them in the pulseaudio documentation.

Anyway, even having it hard coded would be great, and as the overall change is reduced to a single line of code, it makes it even better!

This is my very first feature request, and I am not sure on what the next steps are. I am very happy to give it a try with my limited and rusty programming skills if needed!

@kingosticks
Copy link
Contributor

I was thinking there might be those out there using snapcast as a multi-room PA or one-way intercom system where they'd want the "event" or "phone" roles so that everything else on the system is "ducking" and it's snapcast that gets heard over the top of some other music player. I'm only playing devils advocate here, hard-coding "music" sounds perfectly reasonable since that is the projects intended usage.

@badaix
Copy link
Owner

badaix commented Mar 16, 2021

@gianfer14 I'm even less experienced, I never opened a feature request somewhere :)
For Snapcast there is no fixed process. In this case I did the implementation yesterday evening (I'm quite busy at the moment, but could spent an hour).
With the commit 432e4df you can now add multiple properties with property=<key>=<value>, e.g. --player pulse:property=media.role=phone,property=some.other=value. The media.role property is set per default to music and can be changed by setting this property manually or deleted by explicitly setting it to an empty value with --player pulse:property=media.role=. Empty properties will be dropped and not passed to PulseAudio.
You can download a snapshot package in actions and test if it's working.

@gianfer14
Copy link
Author

Thanks a lot @badaix !
I've tried the 432e4df commit, works perfectly!

@badaix badaix added the next release fixed in develop branch and will be part of the next release label May 3, 2021
@badaix
Copy link
Owner

badaix commented May 15, 2021

Released in Snapcast v0.25.0

@badaix badaix closed this as completed May 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request next release fixed in develop branch and will be part of the next release
Projects
None yet
Development

No branches or pull requests

3 participants