summaryrefslogtreecommitdiff
path: root/client/mic.py
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2014-10-01 02:39:35 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2014-10-01 02:39:35 +0200
commit05234077f36200ac87d9b0563cdd25746db3fd64 (patch)
treeb0289c16520325df900c752776711232fd6a9bd8 /client/mic.py
parent5902f695fc0d7d706867d182c7a70fa9f0beac41 (diff)
parenta7b72c46056ee49dac1b8c8b1f9d9ad6d4447d92 (diff)
downloadjasper-client-05234077f36200ac87d9b0563cdd25746db3fd64.tar.gz
jasper-client-05234077f36200ac87d9b0563cdd25746db3fd64.zip
Merge pull request #202 from Holzhaus/close-audio-stream
Close audio stream
Diffstat (limited to 'client/mic.py')
-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