-
Notifications
You must be signed in to change notification settings - Fork 4
/
bbfm_rx.sh
executable file
·41 lines (35 loc) · 996 Bytes
/
bbfm_rx.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
#
# The usual wrapper around rx_bbfm.py
OPUS=build/src
PATH=${PATH}:${OPUS}
features_out=features_rx_out.f32
if [ $# -lt 3 ]; then
echo "usage (write output to file):"
echo " ./bbfm_rx.sh model z_hat.f32 out.wav [optional bbfm_rx.py args]"
echo "usage (play output with aplay):"
echo " ./bbfm_rx.sh model z_hat.f32 - [optional bbfm_rx.py args]"
exit 1
fi
if [ ! -f $1 ]; then
echo "can't find $1"
exit 1
fi
if [ ! -f $2 ]; then
echo "can't find $2"
exit 1
fi
model=$1
input_z_hat=$2
output_speech=$3
# eat first 3 args before passing rest to rx_bbfm.py in $@
shift; shift; shift
python3 ./bbfm_rx.py ${model} ${input_z_hat} ${features_out} "$@"
if [ $? -ne 0 ]; then
exit 1
fi
if [ $output_speech == "-" ]; then
lpcnet_demo -fargan-synthesis ${features_out} - | aplay -r 16000 -f S16_LE
elif [ $output_speech != "/dev/null" ]; then
lpcnet_demo -fargan-synthesis ${features_out} - | sox -t .s16 -r 16000 -c 1 - ${output_speech}
fi