2021-12-14 02:48:12 +00:00
|
|
|
#!/bin/bash -x
|
2021-12-15 00:42:31 +00:00
|
|
|
# Run a test using the virtual sound cards, sound I/O performed by aplay/arecord at
|
|
|
|
# Fs=8000 Hz, and we pipe to Python utilities
|
2021-12-14 02:48:12 +00:00
|
|
|
|
|
|
|
function check_alsa_loopback {
|
|
|
|
lsmod | grep snd_aloop >> /dev/null
|
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
echo "ALSA loopback device not present. Please install with:"
|
|
|
|
echo
|
|
|
|
echo " sudo modprobe snd-aloop index=1,2 enable=1,1 pcm_substreams=1,1 id=CHAT1,CHAT2"
|
|
|
|
exit 1
|
2022-05-20 20:31:42 +00:00
|
|
|
fi
|
2021-12-14 02:48:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
check_alsa_loopback
|
|
|
|
|
|
|
|
RX_LOG=$(mktemp)
|
2021-12-14 20:51:54 +00:00
|
|
|
MAX_RUN_TIME=2600
|
2021-12-14 02:48:12 +00:00
|
|
|
|
|
|
|
# make sure all child processes are killed when we exit
|
|
|
|
trap 'jobs -p | xargs -r kill' EXIT
|
|
|
|
|
2023-04-21 13:04:09 +00:00
|
|
|
arecord --device="plughw:CARD=CHAT2,DEV=0" -r 48000 -f S16_LE -d $MAX_RUN_TIME | python3 util_rx.py --mode datac13 --frames 2 --bursts 5 --debug &
|
2021-12-14 20:17:36 +00:00
|
|
|
rx_pid=$!
|
2021-12-14 02:48:12 +00:00
|
|
|
sleep 1
|
2023-04-21 13:04:09 +00:00
|
|
|
python3 util_tx.py --mode datac13 --frames 2 --bursts 5 --delay 500 | aplay --device="plughw:CARD=CHAT2,DEV=1" -r 48000 -f S16_LE
|
2021-12-14 20:17:36 +00:00
|
|
|
wait ${rx_pid}
|