Moode Forum
Airplay and hardware volume - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7)
+--- Thread: Airplay and hardware volume (/showthread.php?tid=2671)

Pages: 1 2


Airplay and hardware volume - gungfly - 06-17-2020

Hi and thanks for all the effort put into Moode !

I have a rpi z wh + Hifiberry Dac+Dsp running Moode audio

In web UI Moode -> audio -> MPD, I have set volume to hardware

When used as UPnP renderer, I can adjust volume in Android BubbleUPnP and can verify by ssh to rpi and there use command dsptoolkit get-volume which shows the DSP changes volume if volume buttons on the phone is pushed.

However in Airplay, I see that as soon as I connect to Airplay the hardware volume is set to 0dB 100% (and 1.002 ; why not 1.000?), so it seems Moode can change it. (and a few seconds after disconnectin it restores the HW vol as it was before connecting)

Is it expected that the HW volume is fixed at 0dB (I would have expected this to be the case only for SW vol), and in any case: can I change something such that when I connect through Airplay the HW volume is not touched and if I adjust volume on my Mac or through Tuneblade the volume adjusts the hardware volume?

I have some indications through googling several links that it should control the HW: http://moodeaudio.org/forum/printthread.php?tid=808


RE: Airplay and hardware volume - Tim Curtis - 06-17-2020

About a year ago there was an option to configure Airplay to use Hardware, Software or Auto-volume (detect and use Hardware volume if available) but IIRC there were a lot of issues coordinating this option with MPD and other volume options and so it was dropped as of the 5.0.0 release. There have been 14 releases of moOde since then and Airplay has been relatively trouble free using it's Software volume method :-)


RE: Airplay and hardware volume - gungfly - 06-17-2020

OK. But UPnP is using the actual HW volume right? This means I must turn off the mixing of toslink and moode input to the DSP since otw the signal on the toslink would get max amplitude as soon as connecting through Airplay. This I can live with. It also means I have to remove volume control dependent DSP which is a bit more sad. This makes me ask: how difficult is it to change such that Airplay also uses the HW vol as the UPnP? And if not easy enough I need to work around the above and chose "software" or "hardware", where software would mean I get tandem volume controls but could keep volume depending DSP and would keep maximum signal levels to the very end which means maximum quality. However, to use a different app to set volume is not ideal... So for ease of use I should probably use the "hardware" But that brings me to the question: how is the Airplay softvolume (used in "hardware" mode) quality. Using my HW volume would give max signal level to the very end of the signal chain meaning a 96dB SNR= good quality (limited by Airplay 16bit) and a 112dB DNR (limited by my DAC). Do I still get that with Airplays softvolume when moOde in "hardware" mode; where does the softvolume sit in the signal chain, and is/can it output 24bit to my 24bit capable DAC/DSP such that I still get 112dB DNR when using Airplay? (assume my system can produce 125dB peak, if the Airplay softvolume outputs 16bit, I get a noise floor of around 125-96dB= 29dB which is very noisy. If it is 24bit the noise floor is 125-144 = -19dB but limited by my DAC at 125-112 = 13dB which is noisy but not terrible).


RE: Airplay and hardware volume - vinnn - 06-17-2020

UPnP rendering on Moode is done by upmpdcli, a UPnP plugin for MPD. Whatever volume configuration MPD has also affects UPnP playback as it's still MPD.
Airplay rendering is done by shairport-sync, a different application.

If MPD is set to use software volume control one would expect the DAC's internal hardware volume to be at 0dB (100%).
With software volume selected in the MPD config, turning down the main volume attenuates MPD's audio output by pre-processing the audio data before being sent to the audio device, just for MPD of course.
Any other audio program will be outputting at their own volume relative to the DAC's hardware volume level.

Setting MPD to hardware volume allows MPD to output to the DAC without the pre-processing and the volume control changes the DAC's volume, which in turn will attenuate the volume of any program on the system outputting to that audio device.

Best case scenario is to disable Moode's volume control and control volume through whatever amplifier or pre-amplifier the DAC is outputting to.

That's my take anyway,


RE: Airplay and hardware volume - gungfly - 06-17-2020

Where in the signal chain is the volume control and will/can I have 24 bit from and including that point and on such that I don't loose DNR (need 112+dB)? Cases: 1) Airplay using HW able DSP/DAC with moOde set to "hardware" volume. 2a) UpNP using HW able DSP/DAC with moOde set to "software" volume. 2b) same as 2a but using Airplay


RE: Airplay and hardware volume - vinnn - 06-17-2020

Airplay doesn't do 24bit audio.
I think you're overthinking all this a bit, firstly you don't "need" 112+dB as human ears can't hear that amount of dynamic range and there's no recordings out there with that amount of dynamic range either.
It is also unlikely you'll be getting anywhere near that amount of dynamic range out of any HiFiBerry board, the top-measuring HAT-based DAC you can get (Allo Katana) has been measured at 109dB SINAD (Signal over noise and distortion).

If you want measured performance use a standalone/separate DAC not a HAT board but as always, measurements don't tell you how something sounds, just use your ears.
Looking at the spec sheet for your board the THD+N is -93dB so the most DR your HiFiBerry will achieve above thd+noise is around 93dB which is still beyond the range of your ears.


RE: Airplay and hardware volume - gungfly - 06-17-2020

Hi all. Thanks Vinn for trying to help. To not waste time and effort, lets try focusing on the questions I have in post 3 or 5 above. I would be very glad if they get answered Smile For some understanding of why I ask: Do we preserve maximum quality and not reduce the 16 bit to for instance 10 when you reduce volume to -30dB?

(For the sub discussion:Some comments on your latest post: 0) I am not overthinking, it is simply a matter of keeping the noise floor reasonably low for a high SPL system (this is not so common in HiFi so I can see you don't have experience that support my use case. 1) I assumed this Airplay implementation is 16 bit and not 24. That does not stop us from having the volume control close to ALSA with a 24 bit output which would preserve all the 16bit of quality instead of truncating them if volume is turned down. My hardware vol ctrl sits in the end of the signal chain just before the DAC+amp so it preserves hi quality and low noise floor even with volume turned way down. And maybe the Airplay softvol is already >16bit output, but if not maybe it can be fixed by re-enabling HW vol for Airplay or by increase to 24bit output from the softvolume. Since this would highly affect audible background noise level of my system I am still interested in the answers to my questions. 2) I know what I need. As an audio engineer employed by Skype, Microsoft, Apple, Huawei, Google and others with patents in signal processing and a focus on audio quality I know a bit on what I need when and why. 3) Human ear has about 130dB DNR, not <112, so we can benefit from more than 16 bit and even more than 112dB. Actually in high quality sound reinforcement >~112dB DNR is required for high SPL systems due to annoyance of idle noise 4) In the particular case the system will produce close to 125dB peak, you can see a napkin calculation in the example in post 3 what it means in terms of noise floor depending on how volume control is implemented: 29dBA or 13 dBA, and as a reference you will find that Apple designs noise levels to be in the single digit level as well do Genelec. The reason is simple: there are use cases where 10dBA is annoying. 5) It is not the SINAD that is the limiting factor here. 6) You mix up SNR with DNR and the requirements of the two: A THD+N of 93 does not mean the DNR is limited to 93. In fact it happens in sound reinforcement that having usable DNR of >>115dB and it still being a limiting quality factor experience wise, while the same system having a SNR or THD+N of <100dB and that not being the limiting factor.)

Anyone interested in having low noise floors and not truncating 16 to 9bits when you turn down volume by 36dB or if you wish higher res than the Airplay 16bit; lets at least start with preserving the 16bits we have and the higher DNR we can have by using 24bit output in the signal chain after soft volumes. This actually matters. And maybe this is already the case, or by some simple changes can be so. So back to my question in post 5:

Will/can I have >16bit from and including the softvolume point in the signal chain until the soundcard ? Maybe it is already the case? If not, can we make it so?

(such that when using UPnP and Airplay (from a Apple sys or PC with Tuneblade) we can achieve a higher than 16bit DNR (of course not SNR) by using the volume control and thus avoid a noise floor of max system SPL-96dB and instead only be limited by the soundcard+amps noise floor.

Or with other words: do we / let's preserve the 16bits we have when turning down volume by i.e. 36dB instead of truncating resolution to 9bits. This can be the case if the softvolume outputs 24bit data into ALSA.)


RE: Airplay and hardware volume - Tim Curtis - 06-17-2020

If you are attenuating volume by 36dB to get to typical listening level then your audio system is probably not calibrated correctly.


RE: Airplay and hardware volume - Tim Curtis - 06-17-2020

As @vinnn mentioned, many users have a downstream master volume control (digital or analog) on an Integrated Amp, Pre amp, AVR, Powered Speakers or they have a dedicated volume control device. They typically configure MPD for 0dB volume output and the renderers, since volume is controlled by the playback application for example iTunes ro Spotify app, to full volume (100%).

Regardless of the audio configuration whenever there is more than one volume control in the audio chain the entire system should be calibrated to reduce the distortion caused by volume attenuation to inaudible levels. This applies to both digital and analog volume controls.

1. Set downstream volume control to 0 (no volume output)
2. Set the upstream volume control to 100% (0dB) full volume
3. Play a track that represents what you typically listen to
4. Turn up the downstream volume control to a level thats the loudest you would ever listen at

After this system calibration the upstream volume control won't have to be attenuated very much to reach typical listening levels and thus volume distortion will almost certainly be inaudible.


RE: Airplay and hardware volume - gungfly - 06-17-2020

Hi Tim and all,

the active speaker is calibrated exactly as you mention, but it is a high SPL capable speaker. So "Loudest ever" is max capacity = 125dB peak at 1m. BTW:The only downstream volume is the hardware volume (lets not implement 3 volume controls...)


So, a high SPL capable system means that often volume will be turned down a lot, and sometimes not (i.e. when used at larger distances or just playing very loud). Sure I can add a 3rd volume knob, but I would like to avoid having to deal with many volume buttons going back and forth in different apps or physical place, it is inconvenient for the users.

For UPnP this should work as it controls my downstream volume.

For Airplay either I need it to also control HW volume, or I need it to output 24 bits (does it?)

And anyway, I think it would be a great thing if we can preserve the 16bits we get from Airplay, instead of truncating them as soon as you turn volume down. Lets not limit the quality unless necessary. In my case it is very audible, in others slightly audible. Many users wants more than 16bits, but lets at least keep the 16 we have when we can Smile

So where do the softvolumes sit in the signal chain, and what would it take to have them output 24bits into ALSA?