From 384b830f21ea2c9114e838aebd9222cfacfc6a31 Mon Sep 17 00:00:00 2001 From: schneefux Date: Fri, 26 Sep 2014 17:27:25 +0200 Subject: Close audio stream in fetchThreshold() --- client/mic.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'client') diff --git a/client/mic.py b/client/mic.py index 0351592..444beea 100644 --- a/client/mic.py +++ b/client/mic.py @@ -68,6 +68,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 -- cgit v1.3.1 From a7b72c46056ee49dac1b8c8b1f9d9ad6d4447d92 Mon Sep 17 00:00:00 2001 From: schneefux Date: Fri, 26 Sep 2014 17:31:53 +0200 Subject: Close audio stream on passiveListen() early return This fixes #33 --- client/mic.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'client') diff --git a/client/mic.py b/client/mic.py index 444beea..eff5e72 100644 --- a/client/mic.py +++ b/client/mic.py @@ -142,6 +142,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 -- cgit v1.3.1