summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/mic.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/client/mic.py b/client/mic.py
index 2e8d603..7956b1d 100644
--- a/client/mic.py
+++ b/client/mic.py
@@ -70,6 +70,10 @@ class Mic:
lastN.append(self.getScore(data))
average = sum(lastN) / len(lastN)
+ stream.stop_stream()
+ stream.close()
+ audio.terminate()
+
# this will be the benchmark to cause a disturbance over!
THRESHOLD = average * THRESHOLD_MULTIPLIER
@@ -139,6 +143,9 @@ class Mic:
# no use continuing if no flag raised
if not didDetect:
print "No disturbance detected"
+ stream.stop_stream()
+ stream.close()
+ audio.terminate()
return (None, None)
# cutoff any recording before this disturbance was detected