diff --git a/DEPENDENCIES.lock b/DEPENDENCIES.lock index 26ba7510..a36678a9 100644 --- a/DEPENDENCIES.lock +++ b/DEPENDENCIES.lock @@ -19,9 +19,9 @@ micropython https://github.com/micropython/micropython b70ae1aca6 # is missing; in a workspace modules/ is a link to the sibling checkout # and wins. castif is not here: it lives in modules/castif, tracked in this # repository. -audiodsp https://github.com/PyDevices/audiodsp.git 8d5c4a0ca69f12425c39c811ae190682655e5805 +audiodsp https://github.com/PyDevices/audiodsp.git c0ae8fba81946593698a51aae707cb54989f587e pygraphics https://github.com/PyDevices/pygraphics.git f97fd2e20e73f23c2138ab52a630cf04b0a7aea1 -ulab https://github.com/v923z/micropython-ulab.git 1d3ddd8f5228e2c7335dac71f4846e6abb0ec9f9 +ulab https://github.com/v923z/micropython-ulab.git 15e999747079205b2415e71a6aa2840b8f85f9dc # omnipython-lvgl is not a module directory: it is LVGL, its generated # bindings and a port per interpreter. --modules names it lvgl ("all" takes it @@ -29,7 +29,7 @@ ulab https://github.com/v923z/micropython-ulab.git 1d3ddd8f52 # sibling checkout is linked there instead) and compiles the port for its # interpreter. Move the commit here to move every LVGL build, MicroPython's and # CircuitPython's. -omnipython-lvgl https://github.com/PyDevices/omnipython-lvgl.git c34fbeeb0440e71acb62c92ddee1c3c65d089622 +omnipython-lvgl https://github.com/PyDevices/omnipython-lvgl.git a13f5c75e25b8ba5133d7bf6b7a5b09971e3f5dc # omnipython-lib is not a module either: it is the repository of our # Python-only packages (pydevices, palettes, pdwidgets, audioinstruments, @@ -39,7 +39,7 @@ omnipython-lvgl https://github.com/PyDevices/omnipython-lvgl.git c34fbeeb04 # repository until the rename. The packages the library builds from other # repositories (audiocomponents' two) are pinned by tag in its lib-lock.json, # not here. -omnipython-lib https://github.com/PyDevices/pydevices.git e691f190adf0fe880c67f0a93840895111e1701c +omnipython-lib https://github.com/PyDevices/pydevices.git 7f5069149778cc5214d7abd3f46a0b9f2eab0042 # esp-vision (espressif/esp-vision, Apache-2.0): the source of the tflite # module and, later, its image stack. modules/.esp-vision/fetch.sh puts it at diff --git a/modules/tflite/examples/tflite_sounds.py b/modules/tflite/examples/tflite_sounds.py index 0d30b834..5b169996 100644 --- a/modules/tflite/examples/tflite_sounds.py +++ b/modules/tflite/examples/tflite_sounds.py @@ -97,7 +97,13 @@ def log_mel(audio): rows = np.zeros((count, BANDS)) for i in range(count): frame[:WINDOW] = audio[i * HOP : i * HOP + WINDOW] * hann - real, imag = np.fft.fft(frame) + # ulab with complex numbers returns one complex array, as numpy + # does; without them it returns the real and imaginary parts. + spectrum = np.fft.fft(frame) + if isinstance(spectrum, tuple): + real, imag = spectrum + else: + real, imag = np.real(spectrum), np.imag(spectrum) magnitude = np.sqrt(real[: FFT // 2 + 1] ** 2 + imag[: FFT // 2 + 1] ** 2) rows[i, :] = np.log(np.dot(magnitude, weights) + 0.001) return rows diff --git a/variants/stm32/ARDUINO_GIGA/DISPLAY_SHIELD/ulab_config.h b/variants/stm32/ARDUINO_GIGA/DISPLAY_SHIELD/ulab_config.h index 3b828e51..abaca2b4 100644 --- a/variants/stm32/ARDUINO_GIGA/DISPLAY_SHIELD/ulab_config.h +++ b/variants/stm32/ARDUINO_GIGA/DISPLAY_SHIELD/ulab_config.h @@ -100,6 +100,7 @@ #define ULAB_FFT_HAS_FFT (0) #define ULAB_FFT_HAS_IFFT (0) #define ULAB_NUMPY_HAS_ARGSORT (0) +#define ULAB_NUMPY_HAS_BINCOUNT (0) #define ULAB_NUMPY_HAS_COMPRESS (0) #define ULAB_NUMPY_HAS_CONVOLVE (0) #define ULAB_NUMPY_HAS_CROSS (0) @@ -111,6 +112,7 @@ #define ULAB_NUMPY_HAS_LOAD (0) #define ULAB_NUMPY_HAS_LOADTXT (0) #define ULAB_NUMPY_HAS_MEDIAN (0) +#define ULAB_NUMPY_HAS_MESHGRID (0) #define ULAB_NUMPY_HAS_POLYFIT (0) #define ULAB_NUMPY_HAS_POLYVAL (0) #define ULAB_NUMPY_HAS_ROLL (0) @@ -118,6 +120,7 @@ #define ULAB_NUMPY_HAS_SAVETXT (0) #define ULAB_NUMPY_HAS_SIZE (0) #define ULAB_NUMPY_HAS_SORT (0) +#define ULAB_NUMPY_HAS_TAKE (0) #define ULAB_NUMPY_HAS_TRACE (0) #define ULAB_NUMPY_HAS_TRAPZ (0) #define ULAB_NUMPY_HAS_ACOSH (0) @@ -132,6 +135,7 @@ #define ULAB_NUMPY_HAS_REAL (0) #define ULAB_NUMPY_HAS_SORT_COMPLEX (0) #define ULAB_NUMPY_RANDOM_HAS_NORMAL (0) +#define ULAB_SCIPY_HAS_INTEGRATE_MODULE (0) #define ULAB_SCIPY_HAS_LINALG_MODULE (0) #define ULAB_SCIPY_LINALG_HAS_CHO_SOLVE (0) #define ULAB_SCIPY_LINALG_HAS_SOLVE_TRIANGULAR (0)