Add sound on activation to precise-record
This commit is contained in:
parent
5d925dae59
commit
b8f393fc53
BIN
data/activate.wav
Normal file
BIN
data/activate.wav
Normal file
Binary file not shown.
@ -2,9 +2,11 @@
|
||||
# Copyright (c) 2017 Mycroft AI Inc.
|
||||
|
||||
import sys
|
||||
|
||||
sys.path += ['.', 'runner'] # noqa
|
||||
|
||||
from argparse import ArgumentParser
|
||||
from psutil import Popen
|
||||
from precise_runner import PreciseRunner
|
||||
from threading import Event
|
||||
|
||||
@ -17,7 +19,10 @@ def main():
|
||||
def on_prediction(prob):
|
||||
print('!' if prob > 0.5 else '.', end='', flush=True)
|
||||
|
||||
PreciseRunner('./precise/stream.py', args.model, on_prediction=on_prediction).start()
|
||||
def on_activation():
|
||||
Popen(['aplay', 'data/activate.wav'])
|
||||
|
||||
PreciseRunner('./precise/stream.py', args.model, on_prediction=on_prediction, on_activation=on_activation).start()
|
||||
Event().wait() # Wait forever
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user