From 0d4bb63b3727e44c973d167be0d82c4c062648f6 Mon Sep 17 00:00:00 2001 From: schneefux Date: Fri, 22 Aug 2014 09:32:35 +0800 Subject: Minor style fixes: removed unused imports, commented-out code, etc. --- client/mic.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'client/mic.py') diff --git a/client/mic.py b/client/mic.py index b4ef668..abd16a3 100644 --- a/client/mic.py +++ b/client/mic.py @@ -3,7 +3,6 @@ """ import os -import json from wave import open as open_audio import audioop import pyaudio @@ -35,19 +34,14 @@ class Mic: def fetchThreshold(self): - # TODO: Consolidate all of these variables from the next three - # functions + # TODO: Consolidate all of these variables from the next three functions THRESHOLD_MULTIPLIER = 1.8 - AUDIO_FILE = "passive.wav" RATE = 16000 CHUNK = 1024 # number of seconds to allow to establish threshold THRESHOLD_TIME = 1 - # number of seconds to listen before forcing restart - LISTEN_TIME = 10 - # prepare recording stream audio = pyaudio.PyAudio() stream = audio.open(format=pyaudio.paInt16, @@ -180,7 +174,7 @@ class Mic: """ AUDIO_FILE = "active.wav" - RATE = 16000 + RATE = 16000 CHUNK = 1024 LISTEN_TIME = 12 @@ -238,9 +232,6 @@ class Mic: write_frames.writeframes(''.join(frames)) write_frames.close() - # DO SOME AMPLIFICATION - # os.system("sox "+AUDIO_FILE+" temp.wav vol 20dB") - return self.active_stt_engine.transcribe(AUDIO_FILE, MUSIC) def say(self, phrase, OPTIONS=" -vdefault+m3 -p 40 -s 160 --stdout > say.wav"): -- cgit v1.3.1