Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Command to change volume to specific value in Linux

Command to change volume to specific value in Linux

Hi! 

I would like to create a shell script to set the Spotify internal volume setting to a specific value, how is it possible? I have seen it on Mac but not on linux...

 

Thanks in advance

Reply
4 Replies

It is not possible yet. Volume is a property that you can change in the MPRIS D-Bus interface so it would be ideal for setting the Spotify volume in a shell script. https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:Volume

 

However, the Spotify client has not implemented that yet.

Thank you for your answer, yes I have played around with Dbus but the Volume property gives me an error every time when calling: (e.g 0.2 as value) 

$player->Volume(0.2);

 

Error: 

org.freedesktop.DBus.Error.InvalidArgs: Error setting property 'Volume': Expected type 'd' but got 's'

 

What data type should be in the argument..? 

 

Thanks

That looks more like the dbus library in perl/php/whateverlanguage you are using has a bug. It sends something as a string 's' when it should send it as a double 'd', even though it looks like you are giving it something that would be a float/double in many languages. But it doesn't really matter if you fix that.

 

This will correctly send the the MPRIS D-bus Volume property change to Spotify, but Spotify will just ignore it.

 

dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Set string:org.mpris.MediaPlayer2.Player string:Volume variant:double:0.2

 

Still not working as of today 😕

 

Suggested posts