diff --git a/adafruit_circuitplayground/bluefruit.py b/adafruit_circuitplayground/bluefruit.py index 5758267..7f36195 100755 --- a/adafruit_circuitplayground/bluefruit.py +++ b/adafruit_circuitplayground/bluefruit.py @@ -61,7 +61,7 @@ def __init__(self) -> None: sample_rate=16000, bit_depth=16, ) - self._samples = None + self._mic_samples = None @staticmethod def _normalized_rms(values) -> float: @@ -91,10 +91,10 @@ def sound_level(self) -> float: while True: print(cpb.sound_level) """ - if self._sample is None: - self._samples = array.array("H", [0] * 160) - self._mic.record(self._samples, len(self._samples)) - return self._normalized_rms(self._samples) + if self._mic_samples is None: + self._mic_samples = array.array("H", [0] * 160) + self._mic.record(self._mic_samples, len(self._mic_samples)) + return self._normalized_rms(self._mic_samples) def loud_sound(self, sound_threshold: int = 200) -> bool: """Utilise a loud sound as an input.