Add argument parser to precise-record

pull/1/head
Matthew D. Scholefield 2017-11-10 16:39:50 -06:00
parent 70d0b5209f
commit d970a41879
1 changed files with 6 additions and 2 deletions

View File

@ -6,13 +6,17 @@ sys.path += ['.'] # noqa
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
from pyaudio import PyAudio, paInt16 from pyaudio import PyAudio, paInt16
from precise.common import pr from precise.common import pr
from argparse import ArgumentParser
def main(): def main():
parser = ArgumentParser('Implementation demo of precise-stream')
parser.add_argument('-m', '--model', default='keyword.pb')
args = parser.parse_args()
pa = PyAudio() pa = PyAudio()
stream = pa.open(pr.sample_rate, 1, paInt16, True, frames_per_buffer=1024) stream = pa.open(pr.sample_rate, 1, paInt16, True, frames_per_buffer=1024)
proc = Popen(['python3', 'precise/stream.py', 'keyword.pb', '1024'], stdin=PIPE, stdout=PIPE) proc = Popen(['python3', 'precise/stream.py', args.model, '1024'], stdin=PIPE, stdout=PIPE)
print('Listening...') print('Listening...')
try: try: