Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@ default: decode
decode.o: decode.c
gcc -c decode.c -o decode.o

decode: decode.o
snowboy-decode.o: snowboy-decode.c
gcc -c snowboy-decode.c -o snowboy-decode.o

decode: decode.o snowboy-decode.o
gcc decode.o -o decode
gcc snowboy-decode.o -o snowboy-decode

clean:
-rm -f decode.o
-rm -f decode
-rm -f snowboy-decode
-rm -f snowby-decode.o

19 changes: 19 additions & 0 deletions accuracy-test.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
What I said, What Klauba heard
Take me to room 2337,Take me to room 2337
How do I get to room 2335,How do I get to room 2335
Go forward,Go forward
Go backward,Go backward
Move left,Move left
Move right,Move right
Where am I,Where am I?
Show me to room 2341,Show me to room 2341
Stop,Stop
Move forward,Move forward
Move backward,Move backward
Where is 2342,Where is 2342
Where is room 2346,Where is room 2346
How do I get to room 2360,How are you get to room 2360
Stop moving,Stop moving
Hi Klauba,I Klauba
Hello Klauba,Hello Klauba

19 changes: 11 additions & 8 deletions decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,23 @@

int main(void) {
struct timespec start, end;

if (getenv("SPEECH_RECOGNITION") == NULL) {
system("echo Please set the SPEECH_RECOGNITION environment variable to point to the git repository");
return 1;
}
system("export LD_LIBRARY_PATH=/usr/local/lib");
system("aplay /home/pi/speech2text/beep-07.wav");
system("arecord --format=S16_LE --duration=5 --rate=16k -D sysdefault:CARD=1 --file-type=wav testfiles/noisy.wav");
system("aplay /home/pi/speech2text/beep-08b.wav");
system("aplay $SPEECH_RECOGNITION/beep-07.wav");
system("arecord --format=S16_LE --duration=5 -r 16000 --file-type=wav inputs/noisy.wav");
system("aplay $SPEECH_RECOGNITION/beep-08b.wav");
system("echo done recording...");
system("python testfiles/noiseClean.py");
system("python noiseClean.py");
system("echo done cleaning...");
clock_gettime(CLOCK_REALTIME, &start);
system("\
pocketsphinx_continuous \
-infile testfiles/noisy.wav \
-dict dicts/3651.dic \
-lm dicts/3651.lm \
-infile inputs/filtered.wav \
-dict ./models/corpus/Corpus_V3/100.dic \
-lm ./models/corpus/Corpus_V3/100.lm \
2>./output/unwanted-stuff.log | tee ./output/words.txt");
// pocketsphinx_continuous -infile testfiles/speech.wav -dict dicts/8050.dic -lm dicts/8050.lm 2>./output/unwanted-stuff.log | tee ./output/words.txt
system("echo done decoding...");
Expand Down
Binary file added inputs/raw_recording.wav
Binary file not shown.
2 changes: 2 additions & 0 deletions install.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mkdir output
sudo apt-get install bison
sudo apt-get install swig
cd sphinxbase-5prealpha
Expand All @@ -12,3 +13,4 @@ cd ../pocketsphinx-5prealpha
.configure
make -j
sudo make install
sudo ldconfig
3 changes: 3 additions & 0 deletions jackd_fix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
jack_control start

55 changes: 55 additions & 0 deletions klauba.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import snowboydecoder
from record import start_recording
import os
import sys
import signal

interrupted = False
kill_script = False
def detected():
global detector
# detector.terminate() # THIS LINE CAN CREATE HANGS ON CERTAIN MACHINES (COMMENT OUT IF THE SCRIPT HANGS)
print("Starting recording")
data, open_wave = start_recording()
open_wave.close()
print("Recording complete")
global interrupted
interrupted = True # signal to the detector to stop after first detection

def signal_handler(signal, frame):
global interrupted
interrupted = True

global kill_script
kill_script = True


def interrupt_callback():
global interrupted
return interrupted


# capture SIGINT signal, e.g., Ctrl+C
signal.signal(signal.SIGINT, signal_handler)

detector = snowboydecoder.HotwordDetector("./models/Klauba.pmdl", sensitivity=0.5)
print('Listening for Klauba...')

# main loop
detector.start(detected_callback=detected,
interrupt_check=interrupt_callback,
sleep_time=0.03)

if os.path.exists("./inputs/raw_recording.wav"):
print ("I heard: ")
os.system("pocketsphinx_continuous -infile ./inputs/raw_recording.wav \
-dict dicts/8050.dic \
-lm dicts/8050.lm \
-logfn /dev/null")
else: print ('There is no input to detect')


if kill_script:
sys.exit(1) # the user hit cntrl-c
else:
sys.exit(0) # the user did not hit cntrl-c
Binary file added models/Klauba.pmdl
Binary file not shown.
67 changes: 67 additions & 0 deletions models/corpus/Corpus_V3/100.dic
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
2332 T UW TH R IY TH R IY T UW
2333 T UW TH R IY TH R IY TH R IY
2334 T UW TH R IY TH R IY F OW R
2335 T UW TH R IY TH R IY F AY V
2336 T UW TH R IY TH R IY S IH K S
2337 T UW TH R IY TH R IY S EH V AH N
2338 T UW TH R IY TH R IY EY T
2340 T UW TH R IY F OW R Z IY R OW
2341 T UW TH R IY F OW R W AH N
2342 T UW TH R IY F OW R T UW
2344 T UW TH R IY F OW R F OW R
2346 T UW TH R IY F OW R S IH K S
2347 T UW TH R IY F OW R S EH V AH N
2350 T UW TH R IY F AY V Z IY R OW
2355 T UW TH R IY F AY V F AY V
2356 T UW TH R IY F AY V S IH K S
2357 T UW TH R IY F AY V S EH V AH N
2358 T UW TH R IY F AY V EY T
2359 T UW TH R IY F AY V N AY N
2360 T UW TH R IY S IH K S Z IY R OW
2361 T UW TH R IY S IH K S W AH N
2362 T UW TH R IY S IH K S T UW
2363 T UW TH R IY S IH K S TH R IY
AM AE M
AM(2) EY EH M
ARE AA R
ARE(2) ER
ATRIUM? AE T R IY AH M
BACKWARD B AE K W ER D
BUILDING B IH L D IH NG
DO D UW
FORWARD F AO R W ER D
GET G EH T
GET(2) G IH T
GO G OW
HELLO HH AH L OW
HELLO(2) HH EH L OW
HI HH AY
HOW HH AW
I AY
I? AY
IN? IH N
IS IH Z
KLAUBA K L AO B AH
KLAUBA, K L AO B AH
KLAUBA? K L AO B AH
LEFT L EH F T
ME M IY
MOVE M UW V
MOVING M UW V IH NG
RIGHT R AY T
ROOM R UW M
SHOW SH OW
STOP S T AA P
TAKE T EY K
THE DH AH
THE(2) DH IY
TO T UW
TO(2) T IH
TO(3) T AH
TODAY, T AH D EY
TODAY? T AH D EY
WHAT W AH T
WHAT(2) HH W AH T
WHERE W EH R
WHERE(2) HH W EH R
YOU Y UW
Loading