2022-10-11 06:17:13 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-10-22 11:40:41 +00:00
|
|
|
set -ex
|
|
|
|
|
2022-10-11 06:17:13 +00:00
|
|
|
echo "Setting up audio recording"
|
2022-08-20 13:40:10 +00:00
|
|
|
|
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-08-20 13:40:10 +00:00
|
|
|
|
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
|
|
|
|
2022-10-22 12:54:50 +00:00
|
|
|
cd $HOME/hydrophonitor/audio-logger && cargo build --release
|