Skip to content

Commit 9013dfd

Browse files
committed
building up scripts for presentation
1 parent 87b6f6d commit 9013dfd

File tree

4 files changed

+64
-10
lines changed

4 files changed

+64
-10
lines changed

script/test_2020x.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ CODEC2_PATH=$HOME/codec2
88
PATH=$PATH:$CODEC2_PATH/build_linux/src:$CODEC2_PATH/build_linux/misc
99
FADING_DIR=$CODEC2_PATH/build_linux/unittest
1010
No_AWGN=-20
11+
No_AWGN_LOW=-17
1112
No_Multipath=-25
1213
serial=0
1314
compressor_gain=6
@@ -36,6 +37,10 @@ function run_sim_ssb() {
3637
channel_opt=""
3738
No=$No_AWGN
3839
fi
40+
if [ "$channel" == "awgnlow" ]; then
41+
channel_opt=""
42+
No=$No_AWGN_LOW
43+
fi
3944
if [ "$channel" == "mpp" ] || [ "$channel" == "mpd" ]; then
4045
channel_opt='--'${channel}
4146
No=$No_Multipath
@@ -78,6 +83,10 @@ function run_sim() {
7883
channel_opt=""
7984
No=$No_AWGN
8085
fi
86+
if [ "$channel" == "awgnlow" ]; then
87+
channel_opt=""
88+
No=$No_AWGN_LOW
89+
fi
8190
if [ "$channel" == "mpp" ] || [ "$channel" == "mpd" ]; then
8291
channel_opt='--'${channel}
8392
No=$No_Multipath
@@ -154,5 +163,10 @@ run_sim $SPEECH_IN_8k_RAW 700E clip awgn
154163
run_sim $SPEECH_IN_8k_RAW 700E clip mpp
155164
run_sim $SPEECH_IN_8k_RAW 700E clip mpd
156165

166+
# Low SNR samples
167+
run_sim_ssb $SPEECH_IN_8k_RAW awgnlow
168+
run_sim $SPEECH_IN_8k_RAW 700E clip awgnlow
169+
run_sim $SPEECH_IN_16k_RAW 2020 clip awgnlow
170+
run_sim $SPEECH_IN_16k_RAW 2020A clip awgnlow indopt
157171

158172
exit

unittest/ota_voice_auto.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env bash
22
# ota_voice_auto.sh
33
#
4-
# Run a single automated voice test, files are put in a time stamped directory, and summarised in single line
5-
# in the log file log_voice.txt. Designed to be from cron.
4+
# Run a single automated voice test, files are put in a time stamped
5+
# directory, and summarised in single line in the log file
6+
# log_voice.txt. Designed to be used from cron.
67

78
# use crontab -e to edit cron for currrent user, sample entry:
89

unittest/ota_voice_summary.sh

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,20 @@
22
#
33
# Summarise tests to date into one directory to allow easy browsing
44

5+
src=/home/david/Downloads/speech_orig_16k.wav
6+
length_src=$(sox $src -n stat 2>&1 | grep Length | sed -r 's/.*\:\s*//')
7+
58
dir=voice_summary
69
mkdir -p ${dir}
710
time_snr_files=$(find . -name time_snr.jpg | sort)
811
p=$(pwd)
912
serial=0
13+
14+
echo "<table>"
15+
echo "<tr>"
16+
echo "<th>Serial</th><th>Mode</th><th>KiwiSDR</th><th>Rx</th><th>AnDV</th><th>DV</th><th>Spectrogram</th><th>SNR</th>"
17+
echo "</tr>"
18+
1019
for f in $time_snr_files
1120
do
1221
d=$(echo $f | sed -r 's/\.\/(.*)\/time_snr.jpg/\1/')
@@ -40,10 +49,31 @@ do
4049
esac
4150
mode=$(head ${d}/log.txt -n 2 | tail -n 1)
4251
serial_str=$(printf "%04d" $serial)
43-
echo $serial_str $d $sdr $mode
44-
cp ${d}/spec.jpg ${dir}/${serial_str}_${d}_${sdr}_${mode}_spec.jpg
45-
cp ${d}/time_snr.jpg ${dir}/${serial_str}_${d}_${sdr}_${mode}_time_snr.jpg
46-
cp ${d}/rx.wav ${dir}/${serial_str}_${d}_${sdr}_${mode}_rx.wav
47-
cp ${d}/rx_freedv.wav ${dir}/${serial_str}_${d}_${sdr}_${mode}_rx_freedv.wav
52+
#echo $serial_str $d $sdr $mode
53+
echo "<tr>"
54+
echo "<td>$serial</td>"
55+
echo "<td>$mode</td>"
56+
echo "<td>$sdr</td>"
57+
58+
f=${dir}/${serial_str}_${d}_${sdr}_${mode}
59+
60+
cp ${d}/rx.wav ${f}_rx.wav
61+
echo "<td><a href=\"${f}_rx.wav\">Rx</td>"
62+
63+
cp ${d}/rx_freedv.wav ${f}_rx_freedv.wav
64+
echo "<td><a href=\"${f}_rx_freedv.wav\">AnDV</td>"
65+
66+
length_f=$(sox ${f}_rx_freedv.wav -n stat 2>&1 | grep Length | sed -r 's/.*\:\s*//')
67+
start_dv=$(python -c "print(${length_f}-${length_src}-2)")
68+
sox ${d}/rx_freedv.wav ${f}_rx_freedv_dv.wav trim $start_dv $length_src
69+
echo "<td><a href=\"${f}_rx_freedv_dv.wav\">DV</td>"
70+
71+
cp ${d}/spec.jpg ${f}_spec.jpg
72+
echo "<td><img src=\"${f}_spec.jpg\" width="200" height="200" /></td>"
73+
cp ${d}/time_snr.jpg ${f}_time_snr.jpg
74+
echo "<td><img src=\"${f}_time_snr.jpg\" width="200" height="200" /></td>"
75+
echo "</tr>"
4876
serial=$((serial + 1))
4977
done
78+
79+
echo "</table>"

unittest/ota_voice_test.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# ota_test.sh
2+
# ota_voice_test.sh
33
#
44
# Automated Over The Air (OTA) voice test for FreeDV HF voice modes
55
#
@@ -10,10 +10,11 @@
1010
# sudo adduser david dialout
1111
# 4. To test rigctl:
1212
# echo "m" | rigctl -m 361 -r /dev/ttyUSB0
13-
# 5. Sample command line:
13+
# 5. Adjust Tx drive so ALC is just being tickled, set desired RF power:
14+
# ../build_linux/src/freedv_tx 2020 ~/Downloads/speech_orig_16k.wav - | aplay -f S16_LE --device="plughw:CARD=CODEC,DEV=0"
15+
# 6. Sample command line:
1416
# ./ota_voice_test.sh ~/Downloads/speech_orig_16k.wav -m 700E -i ~/Downloads/vk5dgr_testing_8k.wav sdr.ironstonerange.com -p 8074
1517

16-
set -x
1718
MY_PATH=`dirname $0`
1819
BUILD_PATH=`echo $MY_PATH/../build_*/src`
1920
PATH=${PATH}:${BUILD_PATH}:${HOME}/kiwiclient
@@ -76,6 +77,7 @@ function run_rigctl {
7677
echo $command | rigctl -m $model -r $serialPort > /dev/null
7778
if [ $? -ne 0 ]; then
7879
echo "Can't talk to Tx"
80+
clean_up
7981
exit 1
8082
fi
8183
}
@@ -286,6 +288,13 @@ if [ `uname` == "Darwin" ]; then
286288
else
287289
aplay --device="${soundDevice}" -f S16_LE tx.raw 2>/dev/null
288290
fi
291+
if [ $? -ne 0 ]; then
292+
run_rigctl "\\set_ptt 0" $model
293+
clean_up
294+
echo "Problem running aplay!"
295+
echo "Is ${soundDevice} configured as the default sound device in Settings-Sound?"
296+
exit 1
297+
fi
289298
run_rigctl "\\set_ptt 0" $model
290299

291300
if [ $tx_only -eq 0 ]; then

0 commit comments

Comments
 (0)