File tree 1 file changed +4
-5
lines changed
1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 20
20
import audiobusio
21
21
import board
22
22
import neopixel
23
- import ulab .numerical as numerical
24
- import ulab .extras as extras
25
- import ulab as np
23
+ from ulab .scipy .signal import spectrogram
24
+ from ulab import numpy as np
26
25
import adafruit_lsm6ds
27
26
from adafruit_led_animation .helper import PixelMap
28
27
from adafruit_led_animation .sequence import AnimationSequence
@@ -236,11 +235,11 @@ def rockstar_tilt(duration):
236
235
elif MODE >= 1 : # If not OFF MODE...
237
236
mic .record (samples_bit , len (samples_bit ))
238
237
samples = np .array (samples_bit [3 :])
239
- spectrum = extras . spectrogram (samples )
238
+ spectrum = spectrogram (samples )
240
239
spectrum = spectrum [:128 ]
241
240
spectrum [0 ] = 0
242
241
spectrum [1 ] = 0
243
- peak_idx = numerical .argmax (spectrum )
242
+ peak_idx = np .argmax (spectrum )
244
243
peak_freq = peak_idx * 16000 / 256
245
244
# print((peak_idx, peak_freq, spectrum[peak_idx]))
246
245
magnitude = spectrum [peak_idx ]
You can’t perform that action at this time.
0 commit comments