Skip to content

imliubo/LVGL_Audio_FFT_Spectrum

Repository files navigation

LVGL_Audio_FFT_Spectrum

I use M5StickC-Plus in this demo, it has a built-in MEMS microphone and an LCD display with a resolution of 240x135.

Use LovyanGFX as(or like) backend driver for lvgl, it is very simple to use, you only need to port one method.

video

static void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area,
                          lv_color_t *color_p) {
    int w = (area->x2 - area->x1 + 1);
    int h = (area->y2 - area->y1 + 1);

    /* Start new TFT transaction */
    lcd.startWrite();
    /* set the working window */
    lcd.setAddrWindow(area->x1, area->y1, w, h);

    /* Write the buffer to the display */
    lcd.writePixels((lgfx::rgb565_t *)&color_p->full, w * h);

    /* terminate TFT transaction */
    lcd.endWrite();
    /* tell lvgl that flushing is done */
    lv_disp_flush_ready(disp);
}

reference

  1. m5stack-core2-audio-monitor

    Thanks atomic14's awesome demo, The code for audio and FFT processing is referenced from this project.

  2. lv_demo_music

    Spectrum graphics drawing method reference this demo.

  3. mapping sound to color

    The color map refer to this article and this image. Reaper_SpectralViews_02.png