Mcu32
Well-known member
Neon Noir – a small cinematic synth piece using the Teensy Audio Library
First of all, a big thank you to Paul Stoffregen and everyone who has contributed to the Teensy Audio Library. It is a fantastic piece of work.I've been working on ESP-beatsy, a port of the Teensy Audio Library to the ESP32 family. The goal is to preserve the familiar API wherever possible, while adapting things to the ESP32's hardware, memory and scheduling constraints.
A small disclaimer: ESP-beatsy is very much a work in progress. At this stage, the repository is still a PlatformIO project rather than a polished, independently packaged library. The library code lives in the lib/ directory. I'm actively working on it and continuously adding, improving and refining things.
I thought it might be nice to share a small example of what can be done without writing an excessive amount of code.
Neon Noir is a generative synth piece with a cinematic, retro-futuristic atmosphere, broadly inspired by the kind of mood associated with Blade Runner and Vangelis. It doesn't reproduce any existing melody or recording; I wanted to explore that general atmosphere with the audio library.
The patch combines:
- Four slightly detuned oscillators for evolving pad chords
- A synthesized bass with filtering and an envelope
- A wavetable lead and an airy, choir-like upper layer
- Low drones and pink noise for a machine-like ambience
- A slowly modulated low-pass filter on the lead
- A tempo-synchronized, four-tap delay
- Stereo Freeverb reverb
- A distant, pitch-swept siren heard through the reverb
- Stereo I2S output and CPU-usage diagnostics
- Audio graph at a glance
The example uses 30 audio-stream objects connected by 39 AudioConnection instances:
The graph combines synthesis, filtering, envelopes, mixing, multi-tap delay, stereo reverb and I2S output. The codec control object is not included in the counts.Component Count AudioSynthWaveform 9 AudioSynthWavetable 2 AudioSynthNoisePink 1 AudioMixer4 8 AudioFilterBiquad 4 AudioEffectEnvelope 3 AudioEffectDelay 1 AudioEffectFreeverbStereo 1 AudioOutputI2S 1 Total audio-stream objects 30 Audio connections 39
On my rather old ESP32 Gen 1, the audio graph uses a little over 70% of Core 1, typically around 74%, with brief peaks of approximately 79%.
The ESP32 version requires PSRAM for the reverb. Make sure PSRAM is available and enabled on your board.
I would expect a Teensy 4.x to run this patch more comfortably, but that's only an expectation — I haven't measured it on a Teensy yet. The ESP32-S3 and ESP32-P4 have also not been tested with this example so far.
I've prepared a separate Teensy 4.x version for this forum post, using the SGTL5000 Audio Shield. It is deliberately not part of the ESP-beatsy repository. My Teensy hardware is currently disassembled, so I haven't been able to compile or test that version yet. Please consider it an untested adaptation rather than a confirmed working sketch.
The attached ZIP contains the compact wavetable tables used by the example, derived from the New Vintage Dreams SoundFont, which is released under CC0 1.0.
Links:
- ESP-beatsy Audio Library / PlatformIO project
- Neon Noir ESP32 example
- Wavetable source and attribution
- Recorded MP3
I hope someone finds the example useful or simply enjoys listening to it. And thanks again to Paul and all the contributors for making this kind of experimentation possible.
Attachments
Last edited: