hydrophonitor/scripts/setup-audio.sh

31 lines
572 B
Bash
Raw Normal View History

2022-10-11 06:17:13 +00:00
#!/bin/bash
set -ex
2022-10-11 06:17:13 +00:00
echo "Setting up audio recording"
2022-10-04 18:12:00 +00:00
# Install packages
2022-10-11 06:17:13 +00:00
sudo apt-get update && sudo apt-get install -y libasound2-dev libjack-dev
2022-10-04 18:12:00 +00:00
# Get ID and number of the USB audio device
2022-10-02 12:24:51 +00:00
card_number=$(aplay -l | grep -i usb | grep -i audio | cut -d ' ' -f 2 | cut -d ':' -f 1)
# Change default audio device
sudo touch /etc/asound.conf
2022-10-11 06:17:13 +00:00
sudo cat << EOF | sudo tee /etc/asound.conf
2022-10-02 12:24:51 +00:00
pcm.!default {
type plug
slave {
pcm "hw:$card_number,0"
}
}
ctl.!default {
type hw
card $card_number
}
EOF
2022-10-11 06:17:13 +00:00
cd hydrophonitor/audio-logger && cargo build --release