Skip to content

Commit 87b6f6d

Browse files
committed
tweaks to get ota_voice_test.sh working again, added some set up notes
1 parent 8efd6f8 commit 87b6f6d

File tree

2 files changed

+40
-25
lines changed

2 files changed

+40
-25
lines changed

src/freedv_rx.c

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ int main(int argc, char *argv[]) {
6767
int use_squelch, vq_type;
6868
float squelch = 0;
6969
struct freedv *freedv;
70+
int use_passthroughgain;
71+
float passthroughgain = 0.0;
72+
7073
char f2020[80] = {0};
7174
#ifdef __LPCNET__
7275
sprintf(f2020,"|2020|2020A|2020B");
@@ -93,27 +96,28 @@ int main(int argc, char *argv[]) {
9396
}
9497

9598
use_testframes = verbose = discard = use_complex = use_dpsk = use_squelch = 0; use_reliabletext = 0;
96-
vq_type = -1;
99+
vq_type = -1; use_passthroughgain = 0;
97100

98101
int o = 0;
99102
int opt_idx = 0;
100103
while( o != -1 ){
101104
static struct option long_opts[] = {
102-
{"discard", no_argument, 0, 'i'},
103-
{"dpsk", no_argument, 0, 'd'},
104-
{"help", no_argument, 0, 'h'},
105-
{"reliabletext", no_argument, 0, 'r'},
106-
{"squelch", required_argument, 0, 's'},
107-
{"txtrx", required_argument, 0, 'x'},
108-
{"testframes", no_argument, 0, 't'},
109-
{"usecomplex", no_argument, 0, 'c'},
110-
{"verbose1", no_argument, 0, 'v'},
111-
{"vv", no_argument, 0, 'w'},
112-
{"indopt", required_argument, 0, 'n'},
105+
{"discard", no_argument, 0, 'i'},
106+
{"dpsk", no_argument, 0, 'd'},
107+
{"help", no_argument, 0, 'h'},
108+
{"reliabletext", no_argument, 0, 'r'},
109+
{"squelch", required_argument, 0, 's'},
110+
{"txtrx", required_argument, 0, 'x'},
111+
{"testframes", no_argument, 0, 't'},
112+
{"usecomplex", no_argument, 0, 'c'},
113+
{"verbose1", no_argument, 0, 'v'},
114+
{"vv", no_argument, 0, 'w'},
115+
{"indopt", required_argument, 0, 'n'},
116+
{"passthroughgain", required_argument, 0, 'p'},
113117
{0, 0, 0, 0}
114118
};
115119

116-
o = getopt_long(argc,argv,"idhr:s:x:tcvwn:",long_opts,&opt_idx);
120+
o = getopt_long(argc,argv,"idhr:s:x:tcvwn:p:",long_opts,&opt_idx);
117121

118122
switch(o) {
119123
case 'i':
@@ -131,7 +135,11 @@ int main(int argc, char *argv[]) {
131135
else
132136
vq_type = 2;
133137
break;
134-
case 'r':
138+
case 'p':
139+
use_passthroughgain = 1;
140+
passthroughgain = atof(optarg);
141+
break;
142+
case 'r':
135143
use_reliabletext = 1;
136144
break;
137145
case 's':
@@ -216,7 +224,8 @@ int main(int argc, char *argv[]) {
216224
freedv_set_squelch_en(freedv, 1);
217225
}
218226
freedv_set_dpsk(freedv, use_dpsk);
219-
227+
if (use_passthroughgain) freedv_passthrough_gain(freedv, passthroughgain);
228+
220229
/* install optional handler for recevied txt characters */
221230
if (ftxt_rx != NULL)
222231
{

unittest/ota_voice_test.sh

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
# 1. Build codec2
77
# 2. Install kiwclient:
88
# cd ~ && git clone git@github.com:jks-prv/kiwiclient.git
9-
# 3. Install Hamlib cli tools
9+
# 3. Install Hamlib cli tools, and add user to dialout group:
10+
# sudo adduser david dialout
11+
# 4. To test rigctl:
12+
# echo "m" | rigctl -m 361 -r /dev/ttyUSB0
13+
# 5. Sample command line:
14+
# ./ota_voice_test.sh ~/Downloads/speech_orig_16k.wav -m 700E -i ~/Downloads/vk5dgr_testing_8k.wav sdr.ironstonerange.com -p 8074
1015

1116
set -x
1217
MY_PATH=`dirname $0`
@@ -15,7 +20,7 @@ PATH=${PATH}:${BUILD_PATH}:${HOME}/kiwiclient
1520
CODEC2=${MY_PATH}/..
1621

1722
kiwi_url=""
18-
port=8073
23+
port=8074
1924
freq_kHz="7177"
2025
tx_only=0
2126
Nbursts=5
@@ -42,8 +47,9 @@ function print_help {
4247
echo " -i StationIDWaveFile Prepend this file to identify transmission (should be 8KHz mono)"
4348
echo " -m mode 700c|700d|700e"
4449
echo " -o model select radio model number ('rigctl -l' to list)"
50+
echo " -p port kiwi_url port to use (default 8073)."
4551
echo " -r Rx wave file mode: Rx process supplied rx wave file"
46-
echo " -s port The serial port (or hostname:port) to control SSB radio,"
52+
echo " -s SerialPort The serial port (or hostname:port) to control SSB radio,"
4753
echo " default /dev/ttyUSB0"
4854
echo " -t Tx only, useful for manually observing SDRs"
4955
echo " -x Generate tx.wav file and exit"
@@ -90,7 +96,7 @@ function process_rx {
9096
plot_specgram(s, 8000, 200, 3000); print('spec.jpg', '-djpg'); \
9197
quit" | octave-cli -p ${CODEC2}/octave -qf > /dev/null
9298
# attempt to decode
93-
freedv_rx ${mode} ${rx} - -v --highpassthroughgain 2>rx_stats.txt | sox -t .s16 -r $speechFs -c 1 - rx_freedv.wav
99+
freedv_rx ${mode} ${rx} - -v --passthroughgain 1.0 2>rx_stats.txt | sox -t .s16 -r $speechFs -c 1 - rx_freedv.wav
94100
cat rx_stats.txt | tr -s ' ' | cut -f5 -d' ' | awk '$0==($0+0)' > sync.txt
95101
cat rx_stats.txt | tr -s ' ' | cut -f10 -d' ' | awk '$0==($0+0)' > snr.txt
96102
# time domain plot of output speech, SNR, and sync
@@ -177,6 +183,12 @@ esac
177183
done
178184
set -- "${POSITIONAL[@]}" # restore positional parameters
179185

186+
# determine sample rate of freedv_tx/freedv_rx
187+
speechFs=8000
188+
if [ "$mode" == "2020" ] || [ "$mode" == "2020A" ] || [ "$mode" == "2020B" ]; then
189+
speechFs=16000
190+
fi
191+
180192
if [ $rxwavefile -eq 1 ]; then
181193
process_rx $1
182194
exit 0
@@ -216,12 +228,6 @@ else
216228
fi
217229
analog_compressor $comp_in $speech_comp $gain
218230

219-
# determine sample rate of input file we require for freedv_tx
220-
speechFs=8000
221-
if [ "$mode" == "2020" ] || [ "$mode" == "2020A" ] || [ "$mode$" == "2020B" ]; then
222-
speechFs=16000
223-
fi
224-
225231
# create modulated FreeDV, with compressor enabled
226232
sox $speechfile -t .s16 -r $speechFs - | freedv_tx $mode - $speech_freedv --clip 1
227233
cat $speech_comp $speech_freedv > tx.raw

0 commit comments

Comments
 (0)