Linn Kazoo volume control with UPMPDCLI and some scripts

Hello to all,

Thought I’d share my dietpi music server setup. Might be usefull to someone who is struggling to get things running the same way I have…:slight_smile:
My basic setup is a dietpi running on a pi 4b with mpd and alsa installed. To be able to use openhome renderers like Linn Kazoo, Lumin etc…I installed UPMPDCLI and with a seperate package the Qobuz plugin for UPMPDCLI. Note: I don’t use local files anymore…:slight_smile:
I’m running an external USB DAC, the SMSL Sanskrit 10-th edition MK-III.

One of the challenges was to get the circle shaped volume slider in Linn Kazoo to actually work. The mixer_type is set to “none” in mpd.conf which in the end I think doesn’t really matter as I will not be using mpd to control the volume. Not a 100% sure though.

My audio_output config in mpd.conf here below

audio_output {
        type            "alsa"
        name            "SMSL USB AUDIO"
        device          "hw:0,0"
        mixer_type      "none"
        mixer_device    "default"
        mixer_control   "PCM"
        mixer_index     "0"
}

I have tried many configurations in upmpdcli.conf which is located in /etc. It’s now configured like this:…(I only copied the sections where I made changes…)

# Media Renderer parameters

# "Friendly Name" for the Media Renderer.
#friendlyname = UpMpd
# Specific friendly name for the UPnP/AV Media Renderer.
#avfriendlyname =
# Enable UPnP AV services (0/1).
upnpav = 0
# Enable OpenHome services (0/1).
openhome = 1
# MPD parameters

mpdvolume_enable = 1
volume_max = 100
# Audio control hooks
# Command to run when playback is about to begin.
#onstart =
# Command to run when MPD state switches to "PLAY".
#onplay =
# Command to run when MPD state switches to "PAUSE".
#onpause =
# Command to run when MPD state switches to "STOP".
#onstop =
# Command to run when the setstandby action is called.
#onstandby =
# Use external command to manage the the sound volume (0/1).
externalvolumecontrol = 1
# Command to run for reading the sound volume.
getexternalvolume = /usr/local/bin/get-volume.sh
# Command to run to set the volume.
onvolumechange = /usr/local/bin/set-volume.sh
# UPnP/AV tweaking

# Automatically fake a Play command when track is set.
#avtautoplay = 0

# OpenHome parameters

# The name of the room where the Product is located.
ohproductroom = Zitkamer

As you can see I had to make my first bash sripts in order to be able to change the volume. That was a lot of trial and error, alot of googling and chatgpt-ing…

Scripts are located in /usr/local/bin/. Something I didn’t know as well as apparently it’s a global path or something which makes these scripts accesible form anywhere

The get-volume script

#!/bin/bash
amixer get 'SMSL USB AUDIO ' | grep -o -m 1 '[0-9]*%' | tr -d '%'

and the set-volume script

#!/bin/bash
amixer set 'SMSL USB AUDIO ' $1%

It’s important to exactly point to your audio device as I again found out the hardway. To find out what gthe exact name it is you have to point the amixer command to, you can run amixer scontrols. in my case this resulted in

root@DietPi:~# amixer scontrols
Simple mixer control 'SMSL USB AUDIO ',0
Simple mixer control 'SMSL USB AUDIO ',1

Hope this can be of any help as I can imagine there’s music lovers outthere who might be struggling with the same thing…

enjoy

willem

1 Like