Skip to content

Commit 533b2b9

Browse files
authored
Update nano-ble-sense.md
changed from ulab.scipy to ulab.utils to fix spectrogram
1 parent 0140c9f commit 533b2b9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

content/micropython/04.board-examples/nano-ble-sense/nano-ble-sense.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,14 @@ Below example can be used with OpenMV's frame buffer window (top right corner).
221221
```python
222222
import image, audio, time
223223
from ulab import numpy as np
224-
from ulab import scipy as sp
224+
from ulab import utils
225225

226226
CHANNELS = 1
227227
SIZE = 256//(2*CHANNELS)
228228

229229
raw_buf = None
230230
fb = image.Image(SIZE+50, SIZE, image.RGB565, copy_to_fb=True)
231-
audio.init(channels=CHANNELS, frequency=16000, gain_db=80, highpass=0.9883)
231+
audio.init(channels=CHANNELS, frequency=16000, gain_db=80)
232232

233233
def audio_callback(buf):
234234
# NOTE: do Not call any function that allocates memory.
@@ -259,10 +259,10 @@ while (True):
259259
raw_buf = None
260260

261261
if CHANNELS == 1:
262-
fft_buf = sp.signal.spectrogram(pcm_buf)
262+
fft_buf = utils.spectrogram(pcm_buf)
263263
l_lvl = int((np.mean(abs(pcm_buf[1::2])) / 32768)*100)
264264
else:
265-
fft_buf = sp.signal.spectrogram(pcm_buf[0::2])
265+
fft_buf = utils.spectrogram(pcm_buf[0::2])
266266
l_lvl = int((np.mean(abs(pcm_buf[1::2])) / 32768)*100)
267267
r_lvl = int((np.mean(abs(pcm_buf[0::2])) / 32768)*100)
268268

@@ -330,4 +330,4 @@ from machine import Pin, SPI
330330
spi = SPI(1, baudrate=1000000, polarity=0, phase=0, sck=Pin(18), mosi=Pin(23), miso=Pin(19))
331331

332332
print("SPI initialized")
333-
```
333+
```

0 commit comments

Comments
 (0)