INNER CODE UNIT · Python
start
thevickypedia/Jarvis · jarvis/main.py:136
def start(self) -> None:
"""Runs ``audio_stream`` in a forever loop and calls ``initiator`` when the phrase ``Jarvis`` is heard."""
try:
support.write_screen(text=self.label)
while True:
result = self.detector.process(
pcm=struct.unpack_from(
"h" * self.detector.frame_length,
self.audio_stream.read(
num_frames=self.detector.frame_length,
exception_on_overflow=False,
),
)
)
if result >= 0:
self.executor()
try:
restart_checker()