[Tutor] receiving string from shell
richard kappler
richkappler at gmail.com
Fri Aug 10 04:24:05 CEST 2012
The summer of intensive learning continues. Working on subprocess today.
I figured out how to send data out, for example to my festival tts engine:
[code]response = k.respond(input, "richard")
festivalCmd = '(SayText "%s")' % response
subprocess.Popen(['/usr/bin/festival', '-b', festivalCmd])[/code]
and that works fine. Now I'm trying to go the other way, starting up my
speech recognition engine. The trivial bit is starting it up:
[code]subprocess.Popen(['pocketsphinx_continuous -logfn /dev/null'])[/code]
I'm at a loss, however, as to how to retrieve the text that pocketsphinx
generates from speech into my python program. In other words, the above
starts the speech rec engine, and when I say something the recognizer grabs
it and prints what I said out as text on the command line. But I'm
struggling how to get that text string into my Python program. Should I be
looking at pipes, communicate(), Popen.returncode(), something completely
different :wink: ?
It's probably obvious but I've been working on face recognition all day and
now have turned to this, so perhaps I'm a bit burned out. Any guidance
would be greatly appreciated so I can get a fresh start in the morning.
And now that I think about it, it's even more complex. The speech rec
program would be started when my python program starts and keep running. So
the python program would have to continuously monitor the terminal for text
output to import to python, but would have to ignore the "Ready" or
"Listening" prompt within pocketshpinx that shows while waiting for speech
input.
And I thought this would be easy. Back to the 2.7 docs.
Perhaps a few hours of sleep first, Richard
--
"Treat all disasters as if they were trivialities but never treat a
triviality as if it were a disaster."
-- *Quentin Crisp<http://www.quotationspage.com/quotes/Quentin_Crisp>
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120809/57a000b3/attachment.html>
More information about the Tutor
mailing list