#! /bin/zsh # clone system: # # $ fdisk -l # # $ sudo dd bs=4M if=/dev/sdb of=backup-$(date +%Y-%m-%d).img # # $ sudo raspi-config export aplay_test_file=~/bo/bo/bo.m4a aplay-test-file-hw () { local file=$aplay_test_file [[ -f $file ]] && aplay -Dhw:0,0 $file || echo no-file-msg $file } aplay-test-file () { local file=$aplay_test_file [[ -f $file ]] && aplay -q $file || echo no-file-msg $file } test-aplay () { echo "HDMI" force-hdmi aplay-test-file echo "3.5 mm jack" force-jack aplay-test-file echo "auto detection" force-auto aplay-test-file } # From: # https://www.raspberrypi.org/documentation/configuration/audio-config.md change-audio-output () { local output=$1 local card=3 amixer -q cset numid=$card $output } ## HDMI ## with hdmi_drive=2 in /boot/config.txt force-hdmi () { local hdmi=2 change-audio-output $hdmi } hdmi-status () { tvservice -a } test-hdmi () { local file=$1 sudo omxplayer -o hdmi $file } ## 3.5 mm analog 'headphone' jack force-jack () { local jack=1 change-audio-output $jack } test-jack () { local file=$1 sudo omxplayer -o local $file } ## auto force-auto () { local auto=0 change-audio-output $auto }