View Single Post
Posts: 7 | Thanked: 47 times | Joined on Aug 2010
#1
Hello there, just a quick post on how I got PocketSphinx to work on my n900, as well as a basic python application to test your setup. I take no credit for anything on this thread, except the time spent putting these all together.


I downloaded all the .debs from http://repository.maemo.org/extras-d.../pocketsphinx/ into a new directory, removing any i386 specific .debs.

As root, I ran "dpkg -i *" and they tried to install, but were stopped, due to unment dependencies. (for me it was just python2.5-dbg)

This sucessfully ran, and installed pocketsphinx.

To try it out and make sure everything has installed correctly, run "pocketsphinx_continuous", and wait for everything to load. When prompted with "Ready..." say something clearly in the phones direction, (I used "Hello"). After another load of text there should be "000000001: hello (-12345676)".


To get the gstreamer hooks working, I had to install the package "gstreamer-tools".

After this I raw the Script here from the CMUSphinx example, tweaked to work for pulseaudio, http://pastebin.com/zCYzX65Z

Press the "Speak" button, then say your few words, and the textbox with update to show what you have said.

N.B. It uses the en_US acoustic model by default, therefore I had a good few mistakes at first which I attrute to my Irish accent.



This is another little sample that uses the JSGF grammer specification, and tries to interpret speech from a .wav file saved locally. (This needs to be recorded at 8khz mono, also)

==File grammer.jsgf==
PHP Code:
#JSGF V1.0;
grammar goforward;
public <
move> = go <direction> <distance> [meter meters];
<
direction>= forward backward;
<
distance>= (one two three four five six seven eight nine ten twenty)+; 
==File speechtest.py== (with myrecording.wav as the recording to interpret)
PHP Code:
#!/usr/bin/python
import pocketsphinx as ps
decoder 
ps.Decoder(jsgf=/path/to/your/jsgf/grammar.jsgf’,samprate=’8000&#8242;)
fh open(“myrecording.wav”“rb”)
nsamp decoder.decode_raw(fh)
hyputtidscore decoder.get_hyp()
print 
“Got result %%d” % (hypscore

Last edited by chemist; 2011-04-27 at 15:17. Reason: topic
 

The Following 35 Users Say Thank You to mc_teo For This Useful Post: