Marantz receiver Airplay with power and volume control
June 09, 2024 03:19PM
Thank you for providing a Debian distribution for so many devices. I used a Dockstar to bridge a Marantz receiver onto the network with full power and volume control.

It requires a USB sound device that is supported by ALSA, a USB serial adapter and a Marantz receiver that has a serial port (but not an ethernet otherwise I think it already has Airplay built in to the network interface. I'm using a Marantz SR5003.

Get your sound card working under alsa and make sure that aplay can output sound by default. I had to adjust my asound.conf. This will vary based on what USB sound device you use.

defaults.pcm.card 0
defaults.ctl.card 0

pcm.!default {
  type hw
  card 0
  device 0
}

You will need to install alsa-utils libasound2-plugins shairport-sync alsa-ucm-conf python3-serial.

Add user shairport-sync to the dialout group so it can access the USB serial device.

adduser shairport-sync dialout

In shairport-sync.conf there are a few options to adjust. I set wait_for_completion = "yes" so that power and volume commands would not overlap. Then set run_this_when_volume_is_set to the attached python script volume_is_set.py, same for run_this_after_exiting_active_state and run_this_before_entering_active_state. Note that the scripts will log to /tmp/event.log as they are now, comment out the log related statements if desired. Also set ignore_volume_control = "yes" and then run alsamixer and set to 0db so that the sound card outputs full volume and shairport-sync will not adjust the alsa volume, the volume will be set by the serial commands to the Marantz receiver.

I did make a decision to limit the volume range on the Marantz from -71dB to 0dB. It goes higher, 14dB I thought 0db was enough in case something went wrong.

This should be adaptable to any receiver that has a serial port.



Edited 1 time(s). Last edit at 06/09/2024 03:21PM by frankusb.
Attachments:
open | download - run_this_after_exiting_active_state.py (288 bytes)
open | download - run_this_before_entering_active_state.py (355 bytes)
open | download - volume_is_set.py (694 bytes)
Re: Marantz receiver Airplay with power and volume control
June 09, 2024 05:00PM
frankusb,

Very nice tutorial! Thanks for you contribution. I'll add this to the Wiki thread.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Marantz receiver Airplay with power and volume control
June 09, 2024 06:33PM
I forgot one detail, the power on script sets the input to CD. @SRC:C You can set it to other inputs, see here.

Main Zone Source TV,@SRC:1
Main Zone Source DVD,@SRC:2
Main Zone Source VCR,@SRC:3
Main Zone Source DSS,@SRC:4
Main Zone Source AUX,@SRC:9
Main Zone Source CD/CDR,@SRC:C
Main Zone Source FM,@SRC:G
Main Zone Source AM,@SRC:H
Main Zone Source XM,@SRC:J
Main Zone Source Sirius,@SRC:K
Main Zone Source BD,@SRC:M
Main Zone Source M-Xport,@SRC:N



Edited 1 time(s). Last edit at 06/09/2024 06:34PM by frankusb.
Re: Marantz receiver Airplay with power and volume control
June 10, 2024 07:59AM
It seems I forgot more than one detail. I experienced audio dropout during volume changes. I disabled some features in shairport-sync and no longer have any dropout.

interpolation = "basic";
log_verbosity = 0;
metadata =
{
	enabled = "no";


I've attached my complete configuration file in case I missed anything.
Attachments:
open | download - shairport-sync.conf (22.9 KB)
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: