From fee60e2c207c2c6d5af0b556dc0cbb83cd0ceb6e Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Thu, 31 May 2018 17:51:47 -0400 Subject: [PATCH] Formatting updates --- CircuitPython_Made_Easy_On_CPX/cpx_sound_meter.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CircuitPython_Made_Easy_On_CPX/cpx_sound_meter.py b/CircuitPython_Made_Easy_On_CPX/cpx_sound_meter.py index 51009e020..bd3d0bac9 100644 --- a/CircuitPython_Made_Easy_On_CPX/cpx_sound_meter.py +++ b/CircuitPython_Made_Easy_On_CPX/cpx_sound_meter.py @@ -19,13 +19,14 @@ def normalized_rms(values): return math.sqrt(sum(float(sample - minbuf) * (sample - minbuf) for sample in values) / len(values)) + # For CircuitPython 2.x: mic = audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA, frequency=16000, bit_depth=16) -# For Circuitpython 3.0 and up, "frequency" is now called "sample_rate". -# Comment the lines above and uncomment the lines below. -#mic = audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA, -# sample_rate=16000, bit_depth=16) +# For CircuitPython 3.0 and up, "frequency" is now called "sample_rate". +# Comment out the lines above and uncomment the lines below. +# mic = audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA, +# sample_rate=16000, bit_depth=16) samples = array.array('H', [0] * 160)