I am quite happy with my dam1941 and moode 6.4.2. A proper integration of the hardware volume control in combination with lirc would be great.
At the moment i change the volume with lirc over the serial port connected with the raspberry pi.
The big advantage of this setup is, to control the preamp, the dam1941 and the mpd with one single remote control.
How to use the serial connection with the dam1941:
First moode has to be installed and also
lirc .
Step1
Disable the serial console.
Go to "Interfacing Options"
Select "P6 Serial"
Select "No" Would you like a login shell to be accessible over serial?
Select "Yes" Would you like the serial port hardware to be enabled?
If you do not disable the serial console the frontend of the dam1941 will get stuck and you have to powercycle the dam.
Step2
Set the correct baudrate for the dam.
Code:
/bin/stty -F /dev/serial0 115200
The best way is to create a systemd service to set this parameter. There are many tutorials out there how to do this.
Step 3
play with the serial commands....
Code:
# Set volume $LEVEL is a variable with a value from 0 to 100
sudo echo -ne "V-$((100 - $LEVEL))\r\n" > /dev/serial0
The mehod with the echo commands is much faster than the python lib from
https://github.com/fortaa/dam1021 .
Speed is important because of the repeat function when the rc-buttons are pushed long.
Also i changed the "vol.sh" for my needs:
Code:
#!/bin/bash
#
# volume switcher for dam1941
#
#
#
# http://moodeaudio.org
# moOde audio player (C) 2014 Tim Curtis
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# 2019-01-31 initial version
#
VER="0.1"
SQLDB=/var/local/www/db/moode-sqlite3.db
testfile=/tmp/level.tmp
if [ ! -e "$testfile" ] ; then
touch "$testfile"
echo "50" > $testfile
fi
if [ ! -w "$testfile" ] ; then
echo cannot write to $testfile
exit 1
fi
if [[ -z $1 ]]; then #if no option is selected then print last volume
cat $testfile
echo "is the last volume stored in /tmp/level.tmp"
exit 0
fi
if [[ $1 = "--help" ]]; then
echo -e "Usage: vol.sh [OPTION] [VOLUME]
Change the volume and update the knob.
With no OPTION or VOLUME, print the current volume.
With just VOLUME, set current volume to VOLUME.
-up\t\tVOLUME value between 1 and 100
-dn\t\tVOLUME value between 1 and 100
--version\tprint the program version
--help\t\tprint this help text"
exit 1
fi
if [[ $1 = "--version" ]]; then
echo "Version: "$VER
exit 1
fi
# get config settings
while [ "$OLD" = '' ]
do
OLD=$(cat $testfile)
done
# echo $OLD
# friendly names
REGEX='^[0-9]+$'
# parse OPTIONS
if [[ $1 = "-up" || $1 = "up" ]]; then
if ! [[ $2 =~ $REGEX ]]; then
echo "VOLUME must only contain digits 0-9"
exit 1
else
LEVEL=$(($OLD + $2))
fi
elif [[ $1 = "-dn" || $1 = "dn" ]]; then
# volume down step
if ! [[ $2 =~ $REGEX ]]; then
echo "VOLUME must only contain digits 0-9"
exit 1
else
LEVEL=$(($OLD - $2))
fi
else
LEVEL=$1
fi
# numeric check
if ! [[ $LEVEL =~ $REGEX ]]; then
echo "Invalid OPTION or VOLUME not numeric"
exit 1
fi
# range check
if (( $LEVEL < 30 )); then
LEVEL=30
elif (( $LEVEL > 100 )); then
LEVEL=100
fi
echo $LEVEL > $testfile
sudo echo -ne "V-$((100 - $LEVEL))\r\n" > /dev/serial0
sqlite3 $SQLDB "update cfg_system set value=$LEVEL where id='32'"
This works fast enough for me. The volume change is not perfect smooth but not bad.
I made the workaround with the "/tmp/level.tmp" to store the volume because the sqlite command sometimes returns "0" when the script will be started often because of the "repeat" from the remote control.
Question: Is there a way to enable the volume knob when the "SOEKRIS dam1021/dam1121" dac has been selected?