Add sound on activation to precise-record

This commit is contained in:
Matthew D. Scholefield 2017-11-27 21:42:13 -06:00
parent 5d925dae59
commit b8f393fc53
3 changed files with 6 additions and 1 deletions

BIN
data/activate.wav Normal file

Binary file not shown.

View File

@ -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__':

0
test
View File