From 85f8559613e68efdb97d31da661e857fa183ac31 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Thu, 31 Oct 2024 07:29:45 -0700 Subject: [PATCH 1/6] JS8Call - Fixed an audio decode issue in JS8Call when the ET_DEVICE plughw device is used. --- overlay/opt/emcomm-tools/bin/et-js8call | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/overlay/opt/emcomm-tools/bin/et-js8call b/overlay/opt/emcomm-tools/bin/et-js8call index dedad8d..ef9609d 100755 --- a/overlay/opt/emcomm-tools/bin/et-js8call +++ b/overlay/opt/emcomm-tools/bin/et-js8call @@ -2,7 +2,7 @@ # # Author : Gaston Gonzalez # Date : 24 October 2024 -# Updated : 28 October 2024 +# Updated : 30 October 2024 # Purpose : Wrapper script for starting JS8Call with PnP support # # Preconditions @@ -62,7 +62,15 @@ update-config () { APLAY_OUT=$(arecord -l | grep ET_AUDIO) if [ $? -eq 0 ]; then AUDIO_DEVICE=$(echo $APLAY_OUT | cut -d"," -f2 | cut -d":" -f1 | awk '{print $2}') - JS8_AUDIO_DEVICE="plughw:CARD=ET_AUDIO,DEV=${AUDIO_DEVICE}" + + # JS8Call has an issue decoding the received audio following a + # transmission when the device below is used. + # + #JS8_AUDIO_DEVICE="plughw:CARD=ET_AUDIO,DEV=${AUDIO_DEVICE}" + # + # Instead, the following device solves this issue: + JS8_AUDIO_DEVICE="sysdefault:CARD=ET_AUDIO" + et-log "Using '${JS8_AUDIO_DEVICE}' for JS8Call configuration." # 3. Check for existing JS8Call sound configuration From d3bf9c30507dbedd8b73128f5605fa9de6fe8f1e Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Thu, 31 Oct 2024 07:55:49 -0700 Subject: [PATCH 2/6] Audio - Added misc audio tools --- scripts/install-audio-tools.sh | 13 +++++++++++++ scripts/install.sh | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100755 scripts/install-audio-tools.sh diff --git a/scripts/install-audio-tools.sh b/scripts/install-audio-tools.sh new file mode 100755 index 0000000..7964376 --- /dev/null +++ b/scripts/install-audio-tools.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Author : Gaston Gonzalez +# Date : 30 October 2024 +# Purpose : Install audio tools +set -e + +et-log "Installing audio tools..." + +apt install \ + audacity \ + ffmpeg \ + sox \ + -y diff --git a/scripts/install.sh b/scripts/install.sh index 203ae9f..9f825a4 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -2,7 +2,7 @@ # # Author : Gaston Gonzalez # Date : 16 March 2024 -# Updated : 13 October 2024 +# Updated : 30 October 2024 # Purpose : Main installer for EmComm Tools OS Community . ./env.sh @@ -36,3 +36,5 @@ exitIfNotRoot ./install-conky.sh ./install-direwolf.sh + +./install-audio-tools.sh From 1145a13bc0a00718d66ecccc62affb03ba449e3e Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Thu, 31 Oct 2024 08:15:45 -0700 Subject: [PATCH 3/6] Bug - Fixed an issue where continuous polling of rigctld to obtain the VFO causes momentary frequency switches on some Icom radios. This has undefined behavior that impacts both receive and transmit operations when clients like Conky call into the et-system-info command. A more robust client will be created when the EmComm Tools GUI application is introduced. --- overlay/opt/emcomm-tools/bin/et-system-info | 23 ++++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/overlay/opt/emcomm-tools/bin/et-system-info b/overlay/opt/emcomm-tools/bin/et-system-info index fcc9879..8dc6702 100755 --- a/overlay/opt/emcomm-tools/bin/et-system-info +++ b/overlay/opt/emcomm-tools/bin/et-system-info @@ -2,7 +2,7 @@ # # Author : Gaston Gonzalez # Date : 6 October 2024 -# Updated : 25 October 2024 +# Updated : 30 October 2024 # Purpose : Utility script for dumping system information function usage() { @@ -102,14 +102,21 @@ case $1 in # 2. Check if the rigctl systemd unit is running properly systemctl status rigctld --no-pager > /dev/null if [ $? -eq 0 ]; then - + + # Note: I am disabling the VFO read as it causes issues with serval Icom + # radios and results in the VFO changing momentarily during this client + # request. It causes issues during TX and RX. If it is not bulletproof, + # features like this will be turned off. This is a problem given that + # Conky calls this method every 10 seconds. + # # 3. Grab and format frequency - FREQ=$(timeout 1 rigctl -m 2 f) - if [ $? -eq 0 ]; then - printf "%'d MHz\n" "$FREQ" | sed 's|,|.|g' - else - echo "Connected. Can't access VFO"; - fi + #FREQ=$(timeout 1 rigctl -m 2 f) + #if [ $? -eq 0 ]; then + # printf "%'d MHz\n" "$FREQ" | sed 's|,|.|g' + #else + # echo "Connected. Can't access VFO"; + #fi + echo "Connected"; else echo "Connected. No rig control" fi From ae84c033679a3be6b55ec9c0613d8fb8190caf62 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Thu, 31 Oct 2024 11:16:19 -0700 Subject: [PATCH 4/6] Audio - Added initial script to adjusting audio settings for ET supported audio devices --- overlay/opt/emcomm-tools/bin/et-audio | 95 +++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100755 overlay/opt/emcomm-tools/bin/et-audio diff --git a/overlay/opt/emcomm-tools/bin/et-audio b/overlay/opt/emcomm-tools/bin/et-audio new file mode 100755 index 0000000..2ec97f8 --- /dev/null +++ b/overlay/opt/emcomm-tools/bin/et-audio @@ -0,0 +1,95 @@ +#!/bin/bash +# +# Author : Gaston Gonzalez +# Date : 31 October 2024 +# Purpose : Configures ET audio device with sane defaults +# +# Preconditions +# 1. Supported audio interface is connected and properly detected +# +# Postconditions +# 1. ASLA settings set on ET audio device + +usage() { + echo "usage: $(basename $0) " + echo " update-config - Update amixer config" +} + +if [ $# -ne 1 ]; then + usage + exit 1 +fi + +start() { + update-config +} + +update-config () { + + # 1. Check if the symlink was created by the udev rules + if [ -e /dev/et-audio ]; then + + # 2. Check that this device was properly tagged with the ET_AUDIO env variable with a udev rule + APLAY_OUT=$(arecord -l | grep ET_AUDIO) + if [ $? -eq 0 ]; then + AUDIO_CARD=$(echo $APLAY_OUT | cut -d":" -f1 | awk '{print $2}') + AUDIO_DEVICE=$(echo $APLAY_OUT | cut -d"," -f2 | cut -d":" -f1 | awk '{print $2}') + FULL_AUDIO_DEVICE="$AUDIO_CARD,$AUDIO_DEVICE" + + + # Use device descriptor assigned by udev rules + ET_DEVICE=$(udevadm info /dev/et-audio | grep ET_DEVICE | cut -d"=" -f2) + + et-log "Updating audio device: '${ET_DEVICE}' (${FULL_AUDIO_DEVICE})' for ALSA PnP configuration." + + case ${ET_DEVICE} in + "DIGIRIG_MOBILE") + # Unmute Speaker a set volume. Adjust if remote station can't decode you. Your TX controls. + amixer -q -c ${AUDIO_CARD} sset Speaker Playback Switch 42% unmute + # Unmute Mic + amixer -q -c ${AUDIO_CARD} sset Mic Playback Switch 52% unmute + # Set "L/R Capture" to 19. Adjust if you can't decode received audio. Your RX controls. + amixer -q -c ${AUDIO_CARD} sset Mic Capture Switch 31% unmute + # Disable Auto Gain Control + amixer -q -c ${AUDIO_CARD} sset 'Auto Gain Control' mute + + et-log "Applied amixer settings for ${ET_DEVICE}" + ;; + "DIGIRIG_LITE") + # Unmute Speaker a set volume. Adjust if remote station can't decode you. Your TX controls. + amixer -q -c ${AUDIO_CARD} sset Speaker Playback Switch 42% unmute + # Unmute Mic + amixer -q -c ${AUDIO_CARD} sset Mic Playback Switch 52% unmute + # Set "L/R Capture" to 19. Adjust if you can't decode received audio. Your RX controls. + amixer -q -c ${AUDIO_CARD} sset Mic Capture Switch 31% unmute + # Disable Auto Gain Control + amixer -q -c ${AUDIO_CARD} sset 'Auto Gain Control' mute + ;; + *) + el-log "No ALSA configuration specified for this ET_DEVICE." + ;; + esac + + else + et-log "No ET_AUDIO device detected. Can't change ALSA settings." + exit 1 + fi + else + et-log "No ET_AUDIO device plugged in. Can't change ALSA settings." + exit 1 + fi +} + +case $1 in + start) + start + ;; + update-config) + update-config + ;; + *) + echo "Invalid command." + usage + exit 1 + ;; +esac From aee42cb4576c71b4eb8d7af588841939c98a94f0 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Thu, 31 Oct 2024 11:43:27 -0700 Subject: [PATCH 5/6] Audio - Updates to et-audio to make it more robust following testing with udev triggers --- overlay/opt/emcomm-tools/bin/et-audio | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/overlay/opt/emcomm-tools/bin/et-audio b/overlay/opt/emcomm-tools/bin/et-audio index 2ec97f8..0850755 100755 --- a/overlay/opt/emcomm-tools/bin/et-audio +++ b/overlay/opt/emcomm-tools/bin/et-audio @@ -32,17 +32,22 @@ update-config () { # 2. Check that this device was properly tagged with the ET_AUDIO env variable with a udev rule APLAY_OUT=$(arecord -l | grep ET_AUDIO) if [ $? -eq 0 ]; then + + # Use device descriptor assigned by udev rules + ET_DEVICE=$(udevadm info /dev/et-audio | grep ET_DEVICE) + if [ $? -ne 0 ]; then + et-log "ET_DEVICE not set by udev rule. Can't set ALSA settings" + exit 1 + fi + + ET_DEVICE_NAME=$(udevadm info /dev/et-audio | grep ET_DEVICE | cut -d"=" -f2) AUDIO_CARD=$(echo $APLAY_OUT | cut -d":" -f1 | awk '{print $2}') AUDIO_DEVICE=$(echo $APLAY_OUT | cut -d"," -f2 | cut -d":" -f1 | awk '{print $2}') FULL_AUDIO_DEVICE="$AUDIO_CARD,$AUDIO_DEVICE" + et-log "Updating audio device: '${ET_DEVICE_NAME}' (${FULL_AUDIO_DEVICE})' for ALSA PnP configuration." - # Use device descriptor assigned by udev rules - ET_DEVICE=$(udevadm info /dev/et-audio | grep ET_DEVICE | cut -d"=" -f2) - - et-log "Updating audio device: '${ET_DEVICE}' (${FULL_AUDIO_DEVICE})' for ALSA PnP configuration." - - case ${ET_DEVICE} in + case ${ET_DEVICE_NAME} in "DIGIRIG_MOBILE") # Unmute Speaker a set volume. Adjust if remote station can't decode you. Your TX controls. amixer -q -c ${AUDIO_CARD} sset Speaker Playback Switch 42% unmute @@ -53,7 +58,7 @@ update-config () { # Disable Auto Gain Control amixer -q -c ${AUDIO_CARD} sset 'Auto Gain Control' mute - et-log "Applied amixer settings for ${ET_DEVICE}" + et-log "Applied amixer settings for ${ET_DEVICE_NAME}" ;; "DIGIRIG_LITE") # Unmute Speaker a set volume. Adjust if remote station can't decode you. Your TX controls. @@ -64,6 +69,8 @@ update-config () { amixer -q -c ${AUDIO_CARD} sset Mic Capture Switch 31% unmute # Disable Auto Gain Control amixer -q -c ${AUDIO_CARD} sset 'Auto Gain Control' mute + + et-log "Applied amixer settings for ${ET_DEVICE_NAME}" ;; *) el-log "No ALSA configuration specified for this ET_DEVICE." From ef2992ac21085507ce20b7c5c506828642a66cc9 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Thu, 31 Oct 2024 11:54:20 -0700 Subject: [PATCH 6/6] JS8Call - Made a decision to set the audio with the application wrapper and not via udev. This simpler and offers more flexibility as some applications need slightly different audio levels. This will be important once Dire Wolf and ARDOP are introduced. --- overlay/opt/emcomm-tools/bin/et-js8call | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/overlay/opt/emcomm-tools/bin/et-js8call b/overlay/opt/emcomm-tools/bin/et-js8call index ef9609d..4474709 100755 --- a/overlay/opt/emcomm-tools/bin/et-js8call +++ b/overlay/opt/emcomm-tools/bin/et-js8call @@ -2,7 +2,7 @@ # # Author : Gaston Gonzalez # Date : 24 October 2024 -# Updated : 30 October 2024 +# Updated : 31 October 2024 # Purpose : Wrapper script for starting JS8Call with PnP support # # Preconditions @@ -91,6 +91,9 @@ update-config () { echo "SoundOutName=\"${JS8_AUDIO_DEVICE}\"" >> ${JS8CALL_CONF_FILE} fi + ## Configure ALSA settings for sound card + /opt/emcomm-tools/bin/et-audio update-config + else et-log "No ET_AUDIO device detected." notify_user "Can't start JS8Call. No ET_AUDIO device detected."