<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Still stumped on trying to write a streamlined pocketsphinx speech recognition. I went through SpeechTools.jm and I think I pulled out the necessary pieces, but the speech event is not being fired. I get dtmf events if I push a key, but not speech. I must be missing a piece, but I have stared at SpeechTools.jm until I can't see straight. Here is my code:<div><br></div><div><div>&nbsp;&nbsp; function onInput(s, type, inputEvent, _this) {</div><div>&nbsp;&nbsp; <span class="Apple-tab-span" style="white-space:pre">                </span>console_log("debug", "EVENT:" + type + "\n");<span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><br></div><div>&nbsp;&nbsp; &nbsp;session.answer();</div><div>&nbsp;&nbsp; &nbsp;</div><div>&nbsp;&nbsp; &nbsp;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>var blankobj = new Object();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>var rv;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>var hit;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>var dup;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>var grammar_name="pizza_yesno";</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>var collected_index=0;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>var req=1;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>var obj_path="result";</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>var halt=true;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>var min_score=20;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>var confirm_score=10;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>console_log('INFO', "Setting grammar\n");</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>session.execute("detect_speech", "nogrammar " + grammar_name);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>session.execute("detect_speech", "pocketsphinx " + grammar_name);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>session.execute("detect_speech", "resume");</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>console_log('INFO', "entering while loop\n");</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>session.streamFile( "audiofile.wav", onInput, "blankobj") ;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>while(session.ready() &amp;&amp; collected_index &lt; req) {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>var x;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if (!rv) {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>rv = session.collectInput(onInput, "blankobj", 500);</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>if (rv &amp;&amp; !rv[0]) {</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>rv = false;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>}<span class="Apple-tab-span" style="white-space:pre">                                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if (!rv) {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>session.execute("detect_speech", "resume");</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>rv = session.collectInput(onInput, "blankobj", 5000);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>hit = false;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if (rv) {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>var items = rv;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>rv = undefined;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>for (y = 0; y &lt; items.length; y++) {</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>console_log("debug", "---- "+items[y]+"\n");</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if (!rv) {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>rv = session.collectInput(onInput, "blankobj", 1000);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><br></div><div>////////////////////////////////////////////</div><div>////////////////////////////////////////////</div><div><br></div><div>And here is some of the output from the console:</div><div><br></div><div><div><div>2009-07-29 16:10:09 [INFO] stest-examp.js:1 console_log() Setting grammar</div><div>EXECUTE <a href="mailto:sofia/internal/+*@199.173.94.88">sofia/internal/+*@199.173.94.88</a>:5060 detect_speech(nogrammar pizza_yesno)</div><div>EXECUTE <a href="mailto:sofia/internal/+*@199.173.94.88">sofia/internal/+*@199.173.94.88</a>:5060 detect_speech(pocketsphinx pizza_yesno)</div><div>EXECUTE <a href="mailto:sofia/internal/+*@199.173.94.88">sofia/internal/+*@199.173.94.88</a>:5060 detect_speech(resume)</div><div>2009-07-29 16:10:09 [INFO] stest-examp.js:1 console_log() entering while loop</div><div>2009-07-29 16:10:09 [DEBUG] switch_ivr_play_say.c:1084 switch_ivr_play_file() Codec Activated L16@8000hz 1 channels 20ms</div><div>2009-07-29 16:10:09 [DEBUG] switch_core_io.c:649 switch_core_session_write_frame() <a href="mailto:sofia/internal/+*@199.173.94.88">sofia/internal/+*@199.173.94.88</a>:5060 receive message [TRANSCODING_NECESSARY]</div><div>2009-07-29 16:10:09 [DEBUG] sofia.c:2979 sofia_handle_sip_i_state() Channel <a href="mailto:sofia/internal/+*@199.173.94.88">sofia/internal/+*@199.173.94.88</a>:5060 entering state [ready][200]</div><div>2009-07-29 16:10:12 [DEBUG] switch_ivr_play_say.c:1379 switch_ivr_play_file() done playing file</div><div>EXECUTE <a href="mailto:sofia/internal/+*@199.173.94.88">sofia/internal/+*@199.173.94.88</a>:5060 detect_speech(resume)</div><div>2009-07-29 16:10:16 [DEBUG] switch_rtp.c:1876 switch_rtp_dequeue_dtmf() RTP RECV DTMF 5:2440</div><div>2009-07-29 16:10:16 [DEBUG] stest-examp.js:45 console_log() EVENT:dtmf</div><div>EXECUTE <a href="mailto:sofia/internal/+*@199.173.94.88">sofia/internal/+*@199.173.94.88</a>:5060 detect_speech(resume)</div><div>EXECUTE <a href="mailto:sofia/internal/+*@199.173.94.88">sofia/internal/+*@199.173.94.88</a>:5060 detect_speech(resume)</div><div>2009-07-29 16:10:27 [DEBUG] switch_rtp.c:1876 switch_rtp_dequeue_dtmf() RTP RECV DTMF 5:2320</div><div>2009-07-29 16:10:27 [DEBUG] stest-examp.js:45 console_log() EVENT:dtmf</div><div><br></div></div></div><div><div apple-content-edited="true"> <span class="Apple-style-span" style="font-size: 12px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Greg</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-style-span" style="font-size: medium;"><br></span></p></div></div></span></div></div></div></body></html>