Advertisement
Guest User

Python Gstreamer PocketSphinx example

a guest
Feb 4th, 2011
805
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. import pygtk,gtk,gobject
  2. gobject.threads_init()
  3. import gst
  4.  
  5. def result(asr, text, uttid): print text
  6.  
  7.  
  8. pipeline=gst.parse_launch('pulsesrc ! audioconvert ! audioresample  ! vader name=vad auto-threshold=true ! pocketsphinx name=asr ! appsink sync=false name=appsink')
  9. #pipeline=gst.parse_launch('pulsesrc  ! tee  name=t ! queue ! audioconvert ! audioresample ! vader name=vad auto-threshold=true ! pocketsphinx name=asr ! appsink    sync=false name=appsink  t. queue ! audioconvert ! audioresample ! wavenc ! filesink location=o.wav')
  10. asr=pipeline.get_by_name('asr')
  11. asr.connect('result', result)
  12. #asr.set_property('lm', '1.lm')
  13. #asr.set_property('dict', '1.dic')
  14. asr.set_property('configured', True)
  15. pipeline.set_state(gst.STATE_PLAYING)
  16. gtk.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement