mikebrady / shairport-sync

AirPlay and AirPlay 2 audio player
Other
7.3k stars 574 forks source link

stable: silencing and muting issues #102

Closed senthor closed 5 years ago

senthor commented 9 years ago

Hi, I'm using the stable branch, 2.2.4-openssl-Avahi-ALSA-soxr, on a x86-64 Intel Bay Trail Ubuntu 15.04 Server with Intel HDA / Realtek ALC892 codec. Starting with -d hw:0 -t hardware -c "Front". Alsamixer setup is Master 100, Front default 33, all other channels muted. I have very strange behavior when turning the volume really low from iTunes 12.2.1 (OS X 10.10.4): Turning down volume works fine, reaches 0 for front (channel not muted). But turning down just a little more (one 'step') turns the channel to 100 (really loud!), and another little bit ('step') again to 0 (channel now muted). This only happens when turning volume down, turning it up again works flawlessly. Also, this only happens from iTunes, using my iPhone 6 with iOS 8.4 everything works fine (turning down to 0, then muting the channel), but it could be an issue of not being able to control the volume precisely enough with the touch control. Is this a shairport-sync issue, or is it iTunes' fault?

mikebrady commented 9 years ago

Hmm, that's interesting – I'll see if I can replicate it.

mikebrady commented 9 years ago

Hi there. I've not been able to reproduce this, but I have an idea. Unfortunately, it might take a bit of effort on your part.

The latest version of Shairport Sync has support for metadata. One item of metadata is issued whenever the volume changes. What is issued is a string -- "airplay_volume,volume,lowest_volume,highest_volume", where "volume", "lowest_volume" and "highest_volume" are given in dB. They are the volume requested and the lowest and highest volumes the DAC advertises itself as being able to handle. The "airplay_volume" is what's sent by the source (e.g. iTunes) to the player, and is from 0.00 down to -30.00, with -144.00 meaning "mute". It would indicate whether or not Shairport Sync was sending incorrect volume settings to the mixer.

So, to try this idea out, you'd have to compile and install the latest version with metadata support. Then you'd have to enable metadata in the configuration file. Then you'd have to get a metadata reader to listen to the pipe of metadata – the reader at https://github.com/mikebrady/shairport-sync-metadata-reader would be fine, and then see if you can catch it "in the act". It's a bit of work...

mikebrady commented 8 years ago

I believe I finally found the problem – a default value of "0" was being assigned to the volume when the device was muted. The problem is that "0" can be the highest volume (0dB). I've fixed this in the latest development version by assigning the lowest volume setting to the volume upon mute. It should be in a stable update in a few weeks.

mikebrady commented 8 years ago

This has been fixed in 2.8.2.

senthor commented 8 years ago

After I upgraded to Ubuntu 16.0.4 yesterday I upgraded shairport-sync today (thumbs up for the installer package!). Now, I'm running 2.8.3 — and the bug still exists. But you are right: in alsamixer, volume stays at 100 while being muted.

Metadata:

"ssnc" "pvol": "0.00,0.00,-64.00,0.00".         // max. volume
...
"ssnc" "pvol": "-29.98,-63.89,-64.00,0.00".     // slowly muting…
"ssnc" "pvol": "-29.99,-63.93,-64.00,0.00".     // slowly muting…
"ssnc" "pvol": "-29.99,-63.95,-64.00,0.00".     // slowly muting…
"ssnc" "pvol": "-29.99,-63.97,-64.00,0.00".     // slowly muting…
"ssnc" "pvol": "-30.00,-63.99,-64.00,0.00".     // slowly muting…
"ssnc" "pvol": "-30.00,0.00,-64.00,0.00".       // really loud!
"ssnc" "pvol": "-144.00,-160.30,-64.00,0.00".   // muted.

Video.

mikebrady commented 8 years ago

Thanks for the update, and I see the phenomenon in the log, yikes!

Could I just ask you to check one thing – you may have checked the following already, so apologies if so:

The installer package installs shairport-sync to /usr/bin/shairport-sync whereas when you build it yourself, it's installed to /usr/local/bin/shairport-sync. Thus, you could have a situation where the installer installs 2.8.0 (without the fix) and you build and install 2.8.3 (with the [supposed] fix). Is there any chance something like that is happening? One way to be certain is to set the log verbosity to "1" which will cause the version information to be logged. Thanks.

senthor commented 8 years ago

I fear not. I tried both 2.8.0 and 2.8.3, same result.

mikebrady commented 8 years ago

Okay thanks. I think I have only fixed one occurrence of the problem.

mikebrady commented 8 years ago

I just can't get this problem to occur on my hardware, I'm afraid, so the following is a bit of a shot in the dark. Looking at the volume calculation code again, I see one pathway through it that would result in max output volume – that is, if the airplay volume is outside the range [0 to -30] or [-144], (BTW it should print an error message if log verbosity is 1 or more). Though it seems unlikely that it could be an issue, it just might be a floating point rounding error is causing a problem. Anyhow, I've modified the code to return the minimum volume in such a case and pushed an update out to the head of the development branch. If you'd be good enough to try it at your end, I'd be grateful.

mikebrady commented 8 years ago

Can I just ask another thing – are you making use of the volume_range_db setting? I see that the range of volume is from -64 dB to 0 dB but upon mute it drops down to -160.3 dB.

senthor commented 8 years ago

Sorry for taking so long. I just tested 2.8.4 release, and the problem appears to be fixed. Thank you very much!

When will 2.8.4 be available via the Ubuntu 16.04 package?

mikebrady commented 8 years ago

That's good to hear. I'm afraid I don't really know when 2.8.4 will be out as a package. According to the information in the package, the maintainer is Chris Boot bootc@debian.org (who must be cursing me for updating Shairport Sync so often – though I think the update rate will ease down now, honest!). Chris is also at @bootc. A PPA has also been developed by @dantheperson.

bootc commented 8 years ago

I can't speak for Ubuntu directly (I have no involement with Ubuntu) but I have a 2.8.4 package waiting in the wings for Debian - I just want to test it some more before I upload. As far as I'm aware, Ubuntu essentially regularly copy across Debian packages so you may see an update in the next couple of weeks. If not (and I've already uploaded to Debian) I suggest you find a friendly Ubuntu person to poke to copy the package across.

dantheperson commented 8 years ago

Ill try and update my ppa tonight for ubuntu. Must get a recipie setup to build it automatically. I dont think the debian package will flow automatically into the official ubuntu repositories for existing ubuntu releases.

Dan. On 13/06/2016 2:55 AM, "Chris Boot" notifications@github.com wrote:

I can't speak for Ubuntu directly (I have no involement with Ubuntu) but I have a 2.8.4 package waiting in the wings for Debian - I just want to test it some more before I upload. As far as I'm aware, Ubuntu essentially regularly copy across Debian packages so you may see an update in the next couple of weeks. If not (and I've already uploaded to Debian) I suggest you find a friendly Ubuntu person to poke to copy the package across.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mikebrady/shairport-sync/issues/102#issuecomment-225439291, or mute the thread https://github.com/notifications/unsubscribe/AEyMezXyspl53425yfI7QHv_qx4AtAkaks5qLB3PgaJpZM4FgigR .

mikebrady commented 8 years ago

Thanks everybody.

dantheperson commented 8 years ago

So have built 2.8.4. Had to disable pulseaudio (but who uses that anyway). It'a available for 16.04 on my ppa.

As for the official ubuntu repositories being updated, i don't think that's too likely. Chris's upstream debian packages will feed automagically into the unreleased yakkety package archive, but once an ubuntu release is cut, they don't tend to push out updates except for security and stability updates. For instance yakkety is on 2.8.3 but xenial hasn't been updated from 2.8.0 and I suspect that wont put any effort into 'backporting' updates for packages in the 'universe' repository.

Hence, the cottage industry of PPA maintainers releasing the latest builds for existing distribution releases.

/dan.

On 13 June 2016 at 08:04, Daniel Carter dantheperson@gmail.com wrote:

Ill try and update my ppa tonight for ubuntu. Must get a recipie setup to build it automatically. I dont think the debian package will flow automatically into the official ubuntu repositories for existing ubuntu releases.

Dan. On 13/06/2016 2:55 AM, "Chris Boot" notifications@github.com wrote:

I can't speak for Ubuntu directly (I have no involement with Ubuntu) but I have a 2.8.4 package waiting in the wings for Debian - I just want to test it some more before I upload. As far as I'm aware, Ubuntu essentially regularly copy across Debian packages so you may see an update in the next couple of weeks. If not (and I've already uploaded to Debian) I suggest you find a friendly Ubuntu person to poke to copy the package across.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mikebrady/shairport-sync/issues/102#issuecomment-225439291, or mute the thread https://github.com/notifications/unsubscribe/AEyMezXyspl53425yfI7QHv_qx4AtAkaks5qLB3PgaJpZM4FgigR .

Sent from my computer

mikebrady commented 5 years ago

Closing this due to inactivity. Feel free to open a new issue.