Pass threshold as arg

This commit is contained in:
jan 2018-01-17 15:07:44 -08:00
parent db4d23a6d9
commit a93bfa3d4d

View File

@ -161,6 +161,7 @@ class AudioAnalyzer:
def monitor_pitch(pyaudio_device: int, def monitor_pitch(pyaudio_device: int,
min_freq: float = 10, min_freq: float = 10,
max_freq: float = 6000, max_freq: float = 6000,
threshold: float = 1e6,
): ):
analyzer = AudioAnalyzer(pyaudio_device=pyaudio_device, analyzer = AudioAnalyzer(pyaudio_device=pyaudio_device,
@ -173,7 +174,7 @@ def monitor_pitch(pyaudio_device: int,
while True: while True:
frame_data = analyzer.frame_queue.get() frame_data = analyzer.frame_queue.get()
if frame_data['magnitude'] <= 10**6: if frame_data['magnitude'] <= threshold:
continue continue
prev_magnitude = frame_data['magnitude'] prev_magnitude = frame_data['magnitude']