-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathrun.sh
executable file
·58 lines (53 loc) · 1.53 KB
/
run.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
action=$1
shift
args=$@
function check_microphone {
if [[ -f .selected-mic ]]; then
which=$(cat .selected-mic)
else
echo "No microphone selected..."
echo "Finding microphones . . ."
python stream/list-mics.py 2>/dev/null
echo "Use which device?"
read which
echo $which >> .selected-mic
fi
echo "Selected microphone $which."
}
function run_recognition {
if [[ $1 == 1 ]]; then
python stream/mic.py -s silvius-server.voxhub.io -d $which $args | python grammar/main.py
else
python stream/mic.py -s silvius-server.voxhub.io -d $which $args
fi
}
case "$action" in
''|-h|--help)
echo "usage: $0 (-h|--help | -e|--execute | -t|--test | -d|--delete) [extra-args]"
echo -e "\t-h|--help: prints this help message"
echo -e "\t-e|--execute: executes results of speech recognition"
echo -e "\t-t|--test: prints results of speech recognition"
echo -e "\t-d|--delete: deletes saved microphone selection"
echo -e "\t-G|--show-gate: displays audio level of background noise"
;;
-t|--test)
check_microphone
run_recognition 0
;;
-e|--execute)
check_microphone
run_recognition 1
;;
-d|--delete)
rm -f .selected-mic
;;
-G|--show-gate)
check_microphone
python stream/audio-gate-level.py -d $which
;;
*)
echo "Unknown command '$action'. Run with --help to see usage."
exit 1
;;
esac