15 from threading
import Thread
18 from pvrecorder
import PvRecorder
19 from gpiozero
import LED
21 from .apa102
import APA102
30 white=(255, 255, 255),
31 yellow=(255, 255, 51),
43 'bumblebee':
'orange',
53 def __init__(self, access_key, device_index, sensitivity):
54 super(PorcupineDemo, self).
__init__()
58 self.
_porcupine = pvporcupine.create(access_key=access_key, keywords=self.
_keywords, sensitivities=[sensitivity] * len(KEYWORDS_COLOR))
63 driver.set_pixel(i, color[0], color[1], color[2])
73 print(
'[Listening ...]')
78 if keyword_index >= 0:
79 print(
"detected '%s'" % self.
_keywords[keyword_index])
81 except KeyboardInterrupt:
82 sys.stdout.write(
'\b' * 2)
85 if recorder
is not None:
92 parser = argparse.ArgumentParser()
94 parser.add_argument(
'--access_key',
95 help=
'AccessKey obtained from Picovoice Console (https://picovoice.ai/console/)',
98 parser.add_argument(
'--audio_device_index', help=
'Index of input audio device.', type=int, default=-1)
100 args = parser.parse_args()
103 device_index=args.audio_device_index,
108 if __name__ ==
'__main__':