From 74a12356b7ed89b548e8170de89211cffb2924a4 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 2 Jul 2024 15:16:08 +0200 Subject: [PATCH] Force set microphone to 70% if it was at 0% https://github.com/alexbelgium/hassio-addons/issues/1458 --- birdnet-pi/rootfs/etc/cont-init.d/31-checks.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/birdnet-pi/rootfs/etc/cont-init.d/31-checks.sh b/birdnet-pi/rootfs/etc/cont-init.d/31-checks.sh index 188e0ba6c..71d8356e2 100755 --- a/birdnet-pi/rootfs/etc/cont-init.d/31-checks.sh +++ b/birdnet-pi/rootfs/etc/cont-init.d/31-checks.sh @@ -28,6 +28,20 @@ grep -o '^[^#=]*=' "$configtemplate" | sed 's/=//' | while read -r var; do fi done +################ +# CHECK AMIXER # +################ + +# If default capture is set at 0%, increase it to 50% +current_volume="$(amixer sget Capture | grep -oP '\[\d+%]' | tr -d '[]%' | head -1)" 2>/dev/null || true +current_volume="{current_volume:-100}" + +# Set the default microphone volume to 50% if it's currently at 0% +if [[ "$current_volume" -eq 0 ]]; then + amixer sset Capture 70% + bashio::log.warning "Microphone was off, volume set to 70%." +fi + ############## # CHECK PORT # ##############