Skip to content
Snippets Groups Projects
Commit c238a645 authored by Timo Birr's avatar Timo Birr :rage:
Browse files

Merge branch 'main' into rtlntv

parents 850dfe2e 3f1f47ab
No related branches found
No related tags found
3 merge requests!16Combined changes from verbalization and rtlntv branch,!15Familiar Object Verbalization,!14Verbalization
......@@ -35,11 +35,13 @@ class AudioMemoryASR(BaseASR, ABC):
while not hasattr(self, '_audio_reader'):
sleep(1) # Wait for Audio Memory to connect. Unfortunately, recorder_thread might get started before.
print('Subscribing to updates from', self._audio_input_entity)
sleep(1)
while True:
try:
self._audio_reader.poll_updates(entity_id=self._audio_input_entity,
callback=self._receive_audio_from_memory)
except LocalException as e:
print("Audio Fallback...")
self._audio_reader = AudioReader.from_mns(self._mns)
......
......@@ -19,12 +19,10 @@ class BaseASR(abc.ABC):
):
super().__init__()
self.log = logging.getLogger(name=output_provider_name)
self.log.info(f"Getting MNS.")
self._mns = MemoryNameSystem.wait_for_mns()
self._writer = SpeechToTextWriter.from_mns(self._mns, wait=True)
self._output_entity_id = self._writer.make_entity_name(output_provider_name)
self._recorder_thread = threading.Thread(target=self.recording_loop, daemon=True)
self._channel = channel
......@@ -46,6 +44,8 @@ class BaseASR(abc.ABC):
self._writer.commit(self._output_entity_id, text=hypo, confidence=confidence, speaker=speaker)
self.log.info(f"Committing hypothesis '{hypo}'.")
except LocalException as e:
print("Fallback")
self._mns = MemoryNameSystem.wait_for_mns()
self._writer = SpeechToTextWriter.from_mns(self._mns, wait=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment