Synthesizer MIDI Player + Bluetooth Audio

This content is AI-translated and may differ from the original.


ESP32-S31 Korvo-1 Smart Multi-Function Synthesizer and Bluetooth Audio Player

English | 中文

Based on Espressif's new generation dual-core 320MHz RISC-V flagship SoC ESP32-S31 (ESP32-S31 Korvo-1 development board), this is a high-fidelity, multi-function embedded audio workstation system.

The project is written in pure C, with deep modular decoupling between low-level drivers and application layer, integrating AMY 16 polyphonic dual-timbre library synthesizer, standard MIDI file (.mid) parsing and playback engine, classic Bluetooth A2DP Hi-Fi wireless speaker, ESP32-S31 on-chip hardware ASRC asynchronous sample rate conversion, 800×480 RGB touch capacitive screen interaction system (LVGL 9), and Core 1 dedicated 32-bit real-time software audio mixer.




📑 Table of Contents

  • 🌟 Core Features
  • 🖥️ Hardware Environment and Pin Mapping
  • 🛠️ Development and Build Environment Configuration
  • 🚀 Quick Start (Build and Flash)
  • ⚡ Software Architecture and Dual-Core Scheduling Model
  • 🖲️ Human-Machine Interaction Guide
  • 📁 Project Code Directory Structure
  • ❓ Common Issues Troubleshooting (FAQ)


🌟 Core Features

  • 🎹 AMY 16 polyphonic multi-algorithm synthesis engine: supports DX7 (128 classic FM patches) and Juno-6 (128 classic analog patches) dual timbre libraries. Built-in 160 independent oscillators, supporting multi-oscillator stacking, envelope modulation (ADSR), filtering, and algorithmic synthesis.
  • 🎵 Standard SMF (.mid) music player: fully parses the standard MIDI file format (SMF Format 0 & Format 1 multi-track synchronization). Parses VLQ variable-length delta times, automatically tracks Set Tempo (0xFF 0x51) dynamic tempo and builds a microsecond-level timeline. Includes the selected track “Beautiful Myth.mid”, and also supports hot-plugging from SD card to read and play any .mid file.
  • 📡 Bluetooth Classic A2DP audio receiver (wireless speaker mode): device broadcast name: ESP32S31-Audio, supports iPhone, Android (Xiaomi/Huawei/OPPO etc.), Windows and Mac driverless direct connection. Supports AVRCP media protocol, enabling volume synchronization and remote playback control between phone and board. Includes UTF-8 character safe filtering algorithm to prevent missing glyph boxes for Chinese Bluetooth names on the screen.
  • 🎛️ ESP32-S31 hardware ASRC and real-time 32-bit software audio mixing: hardware ASRC co-processor acceleration: connects to ESP32-S31 on-chip dedicated hardware ASRC peripheral (components/esp_asrc), with low-level hardware automatically performing high-fidelity asynchronous sample rate conversion from 48kHz / 32kHz ➡️ 44.1kHz, CPU usage near zero. Core 1 dedicated audio task: serves as the system's sole I2S DMA write endpoint, completely eliminating distortion, tearing, and noise caused by concurrent DMA writes from multiple tasks. On-the-fly accompaniment: supports playing background music via phone Bluetooth while fingers play the touch piano on the screen, achieving zero latency, noise-free perfect overlay mixing.
  • 🖥️ 800×480 widescreen touch UI (LVGL 9): 3 full octaves (C3 ~ B5, total 36 keys) touch piano keyboard, supporting direct finger tapping and multi-touch. MIDI playback and Bluetooth audio are bidirectionally linked, with keys flashing cyan/magenta highlights in real time according to played notes. Provides bank switching, timbre switching, octave adjustment, volume up/down, MIDI play/pause, and real-time ADSR parameter display.


🖥️ Hardware Environment and Pin Mapping

1. Core Hardware Specifications

  • Main controller chip: ESP32-S31 (dual-core 32-bit RISC-V @ 320 MHz, featuring PIE vector extension instruction set).
  • Storage configuration: 16 MB QIO Flash + 8 MB Octal PSRAM (operating at 200 MHz high-speed mode).
  • Audio Codec: ES8389 high-fidelity full-duplex audio codec chip.
  • Amplifier system: NS4150B dual-channel stereo PA amplifier, connected to onboard dual speakers.
  • Display touch: 800×480 RGB565 LCD + GT1151 capacitive multi-touch chip.
  • External storage: MicroSD (TF) card slot, using SDMMC 4-bit high-speed interface (SD3.0 / U1).

2. Full Peripheral GPIO Pin Assignment Table (Hardware Reference Definition)


Peripheral Module Function / Signal Name GPIO Pin Hardware Operation Characteristics and Description
RGB LCD Screen Data lines (16-bit RGB565) PCLK (pixel clock ~18MHz) HSYNC (line sync) VSYNC (frame sync) DE (data enable) DISP (display enable) GPIO8 ~ GPIO19, GPIO33 ~ GPIO36 GPIO40 GPIO44 GPIO45 GPIO43 GPIO38 esp_lcd RGB 并行总线,PSRAM 双缓冲,防画面撕裂
GT1151 Capacitive Touch Screen I2C SDA I2C SCL GPIO0 GPIO1 Shares I2C master line with audio Codec, supports continuous multi-finger touch
ES8389 Audio Codec I2C SDA / SCL I2S MCLK (master clock) I2S SCLK/BCLK (bit clock) I2S WS (left/right channel frame clock) I2S DOUT (DAC playback) I2S DIN (ADC recording) GPIO0 / GPIO1 (I2C 地址 0x20) GPIO2 GPIO3 GPIO4 GPIO5 GPIO6 Standard Philips I2S format, uniformly operating at 44.1kHz 16-bit dual-channel Stereo mode
NS4150B PA Amplifier PA_EN (amplifier enable control) GPIO7 Active HIGH enable, turns on left and right stereo speakers
MicroSD Card (SDMMC) CLK / CMD D0 / D1 / D2 / D3 PWR_EN (power control) GPIO24 / GPIO25 GPIO20 / GPIO21 / GPIO22 / GPIO23 GPIO39 PWR_EN 为低电平使能 (Active LOW: 0=供电),SDMMC 4-bit 40MHz 挂载至 /sdcard
On-chip Hardware ASRC On-chip co-processor On-chip hardware internal channel Hardware asynchronous resampling, supports automatic hardware conversion from 48kHz/32kHz to 44.1kHz
WS2812 Status LED DIN (single-wire control) GPIO37 ESP-IDF RMT peripheral driver, supports breathing and gradient rainbow lighting effects
Physical Buttons (4 buttons) ADC1 channel 1 GPIO42 单 ADC 阶梯分压网络:SET、MODE、VOL-、VOL+


🛠️ Development and Build Environment Configuration

1. Supported Operating Systems

  • Comments (0)

    Comments

    Sign in to leave a comment

    No data
    No data