Sudomatze - 2018-12-04

Hi,
I tried to implement the LiveSpeech in my Pygame Python script, to control an interface.

The problem by using this example:

import os
from pocketsphinx import LiveSpeech, get_model_path

model_path = get_model_path()

speech = LiveSpeech(
    verbose=False,
    sampling_rate=16000,
    buffer_size=2048,
    no_search=False,
    full_utt=False,
    hmm=os.path.join(model_path, 'en-us'),
    lm=os.path.join(model_path, 'en-us.lm.bin'),
    dic=os.path.join(model_path, 'cmudict-en-us.dict')
)

for phrase in speech:
    print(phrase)

is the for loop I guess. I got stuck at the recognition, so I tried a lot of things. For example I tried to put the code above into a while loop while a button is pressed. Then I only got to the recognition while pressing the button but then I got stuck again and even by releasing the button it's still in the recognition loop.

is it possible to write the newest recognition into a variable, go on with the code and overwrite it, when passing by again?