Created
May 20, 2020 19:08
-
-
Save MichaelMackus/f14947d61c9c98ee65e92d2504a00f61 to your computer and use it in GitHub Desktop.
Ardour helper script to check the audio interface is setup properly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
DEVICE="UMC1820" | |
CARD="$(aplay -l | grep "$DEVICE" | sed 's/^card \([0-9]*\).*/\1/')" | |
TERMINAL="st" | |
# find the following settings with amixer -c $CARD | |
CLOCK_SOURCE_SETTING="UMC1820 Clock Selector Clock Source" | |
CLOCK_SOURCE_VALUE="Item0: 'Coaxial In SPDIF'" # ensure this value is set for clock source | |
CLOCK_VALIDITY_SETTING="Coaxial In SPDIF Validity" | |
CLOCK_VALIDITY_VALUE="Playback \[on\]" # ensure this value is set for clock validity | |
# helper functions for error messages (uses libnotify if running outside TTY) | |
error() { | |
if ! tty >/dev/null 2>&1; then | |
notify-send --icon=error -u critical -- Error "$1" | |
exit | |
else | |
echo "ERROR: $1" | |
exit 1 | |
fi | |
} | |
warning() { | |
if ! tty >/dev/null 2>&1; then | |
notify-send --icon=dialog-information -u low -- Warning "$1" | |
else | |
echo "WARNING: $1" | |
echo | |
echo "Hit enter to continue..." | |
read | |
fi | |
} | |
if [ "$1" != "-f" ]; then | |
# check that the recording device is ready | |
if [ -z "$CARD" ]; then | |
error "$DEVICE device not found!" | |
fi | |
# check that the mixer has the proper settings set | |
if amixer -c $CARD sget "$CLOCK_SOURCE_SETTING" | grep "$CLOCK_SOURCE_VALUE" >/dev/null 2>&1; then | |
if ! amixer -c $CARD sget "$CLOCK_VALIDITY_SETTING" | grep "$CLOCK_VALIDITY_VALUE" >/dev/null 2>&1; then | |
error "SPDIF input validity off! Please plug in & power on the master device." | |
fi | |
else | |
warning "SPDIF clock selector source is not set to SPDIF!" | |
fi | |
fi | |
Ardour5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment