[1.5] Volume Control Issues for Spotify?

Hi!
I have just suscribe a Spotify Premuim account (0,99€ for 3 month !!! :slight_smile: ) and discover the problem of the volume I can’t set… :frowning: Big problem for me as I use directly a amp without Volume control… In the state I can’t use it … :frowning:
My DAC does not support hardware volume. So my idea is the following : as spopd in Volumio use sox, I want to set sox to set the volume at a usable level.

sox -v -0.2 for instance. But I can’t find where I could place it. Any idea ?

Hey Balbuze, I’m still trying to figure out that is going on with this. How did you manage to control MPD volume? Was is software control also?

Hi Ning-yu,
Yes, mpd volume is set to software.
Was wondering also with the use of dmix ?

Hi,
even if I’m still looking for a True solution for the software mixer with Spotify and a DAC that not support hardware mixer, I use a modified spopd.conf file to reduce the volume when using Spotify.
In the file /etc/spopd.conf at the end add effects = gain -42 where 42 is the attenuation in db. So you can put the value that suits you ! :wink: With -42 it’s enough for a desktop use. If too low, try with a other value -36 etc… 0 is the max volume.
Don’t froget to kil the spopd daemon ps -ax | grep spop get the pid (ex 2345) and kill it sudo kill -9 pid and restart it sudo spopd -c /etc/spopd.conf
Now, play your Spotify songs !
Of course with that, you CAN’T set the volume with the webUI. It’s a fix value. But once set, you can listen spotify without problem with your neighbours :laughing:
If you modifiy the setting from the webUI, you’ll have to re-modify the conf file.

Hi,
I wrote a script to allow setting volume from the webUI in Soptify even if your DAC only supports software mixer…
Of course, it is surely not the best way to do that, but I don’t know how to do in an other way…
So this script written in python does the following :
A loop check every 0.2 sec if the mpd volume is different from the previous check.
If no, it does nothing.
If yes, it converts this value through a small math ax+b = gain where “a” is a coeff, “b” a correction and write it in the /etc/spopd.conf file. You can of course change these values to match to your setting / ampiflier.
Then after, it kiil the spopd process and relaunch it to take in consideration the change in the config file.
The big problem is that it stop the music. So you have to press Spotify add and play button…
But with it you can easily set the Volume in Spotify :smiley:
To use it : unzip the file in you home directory.
and : sudo python configspop.py
You can add a command in /etc/rc.local such as python /home/pi/configspop.py &
By waiting a true solution…
configspop.py.zip (772 Bytes)

I have updated my script with new coef and correction value…

Hum… My previous script was a workaround but not very convenient.
But, now, I’ve got a much more better solution that should work for every dac without volume control.
1 - you have to create a software volume control in Alsa
I use that http://alsa.opensrc.org/How_to_use_softvol_to_control_the_master_volume to create a file /etc/asound.conf wich contains :

pcm.!default {
    type             plug
    slave.pcm       "softvol"
}

pcm.softvol {
    type            softvol
    slave {
        pcm         "plughw:0,0"
    }
    control {
        name        "Master"
        card        0
    }
}

Then after you can check with :

alsamixer

You should have a mixer control now !
After that you have to edit the file /etc/spopd.conf

[spop]
spotify_username = XXXXXX
spotify_password = XXXXXXX
audio_output = sox
[sox]
output_type = alsa
output_name = softvol <----- change this

In Volumio playback page, set “hardware” volume control mixer
Edit your /etc/mpd.conf and set

audio_output {

                 type           "alsa"
                 name           "Output"
                 device         "softvol"
                 mixer_control  "Master"
                 dop    "no"

}

Restart mpd by typing sudo service mpd restart
Type “alsamixer” and change the value, it should also change in the webUI. If ok hurraaaaa!
Now you should be able to use Spotify or mpd with control volume with the webUI !!! :wink:

This didn’t work exactly like this for me (maybe cause I have a very cheap USB sound card so I don’t have to use the Pi2 analog out.) There was already a Master control, so I had redefine my control as SoftMaster per the alsa guide you linked. Once I changed mpd config to use SoftMaster, everything started working.