Spotifyd / spotifyd

A spotify daemon
https://spotifyd.rs
GNU General Public License v3.0
9.78k stars 447 forks source link

Volume control not working #49

Closed rickbrandt closed 7 years ago

rickbrandt commented 7 years ago

Hi! First of all a lot of compliments and gratitude for this project, I got it to work on my Pi yesterday and am very happy with it. I have four questions though.

(1) When pressing the volume buttons on my phone while in the Spotify app, the app shows the volume of Spotify go up and down, but the volume of my music stays the same. Is this a known issue? Is there a way to fix it?

(2) The volume coming from the Pi seems to be remarkably lower than from for instance my phone. The alsamixer is set to 100% already. (Maybe the spotify volume is set to something low and I cannot get it to max because of above issue (1)?).

(3) The audio quality from the Pi seems quite a bit worse than from my phone. My speakers are able to project very clear high pitched drums and stuff like that and when playing a song from my phone, I can notably hear the details more than when playing from the pi. I did set the bitrate to 320 in the config already. Is this just the RPi soundcard being poor compared to my phone (OnePlus One)? I know this is a highly subjective question but maybe someone knows...

(4) When skipping through numbers and disconnecting and reconnecting (don't know what I did exactly) the daemon crashed. Logs are saying this:

Apr 24 16:48:32 raspberrypi Spotifyd[1062]: Caught panic with message: called Option::unwrap() on a None value Apr 24 16:49:44 raspberrypi Spotifyd[1062]: Caught panic with message: called Result::unwrap() on an Err value: "SendError(..)"

I am running the precompiled ARMv7 binary on a RPi 2B Jessie.

Thanks in advance! Cheers Rick

SimonTeixidor commented 7 years ago

Hi!

(1) - Yes, I'm aware of this. I don't use the feature so I haven't bothered. One day :)

(2) and (3) - Yeah, the inbuilt audio is not great. I use a cheap USB DAC which really helps. You could test if the issue is with Spotifyd or not by playing some audio with another application, such as:

aplay /usr/share/sounds/alsa/Front_Center.wav

(4) - No idea, sorry! I think the underlying library might be a little bit unstable. Perhaps set up some solution to restart the daemon when it crashes for now.

Cheers,

Simon

rickbrandt commented 7 years ago
  1. Fair enough, thanks for letting me know (so I dont spend more time on it). 2 and 3. Playing an mp3 seems to have similar volume and sound quality. So indeed seems nothing to do with spotify.
  2. Will do, thanks!
wedi commented 7 years ago

Volume control was working for me in an earlier version. After upgrading to the current release this went away.

I extracted the version this was working in from a file called spotifyd-2017-03-27-armv7.zip but the date does not correspond to a release… I can provide this file if you are interested.

rickbrandt commented 7 years ago

Since some time now I get this error:

19:29:10 [ERROR] Caught panic with message: subscription terminated

My Spotify subscription is still valid though. I tried logging out and in again. Any idea?

rickbrandt commented 7 years ago

@wedi Thanks! For now I dont have anything working anymore so Ill focus on that first ;)

rickbrandt commented 7 years ago

For future reference, the Caught panic with message: subscription terminated error was resolved by getting the latest compiled version. also see

https://github.com/Spotifyd/spotifyd/issues/57

SebastianJarsve commented 7 years ago

+1 for the volume control. I've made an amplifier with a built in Raspberry Pi and wanted to use Spotify Connect to control the music. Everything works great, except for the volume control. Of course, I could just ssh into the Raspberry and adjust the volume with alsamixer, but that doesn't make my amplifier so user friendly.

SimonTeixidor commented 7 years ago

Yeah, this issue shouldn't have been closed. I will look into it.

I've made an amplifier with a built in Raspberry Pi and wanted to use Spotify Connect to control the music. Everything works great, except for the volume control.

Sounds cool! Does the RPi control the amplification via alsamixer? I'm thinking that for good audio quality, one would want to output line level to the amplifier, and then change the volume on the amplifier, rather than outputting less than line level from the RPi, no? In any case, I'm looking into it :)

SimonTeixidor commented 7 years ago

This should be solved on master, binaries will be available in a bit.

The solution is really hackish, but should work. There is an open PR to add an alsa volume controller to Librespot, which will implement a more proper solution. Essentially, the issue is that Librespot defaults the mixer to full volume. Until Librespot merges a more proper solution, I just make sure to never raise the volume by more than 20%, hence blocking the initial setting unless you already had the sound really loud.

SebastianJarsve commented 7 years ago

Yeah, I control the amplification through alsamixer, which works great. Now spotifyd works flawlessly, thanks man!

Jezorko commented 1 year ago

Hey @SebastianJarsve, I just installed this on Raspberry with Manjaro ARM and everything works perfectly, exept the volume control :sweat_smile:

Has this not been resolved, or am I doing something incorrectly? Here's my config:

[global]
username = "…"
password = "…"
use_mpris = false
backend = "alsa"
device = "default"
control = "default"
mixer = "PCM"
volume_controller = "alsa_linear"
device_name = "DownstairsSpeakers"
bitrate = 320
eladyn commented 1 year ago

@Jezorko In general, this should be working. I'm not using Manjaro ARM, but on my RaspberryPi it's working with the following configuration:

backend = "alsa" # use portaudio for macOS [homebrew]

# The alsa audio device to stream audio. To get a
# list of valid devices, run `aplay -L`,
device = "default:CARD=Headphones"  # omit for macOS

# The alsa control device. By default this is the same
# name as the `device` field.
control = "default"  # omit for macOS

# The alsa mixer used by `spotifyd`.
mixer = "Headphone"  # omit for macOS

# The volume controller. Each one behaves different to
# volume increases. For possible values, run
# `spotifyd --help`.
volume_controller = "alsa"  # use softvol for macOS

So, I guess, you could try to play around with those config options and see, if there's a working configuration for you.