Weak volume output with DietPi + Shairplay

The output volume level is very weak when I play Roon through DietPi/Shairplay. Is there some sort of pre-amp level setting I’m missing?

I have RoonBridge installed on the same DietPi image, and when I play the same song through RoonBridge (at the same volume setting), it is much louder. (I’d rather just use RoonBridge, but I need Shairplay for grouped playback with other endpoints around the house.)

Hardware is a Raspberry Pi 3, wifi in, onboard 3.5mm audio out. DietPi soundcard setting: rpi-bcm2835 (tried both standard and forced 3.5mm). PSU noise reduction enabled in DietPi.

Is there any way to get a stronger output signal without purchasing an external sound card?

Hi Andy,

It could be related to the volume control on the RPi device.

Try running the following program and check volume is set to just below -0.x dB:

alsamixer

If problems persist, please let me know, may be something we need to look at in the shairport-sync settings.

1 Like

Thanks! It seems that alsamixer is only responding to RoonBridge and not to ShairPort Sync. ShairPort still adjusts the volume, but the changes are not reflected in alsamixer and are limited by the last alsamixer gain setting. So if I use RoonBridge and set the volume at, say -2.0dB, then I switch to ShairPort Sync, the maximum gain available to ShairPort is -2.0dB. (The alsamixer gain number never changes, just the sound output.) I will try uninstalling Roon, ShairPort, and ALSA, then reinstall ShairPort and ALSA to see what happens.

Even after uninstalling uninstalling Roon, ShairPort, and ALSA, then reinstalling ShairPort Sync (and with it ALSA), the problem is the same. The default volume for ALSA seems to be 85, or -0.38dB, so this becomes the absolute limit for ShairPort. Adjusting volume in Roon just sets the output in relation to this maximum and does not change alsamixer. The work-around, obviously is to just go into alsamixer and set it at 100, or about +4dB. However, it would be nice if ShairPort could control alsamixer directly, so DietPi could function as both a RAAT endpoint and an AirPlay device.

P.S. I looked to see if there was a “hardware volume control” setting in Roon for the ShairPort endpoint, but I didn’t see this as an option.

P.P.S I also tried AirPlay from my iPhone, and it works the same. Volume is limited to whatever alsamixer is set to, and the AirPlay volume doesn’t change alsamixer.

Hi,

Appears Shairport-sync uses a software mixer by default, we can override this and force ALSA volume with (copy and paste all):

dietpi-services stop
cat << _EOF_ >  /usr/local/etc/shairport-sync.conf
general =
{
  name = "%H";
  interpolation = "soxr";
};

metadata =
{
	enabled = "yes";
	include_cover_art = "no";
	pipe_name = "/tmp/shairport-sync-metadata";
	pipe_timeout = 5000;
	socket_address = "226.0.0.1";
	socket_port = 5555;
	socket_msglength = 65000;
};

//Disable software mixer
alsa =
{
    mixer_control_name = "PCM";
};
_EOF_
dietpi-services start
3 Likes

Uh-oh. I must have done something wrong. I copied and pasted the commands above into the DietPi command prompt & hit [Enter]. Now the shareport sync service isn’t working. I tried rebooting and restarting dietpi-services.

The “dietpi-services status” command gives this result:

     DietPi-Services
─────────────────────────────────────────────────────
 Mode: status
 Please wait...

cron       Active: active (running) since Wed 2017-07-12 15:47:56 UTC; 22s ago
avahi-daemon       Active: active (running) since Wed 2017-07-12 15:47:56 UTC; 22s ago
shairport-sync     Active: failed (Result: exit-code) since Wed 2017-07-12 15:47:56 UTC; 22s ago

I’m wondering if I should have changed the IP address in the shairport sync configuration file? Is 226.0.0.1 correct for a home network?

Here’s what I get when I “cat” the shairport-sync.conf file:

root@DietPi:~# cat /usr/local/etc/shairport-sync.conf
general =
{
  name = "%H";
  interpolation = "soxr";
};
metadata =
{
.enabled = "yes";
.include_cover_art = "no";
.pipe_name = "/tmp/shairport-sync-metadata";
.pipe_timeout = 5000;
.socket_address = "226.0.0.1";
.socket_port = 5555;
.socket_msglength = 65000;
};
//Disable software mixer
alsa =
{
    mixer_control_name = "PCM";
};

Hi Andy,

This is a known issue with tab’s/spaces, using copy and paste in some SSH clients. Sometimes, for bizarre reasons, they get converted to full stops.

I believe if you remove the full stops at the start of the following lines, save changes and restart services, should be fine:

metadata =
{
.enabled = "yes";
.include_cover_art = "no";
.pipe_name = "/tmp/shairport-sync-metadata";
.pipe_timeout = 5000;
.socket_address = "226.0.0.1";
.socket_port = 5555;
.socket_msglength = 65000;
};

To edit the file:

nano /usr/local/etc/shairport-sync.conf

Save changes with:
ctrl+o , then say yes

Exit with:
ctrl+x

Restart services with:

dietpi-services restart
1 Like

This is for the metadata plugin if used (advanced):

I believe *.0.0.1 are internal IP addresses, only accessible by the local device itself.

1 Like

That did the trick! It works perfectly now, with both RoonBridge and Shairport Sync adjusting the volume in alsamixer. The max volume is the same through both. And so far, it is switching back and forth between the two with no trouble.

Thanks so much for your help on this! I’m on a very tight budget, but I did send a (very) small donation to the DietPi page as a way of saying thanks.

2 Likes

Thanks Andy,

Great to hear. Really appreciate the donation, help keeps the project going :slight_smile:

1 Like

FYI my solution to this was to add the following to /usr/local/etc/shairport-sync.conf:
in “general” section
ignore_volume_control = “yes”;

I also have:

alsa =
{
output_device = “hw:0”
// mixer_control_name = “PCM”;
};

where hw:0 is my hifiberry card.
Other than that, my conf file matches with the one in the earlier post.

regards Robert

2 Likes

@Dan_Knight or anyone that can help. I was having this same issue on an allo boss (very low output with airplay) and attempted these instructions. Now I can seem to get airplay back working (it doesn’t show up in roon). This is what the shairport-sync.conf looks like:
general =
{
name = “%H”;
interpolation = “soxr”;
};

metadata =
{
enabled = “yes”;
include_cover_art = “no”;
pipe_name = “/tmp/shairport-sync-metadata”;
pipe_timeout = 5000;
socket_address = “226.0.0.1”;
socket_port = 5555;
socket_msglength = 65000;
};

//Disable software mixer
alsa =
{
mixer_control_name = “PCM”;
};