This is a compact audio recorder and player designed as a simple alternative to recording with a computer and digital audio workstation (DAW).
It's built around the SGTL5000 audio codec and a Teensy microcontroller.
Key features:
Convenient for live recording, quick captures, or any situation where you want high-quality audio without the complexity of a full DAW setup.
The code is organized as a blocking state machine. Control is divided among five functions, referred to as states: Stopped, Play, Settings, Monitor, and Record. Each state runs continuously until it decides to exit and hand control back to the main loop. This keeps each mode self-contained and makes the overall program flow easy to follow.
As a result, the loop() function remains very simple:
void loop() {
switch (state) {
case STOPPED: stateStopped(); break;
case PLAY: statePlay(); break;
case SETTINGS: stateSettings(); break;
case MONITOR: stateMonitor(); break;
case RECORD: stateRecord(); break;
}
}
Allows the user to scroll through the list of audio files stored on the SD card. Files can be selected using the encoder knob.
Handles audio playback. The AudioPlaySdWav object from the Teensy Audio Library manages the entire playback process, including buffering and timing.
All buttons are monitored. Will exit automatically when the file finishes playing.
For selecting the input source and changing a few other settings
Allows the user to adjust the levels before recording. All buttons are monitored.
Recording is handled in three phases:
From chatGPT
Both setups deliver high-quality line-level stereo audio (recording/playback at 44.1/48 kHz, 16–24 bit), but they excel in different areas. Here's a 2026 breakdown:
| Aspect | Teensy 4.x + SGTL5000 Audio Shield | ESP32 (S3 recommended) + ES8388 Module/Board |
|---|---|---|
| Raw Performance | 600 MHz single-core ARM Cortex-M7 → superior for heavy real-time DSP (effects, synthesis, multi-channel processing). Low-latency guaranteed. | Dual-core 240 MHz Xtensa → good for basic recording/playback, but can struggle with intensive FX without optimization. |
| Audio Quality | Excellent (SGTL5000: 16-bit, ~100 dB SNR, headphone amp, line-in/out). Clean but slightly dated codec. | Comparable or better (ES8388: up to 24-bit/192 kHz, low noise, headphone amp). Often praised for clearer stereo separation. |
| Ease of Use | Teensy Audio Library — legendary, beginner-friendly, GUI design tool, hundreds of examples/effects. | ESP-ADF (official Espressif framework) — very well-documented, many recorder/player examples. Arduino libs also solid. |
| Community/Support | Strong niche (PJRC forum active, audio-focused users). | Massive (Espressif docs, GitHub, Reddit r/esp32). More users overall. |
| Features | No built-in WiFi/BT; add via modules. Great I/O pins. | Built-in WiFi/BT → wireless upload, streaming, web control. Battery-friendly. |
| Cost | ~$20–30 (Teensy) + $15–20 (shield) = $35–50. | ~$5–10 (ESP32-S3 board) + $10–20 (ES8388 module/LyraT) = $15–30. Cheaper. |
| Reliability for Recording | Rock-solid with fast SD card; library handles buffering perfectly. | Very reliable with ESP-ADF; examples for glitch-free WAV recording to SD. |
| Best For | Pure audio projects, low-latency effects, high CPU needs. | IoT-connected recorders, wireless features, cost-sensitive builds. |
For line-level recorder, ESP32 + ES8388 edges out in 2026 due to cost, connectivity, and active development — many new projects use it (e.g., LyraT boards).
If switching to ESP32, start with an ESP32-S3 + ES8388 module (~$20 total) and ESP-ADF examples — you'll get clean recordings fast.