[GH-ISSUE #855] Volume 100 too low #430

Closed
opened 2026-02-27 19:30:34 +03:00 by kerem · 16 comments
Owner

Originally created by @AndreKR on GitHub (Sep 26, 2021).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/855

Originally assigned to: @roderickvd on GitHub.

I have adjusted alsamixer in a way that other players on the system, like Rhasspy, Mopidy, aplay, etc. are each playing with a reasonable volume range. With Librespot however when I turn the volume in Spotify to maximum the actual volume coming out of the speakers is more like what would be 20-30% in e.g. Mopidy.

Originally created by @AndreKR on GitHub (Sep 26, 2021). Original GitHub issue: https://github.com/librespot-org/librespot/issues/855 Originally assigned to: @roderickvd on GitHub. I have adjusted alsamixer in a way that other players on the system, like Rhasspy, Mopidy, `aplay`, etc. are each playing with a reasonable volume range. With Librespot however when I turn the volume in Spotify to maximum the actual volume coming out of the speakers is more like what would be 20-30% in e.g. Mopidy.
kerem 2026-02-27 19:30:34 +03:00
Author
Owner

@roderickvd commented on GitHub (Sep 27, 2021):

Please provide:

  1. the full command line you are launching librespot with;
  2. the full verbose log;
  3. your Alsa configuration file.

Also, the Alsa mixer has been completely rewritten in dev. Is there any difference between the latest dev and currently released 0.2.0?

<!-- gh-comment-id:927585961 --> @roderickvd commented on GitHub (Sep 27, 2021): Please provide: 1. the full command line you are launching librespot with; 2. the full verbose log; 3. your Alsa configuration file. Also, the Alsa mixer has been completely rewritten in `dev`. Is there any difference between the latest `dev` and currently released `0.2.0`?
Author
Owner

@AndreKR commented on GitHub (Sep 27, 2021):

/usr/bin/librespot --name Kitchen --device-type speaker --backend alsa --bitrate 160 --cache /var/cache/raspotify --enable-volume-normalisation --normalisation-pregain 6 --volume-ctrl linear --initial-volume=50 --username [redacted] --password [redacted]

I added the --normalisation-pregain 6 later in order to get louder output, but it didn't really work too well.

Sep 27 16:56:40 raspberrypi systemd[1]: Starting Raspotify...
Sep 27 16:56:40 raspberrypi systemd[1]: Started Raspotify.
Sep 27 16:56:40 raspberrypi librespot[1511]: [2021-09-27T15:56:40Z INFO  librespot] librespot (raspotify v0.16.0) 0adb851 (2020-12-15). Built on 2020-12-30. Build ID: KLdkAvgt
Sep 27 16:56:40 raspberrypi librespot[1511]: [2021-09-27T15:56:40Z INFO  librespot_core::session] Connecting to AP "gew1-accesspoint-a-bsrj.ap.spotify.com:4070"
Sep 27 16:56:40 raspberrypi librespot[1511]: [2021-09-27T15:56:40Z INFO  librespot_core::session] Authenticated as "[redacted]" !
Sep 27 16:56:40 raspberrypi librespot[1511]: [2021-09-27T15:56:40Z INFO  librespot_playback::audio_backend::alsa] Using alsa sink
Sep 27 16:56:40 raspberrypi librespot[1511]: [2021-09-27T15:56:40Z INFO  librespot_core::session] Country: "DE"
Sep 27 17:07:00 raspberrypi librespot[1511]: [2021-09-27T16:07:00Z INFO  librespot_playback::player] Loading <Watashi No Uso (Your Lie in April Original Soundtrack)> with Spotify URI <spotify:track:08hlaHY7ssHzr2MvBKyKvt>
Sep 27 17:07:00 raspberrypi librespot[1511]: [2021-09-27T16:07:00Z WARN  librespot_playback::player] Reducing normalisation factor to prevent clipping. Please add negative pregain to avoid.
Sep 27 17:07:00 raspberrypi librespot[1511]: [2021-09-27T16:07:00Z INFO  librespot_playback::player] <Watashi No Uso (Your Lie in April Original Soundtrack)> (240071 ms) loaded

If you mean /etc/asound.conf, it's:

defaults.pcm.card 1
defaults.ctl.card 1
defaults.pcm.ipc_perm 0666

The first two lines set the default soundcard, the last line allows playback from Docker containers.

Also, the Alsa mixer has been completely rewritten in dev. Is there any difference between the latest dev and currently released 0.2.0?

It appears that Raspotify has been built last in Dec 2020, and 0.16.0 is the librespot version? I think I'm gonna make a new build (0.2.0 or dev) first.

<!-- gh-comment-id:928036710 --> @AndreKR commented on GitHub (Sep 27, 2021): `/usr/bin/librespot --name Kitchen --device-type speaker --backend alsa --bitrate 160 --cache /var/cache/raspotify --enable-volume-normalisation --normalisation-pregain 6 --volume-ctrl linear --initial-volume=50 --username [redacted] --password [redacted]` I added the `--normalisation-pregain 6` later in order to get louder output, but it didn't really work too well. ```text Sep 27 16:56:40 raspberrypi systemd[1]: Starting Raspotify... Sep 27 16:56:40 raspberrypi systemd[1]: Started Raspotify. Sep 27 16:56:40 raspberrypi librespot[1511]: [2021-09-27T15:56:40Z INFO librespot] librespot (raspotify v0.16.0) 0adb851 (2020-12-15). Built on 2020-12-30. Build ID: KLdkAvgt Sep 27 16:56:40 raspberrypi librespot[1511]: [2021-09-27T15:56:40Z INFO librespot_core::session] Connecting to AP "gew1-accesspoint-a-bsrj.ap.spotify.com:4070" Sep 27 16:56:40 raspberrypi librespot[1511]: [2021-09-27T15:56:40Z INFO librespot_core::session] Authenticated as "[redacted]" ! Sep 27 16:56:40 raspberrypi librespot[1511]: [2021-09-27T15:56:40Z INFO librespot_playback::audio_backend::alsa] Using alsa sink Sep 27 16:56:40 raspberrypi librespot[1511]: [2021-09-27T15:56:40Z INFO librespot_core::session] Country: "DE" Sep 27 17:07:00 raspberrypi librespot[1511]: [2021-09-27T16:07:00Z INFO librespot_playback::player] Loading <Watashi No Uso (Your Lie in April Original Soundtrack)> with Spotify URI <spotify:track:08hlaHY7ssHzr2MvBKyKvt> Sep 27 17:07:00 raspberrypi librespot[1511]: [2021-09-27T16:07:00Z WARN librespot_playback::player] Reducing normalisation factor to prevent clipping. Please add negative pregain to avoid. Sep 27 17:07:00 raspberrypi librespot[1511]: [2021-09-27T16:07:00Z INFO librespot_playback::player] <Watashi No Uso (Your Lie in April Original Soundtrack)> (240071 ms) loaded ``` If you mean `/etc/asound.conf`, it's: ``` defaults.pcm.card 1 defaults.ctl.card 1 defaults.pcm.ipc_perm 0666 ``` The first two lines set the default soundcard, the last line allows playback from Docker containers. > Also, the Alsa mixer has been completely rewritten in dev. Is there any difference between the latest dev and currently released 0.2.0? It appears that Raspotify [has been built last in Dec 2020](https://github.com/dtcooper/raspotify/releases), and 0.16.0 is the librespot version? I think I'm gonna make a new build (0.2.0 or dev) first.
Author
Owner

@ashthespy commented on GitHub (Sep 27, 2021):

You don't seem to be using the hardware mixer in this example. When no mixer option is passed, it defaults to the software mixer (softvol).
So the volume in the librespot (0 - 100) is mapped to the current alsa mixer volume.

<!-- gh-comment-id:928058635 --> @ashthespy commented on GitHub (Sep 27, 2021): You don't seem to be using the hardware mixer in this example. When no [`mixer`](https://github.com/librespot-org/librespot/wiki/Options) option is passed, it defaults to the software mixer (`softvol`). So the volume in the librespot (0 - 100) is mapped to the current alsa mixer volume.
Author
Owner

@AndreKR commented on GitHub (Sep 27, 2021):

Correct, none of my applications is controlling the hardware mixer, it is set to a fixed value.

But still "volume 100%" in Mopidy is blowing my eardrums and "volume 100%" in Raspotify/librespot is calm background noise.

<!-- gh-comment-id:928062108 --> @AndreKR commented on GitHub (Sep 27, 2021): Correct, none of my applications is controlling the hardware mixer, it is set to a fixed value. But still "volume 100%" in Mopidy is blowing my eardrums and "volume 100%" in Raspotify/librespot is calm background noise.
Author
Owner

@ashthespy commented on GitHub (Sep 27, 2021):

AFAIK, if nothing is touching the mixer, then the software mixer should just map 100 to the current volume.
So if you set the mixer to 80% - then 100% in librespot is 80% of the actual mixer.

But, again I could be wrong with the new revamped implementation. You could confirm with a simple experiment with amixer, mopidy and librespot..

<!-- gh-comment-id:928065288 --> @ashthespy commented on GitHub (Sep 27, 2021): AFAIK, if nothing is touching the mixer, then the software mixer should just map 100 to the current volume. So if you set the mixer to 80% - then 100% in librespot is 80% of the actual mixer. But, again I could be wrong with the new revamped implementation. You could confirm with a simple experiment with `amixer`, mopidy and librespot..
Author
Owner

@roderickvd commented on GitHub (Sep 27, 2021):

@ashthespy is correct, I have nothing to add to that.

Your asound.conf is plain & simple so I don't understand what you mean by "I have adjusted alsamixer in a way that other players on the system". But I am sure that you will need to either use:

  1. --mixer alsa (if Raspotify supports that -- I just don't know) or
  2. pump up alsamixer to 100% and then control volume using librespot softvol.

Raspotify documents this too: https://github.com/dtcooper/raspotify#troubleshooting

My volume on Spotify is 100% and it's still too quiet!

Have you tried turning the volume up using the command alsamixer?

I'm closing this for now because I'm 99% certain that this isn't a bug in librespot and either of above options will do what you want.

<!-- gh-comment-id:928076162 --> @roderickvd commented on GitHub (Sep 27, 2021): @ashthespy is correct, I have nothing to add to that. Your `asound.conf` is plain & simple so I don't understand what you mean by "I have adjusted alsamixer in a way that other players on the system". But I am sure that you will need to either use: 1. `--mixer alsa` (if Raspotify supports that -- I just don't know) or 2. pump up `alsamixer` to 100% and then control volume using `librespot` `softvol`. Raspotify documents this too: https://github.com/dtcooper/raspotify#troubleshooting > My volume on Spotify is 100% and it's still too quiet! >> Have you tried turning the volume up using the command alsamixer? I'm closing this for now because I'm 99% certain that this isn't a bug in `librespot` and either of above options will do what you want.
Author
Owner

@roderickvd commented on GitHub (Sep 27, 2021):

As a follow-up, unless you have some specific requirement I think you'll want to use a log volume control and not linear. Also see: https://github.com/librespot-org/librespot/wiki/Options#volume-control

<!-- gh-comment-id:928082294 --> @roderickvd commented on GitHub (Sep 27, 2021): As a follow-up, unless you have some specific requirement I think you'll want to use a `log` volume control and not `linear`. Also see: https://github.com/librespot-org/librespot/wiki/Options#volume-control
Author
Owner

@AndreKR commented on GitHub (Sep 27, 2021):

What I meant is: I have deliberately set alsamixer to 45%. Because then, when I play with Mopidy at 100% volume, it is the absolute maximum volume that I want to put my speakers, ears and neighbors through. If I then play the same song from Spotify with Raspotify/librespot at 100% it is so quiet you can talk comfortably in the room.

Now you could say it's just that the MP3 that I'm playing with Mopidy is very very loud, but it's always the same, whether I play an MP3 or play from YouTube (with Mopidy) or play a voice announcement with Rhasspy or aplay or play from Bluetooth with bt-speaker. It's only Raspotify that is so quiet, all other sources share about the same idea of "100% volume".

<!-- gh-comment-id:928086016 --> @AndreKR commented on GitHub (Sep 27, 2021): What I meant is: I have deliberately set `alsamixer` to 45%. Because then, when I play with Mopidy at 100% volume, it is the absolute maximum volume that I want to put my speakers, ears and neighbors through. If I then play the same song from Spotify with Raspotify/librespot at 100% it is so quiet you can talk comfortably in the room. Now you could say it's just that the MP3 that I'm playing with Mopidy is very very loud, but it's always the same, whether I play an MP3 or play from YouTube (with Mopidy) or play a voice announcement with Rhasspy or `aplay` or play from Bluetooth with [bt-speaker](https://github.com/lukasjapan/bt-speaker). It's only Raspotify that is so quiet, all other sources share about the same idea of "100% volume".
Author
Owner

@ashthespy commented on GitHub (Sep 27, 2021):

Not sure what mopidy is doing, but open up alsamixer and confirm thet both mopidy and librespot don't touch your mixer.

Another check can be to completely turn off volume control via librespot and confirm nothing funky is going on..

<!-- gh-comment-id:928089267 --> @ashthespy commented on GitHub (Sep 27, 2021): Not sure what mopidy is doing, but open up `alsamixer` and confirm thet both mopidy and librespot don't touch your mixer. Another check can be to completely turn off volume control via librespot and confirm nothing funky is going on..
Author
Owner

@AndreKR commented on GitHub (Sep 27, 2021):

Not sure what mopidy is doing, but open up alsamixer and confirm thet they both don't touch your mixer.

I can confirm that, it stays at 45 the entire time.

As a follow-up, unless you have some specific requirement I think you'll want to use a log volume control and not linear.

I tried both and I liked linear better. With linear the "good" volumes are distributed over a wider range, so if for example I give a voice command "louder", which will increase the volume by 5%, it's always a good amount. With the log volume control going from 95% to 100% has a too strong effect and going from 45% to 50% has almost no useful effect.

<!-- gh-comment-id:928091922 --> @AndreKR commented on GitHub (Sep 27, 2021): > Not sure what mopidy is doing, but open up alsamixer and confirm thet they both don't touch your mixer. I can confirm that, it stays at 45 the entire time. > As a follow-up, unless you have some specific requirement I think you'll want to use a log volume control and not linear. I tried both and I liked `linear` better. With linear the "good" volumes are distributed over a wider range, so if for example I give a voice command "louder", which will increase the volume by 5%, it's always a good amount. With the `log` volume control going from 95% to 100% has a too strong effect and going from 45% to 50% has almost no useful effect.
Author
Owner

@roderickvd commented on GitHub (Sep 27, 2021):

Can you try the latest librespot by compiling from dev?

Also curious what happens if you disable normalisation altogether. I'm not sure which librespot Raspotify v0.16.0 is based
on, but from the basic logs it seems like it's on librespot 0.1.x. That only has the basic limiter and not the new dynamic limiter. If so, upping the pregain will do the opposite from what you want, because it will drop the volume of the entire track based on the highest peak +6 dB.

Finally, that full verbose log would be good.

<!-- gh-comment-id:928098642 --> @roderickvd commented on GitHub (Sep 27, 2021): Can you try the latest `librespot` by compiling from `dev`? Also curious what happens if you disable normalisation altogether. I'm not sure which `librespot` Raspotify v0.16.0 is based on, but from the basic logs it seems like it's on `librespot` 0.1.x. That only has the basic limiter and not the new dynamic limiter. If so, upping the pregain will do the opposite from what you want, because it will drop the volume of the entire track based on the highest peak +6 dB. Finally, that full verbose log would be good.
Author
Owner

@AndreKR commented on GitHub (Sep 27, 2021):

Yeah, I'll set up a build and check again, maybe it's just the old version.

The log I posted isn't the one you were looking for?

<!-- gh-comment-id:928106815 --> @AndreKR commented on GitHub (Sep 27, 2021): Yeah, I'll set up a build and check again, maybe it's just the old version. The log I posted isn't the one you were looking for?
Author
Owner

@roderickvd commented on GitHub (Sep 27, 2021):

I don't think Raspotify is at librespot 0.2.0 yet: https://github.com/dtcooper/raspotify/issues/394, maybe @JasonLG1979 can tell - he's an avid Raspotify user.

Please launch with --verbose for a full debug log.

Have you tried without normalisation?

<!-- gh-comment-id:928167561 --> @roderickvd commented on GitHub (Sep 27, 2021): I don't think Raspotify is at `librespot` 0.2.0 yet: https://github.com/dtcooper/raspotify/issues/394, maybe @JasonLG1979 can tell - he's an avid Raspotify user. Please launch with `--verbose` for a full debug log. Have you tried without normalisation?
Author
Owner

@JasonLG1979 commented on GitHub (Sep 27, 2021):

@AndreKR I suspect that normalization is the issue. Refer to @roderickvd's comments. Without any sort of dynamic effects (limiting/compression) just lowering the volume by just a few dB is pretty noticeable as -6dB is the equivalent to 1/2 the wattage and -10dB is about half the perceived volume.

<!-- gh-comment-id:928197054 --> @JasonLG1979 commented on GitHub (Sep 27, 2021): @AndreKR I suspect that normalization is the issue. Refer to @roderickvd's comments. Without any sort of dynamic effects (limiting/compression) just lowering the volume by just a few dB is pretty noticeable as -6dB is the equivalent to 1/2 the wattage and -10dB is about half the perceived volume.
Author
Owner

@AndreKR commented on GitHub (Oct 3, 2021):

Progress report: I'm having trouble building Raspotify. Instead I'll build librespot myself. Unlike Python/pip I do actually know Rust/cargo.

<!-- gh-comment-id:932987440 --> @AndreKR commented on GitHub (Oct 3, 2021): Progress report: I'm [having trouble](https://github.com/dtcooper/raspotify/issues/429) building Raspotify. Instead I'll build librespot myself. Unlike Python/pip I do actually know Rust/cargo.
Author
Owner

@JasonLG1979 commented on GitHub (Oct 3, 2021):

Progress report: I'm having trouble building Raspotify. Instead I'll build librespot myself. Unlike Python/pip I do actually know Rust/cargo.

You can always just install raspotify and then replace the binary with a version you build yourself. That's what I do when I'm doing prolonged tests on things. You have to make sure to use the proper args though in /etc/default/raspotify. They have changed since the version that is included in raspotify.

<!-- gh-comment-id:933005190 --> @JasonLG1979 commented on GitHub (Oct 3, 2021): > Progress report: I'm [having trouble](https://github.com/dtcooper/raspotify/issues/429) building Raspotify. Instead I'll build librespot myself. Unlike Python/pip I do actually know Rust/cargo. You can always just install raspotify and then replace the binary with a version you build yourself. That's what I do when I'm doing prolonged tests on things. You have to make sure to use [the proper args though](https://github.com/librespot-org/librespot/wiki/Options) in `/etc/default/raspotify`. They have changed since the version that is included in raspotify.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#430
No description provided.