@@ -82,7 +82,7 @@ def __init__(self):
8282 #self._google_speech_client = speech.SpeechClient()
8383
8484 def exit (self ):
85- pass
85+ pass
8686 # cleanup stuff.
8787 #self.stream_in.close()
8888 #self.pyaudio.terminate()
@@ -201,33 +201,6 @@ def speech_recog(self, model):
201201 logging .info ("recog text: " + recog_text )
202202 return recog_text
203203
204- # def speech_recog_google(self, locale):
205- # config = types.RecognitionConfig(
206- # encoding=enums.RecognitionConfig.AudioEncoding.LINEAR16,
207- # sample_rate_hertz=RATE,
208- # language_code=locale)
209- # streaming_config = types.StreamingRecognitionConfig(
210- # config=config,
211- # interim_results=False,
212- # single_utterance=True)
213- #
214- # t1 = time.time()
215- # with self.stream_in as stream:
216- # audio_generator = stream.generator()
217- # requests = (types.StreamingRecognizeRequest(audio_content=content)
218- # for content in audio_generator)
219- #
220- # responses = self._google_speech_client.streaming_recognize(streaming_config, requests)
221-
222- # Now, put the transcription responses to use.
223- # for response in responses:
224- # if time.time() - t1 > 10:
225- # return ""
226- # if response.results:
227- # result = response.results[0]
228- # if result.is_final:
229- # return result.alternatives[0].transcript
230-
231204 class MicrophoneStream (object ):
232205 """Opens a recording stream as a generator yielding the audio chunks."""
233206 def __init__ (self , fmt , rate , chunk ):
0 commit comments