-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdecode.c
More file actions
32 lines (29 loc) · 1.23 KB
/
decode.c
File metadata and controls
32 lines (29 loc) · 1.23 KB
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
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#define BILLION 1000000000.0;
int main(void) {
struct timespec start, end;
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("echo done recording...");
system("python testfiles/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 \
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...");
clock_gettime(CLOCK_REALTIME, &end);
double time_spent = (end.tv_sec - start.tv_sec) +
(end.tv_nsec - start.tv_nsec) / BILLION;
char *timerOutput = malloc(25);
sprintf(timerOutput, "echo Time Elapsed: %f\n", time_spent);
system(timerOutput);
}