Skip to content

Commit

Permalink
wip fix ctests
Browse files Browse the repository at this point in the history
  • Loading branch information
drowe67 committed Nov 7, 2024
1 parent 2051de6 commit 2752eaf
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
47 changes: 47 additions & 0 deletions bbfm_inference.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash -x
#
# Some automation around inference_bbfm.py to help with testing

OPUS=build/src
PATH=${PATH}:${OPUS}

if [ $# -lt 3 ]; then
echo "usage (write output to file):"
echo " ./bbfm_inference.sh model in.s16 out.wav [optional bbfm_inference.py args]"
echo "usage (play output with aplay):"
echo " ./bbfm_inference.sh model in.s16 - [optional bbfm_inference.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_speech=$2
output_speech=$3
features_in=features_in.f32
features_out=features_out.f32

# eat first 3 args before passing rest to inference.py in $@
shift; shift; shift

lpcnet_demo -features ${input_speech} ${features_in}
python3 ./bbfm_inference.py ${model} ${features_in} ${features_out} "$@"
if [ $? -ne 0 ]; then
exit 1
fi
if [ $output_speech == "-" ]; then
tmp=$(mktemp)
lpcnet_demo -fargan-synthesis ${features_out} ${tmp}
aplay $tmp -r 16000 -f S16_LE 2>/dev/null
elif [ $output_speech != "/dev/null" ]; then
tmp=$(mktemp)
lpcnet_demo -fargan-synthesis ${features_out} ${tmp}
sox -t .s16 -r 16000 -c 1 ${tmp} ${output_speech}
fi
3 changes: 2 additions & 1 deletion multipath_samples.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function multipath_samples(ch, Fs, Rs, Nc, Nseconds, H_fn, G_fn="")
if Nc > 1
mesh(H(1:10*Rs,:))
else
# single carrier case
Nsecplot=1
subplot(211); plot(H(1:Nsecplot*Rs,:)); xlabel('Symbols'); ylabel('|H|')
subplot(212); plot(20*log10(H(1:Nsecplot*Rs,:))); xlabel('Symbols'); ylabel('|H| (dB)')
Expand All @@ -58,8 +59,8 @@ function multipath_samples(ch, Fs, Rs, Nc, Nseconds, H_fn, G_fn="")
end
end
LCR_meas = LC/Nseconds
subplot(211); hold on; stem(LC_log,sqrt(P)*ones(length(LC_log))); hold off; axis([0 Nsecplot*Rs 0 3]);
end
subplot(211); hold on; stem(LC_log,sqrt(P)*ones(length(LC_log))); hold off; axis([0 Nsecplot*Rs 0 3]);
printf("H file size is Nseconds*Rs*Nc*(4 bytes/sample) = %d*%d*%d*4 = %d bytes\n", Nseconds,Rs,Nc,Nseconds*Rs*Nc*4)
f=fopen(H_fn,"wb");
[r c] = size(H);
Expand Down

0 comments on commit 2752eaf

Please sign in to comment.