Robin Here's a simple FreeBSD/GhostBSD shell script that disables the internal speaker (usually pcm0
) without affecting your USB headset (usually pcm1
or higher).
#!/bin/sh
DEFAULT_UNIT=$(sysctl -n hw.snd.default_unit)
echo "Default audio device is pcm${DEFAULT_UNIT}"
for MIXER in /dev/mixer; do
UNIT=$(echo "$MIXER" | sed 's/[0-9]//g')
if [ "$UNIT" != "$DEFAULT_UNIT" ]; then
echo "Muting mixer device: $MIXER"
mixer -f "$MIXER" vol 0
mixer -f "$MIXER" pcm 0
fi
done
echo "Internal speaker(s) muted. USB headset (pcm${DEFAULT_UNIT}) not affected."