The Teensy audio library DSP project ecosystem is one of the most powerful tools available for Indian audio electronics hobbyists. Paul Stoffregen’s Audio Library transforms Teensy 4.x into a professional-grade DSP platform capable of real-time audio effects, synthesisers, and audio analysis at near CD quality.
Table of Contents
- Teensy Audio Hardware Setup
- Audio System Design Tool
- Building Audio Effects
- Simple Synthesiser Project
- FFT Spectrum Analyser
- Components Available in India
- Frequently Asked Questions
Teensy Audio Hardware Setup
The Teensy Audio Library works with Teensy 3.x and 4.x boards. For serious audio projects, the Teensy Audio Shield is essential — it provides a 24-bit Wolfson WM8960 codec with stereo inputs/outputs at 44.1 kHz sample rate. Alternatively, a PT8211 DAC module (I2S, ₹80–150 in India) or MAX98357 I2S amplifier (₹200–350) can be used for output-only projects.
Teensy 4.1 with the Audio Shield is the benchmark platform. The 600 MHz Cortex-M7 handles multiple simultaneous effects, filters, and synthesis voices without overloading.
Audio System Design Tool
The Teensy Audio Library comes with a browser-based Audio System Design Tool (https://www.pjrc.com/teensy/gui/). Drag and drop audio objects (oscillators, mixers, effects, I/O), connect them visually, and export the generated C++ code directly into your Arduino sketch. This visual approach makes DSP project design accessible to beginners.
// Generated code from Audio System Design Tool
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
AudioSynthWaveform waveform1;
AudioEffectChorus chorus1;
AudioEffectReverb reverb1;
AudioMixer4 mixer1;
AudioOutputI2S i2s1;
AudioConnection patchCord1(waveform1, 0, chorus1, 0);
AudioConnection patchCord2(chorus1, 0, reverb1, 0);
AudioConnection patchCord3(reverb1, 0, mixer1, 0);
AudioConnection patchCord4(mixer1, 0, i2s1, 0);
AudioConnection patchCord5(mixer1, 0, i2s1, 1);
AudioControlSGTL5000 audioShield;
Building Audio Effects
The Audio Library includes ready-to-use DSP blocks:
- Reverb, chorus, flanger, bitcrusher, envelope
- Biquad and FIR filters (parametric EQ, crossover)
- Peak detector, RMS level meter
- Granular synthesis, sample playback from SD card
void setup() {
AudioMemory(120);
audioShield.enable();
audioShield.volume(0.7);
waveform1.begin(WAVEFORM_SAWTOOTH);
waveform1.frequency(220);
waveform1.amplitude(0.5);
// Guitar-style reverb
reverb1.reverbTime(2.0); // 2 seconds
chorus1.voices(3);
mixer1.gain(0, 0.8);
}
Simple Synthesiser Project
A 4-voice polyphonic synthesiser is buildable with Teensy 4.1 and 4 push buttons (₹5 each). Map each button to a note and layer oscillators, filter, and envelope for classic synth sounds.
// 4-voice polyphonic patch
AudioSynthWaveform osc[4];
AudioEffectEnvelope env[4];
AudioMixer4 voiceMixer;
AudioEffectChorus chorus1;
AudioOutputI2S i2s1;
void noteOn(int voice, float freq) {
osc[voice].frequency(freq);
env[voice].noteOn();
}
void noteOff(int voice) {
env[voice].noteOff();
}
FFT Spectrum Analyser
Teensy’s FFT block performs real-time 1024-point FFT, giving 512 frequency bins at 44.1 kHz (86 Hz resolution per bin). Display results on an OLED or TFT display for a visual spectrum analyser.
AudioAnalyzeFFT1024 fft1;
// Read magnitude of frequency bins
for (int i = 0; i < 512; i++) {
float level = fft1.read(i);
// Draw bar on display proportional to level
}
Components Available in India
- Teensy 4.1: Available from Indian importers and international shipping, ₹3,500–5,000
- PT8211 I2S DAC module: ₹80–150 on Amazon/Robu
- MAX98357 I2S 3W amplifier: ₹200–350
- Electret microphone with amplifier: ₹40–80
- TFT display for spectrum: ILI9341 2.4″ (₹250–400)
Frequently Asked Questions
Can Arduino Uno run the Teensy Audio Library?
No. The Teensy Audio Library requires the specific Teensy hardware and Teensyduino environment. Arduino Uno lacks the processing power and I2S peripheral for real-time audio DSP at 44.1 kHz.
What sample rate does the Teensy Audio Library use?
44.1 kHz is the standard (CD quality), with 16-bit samples. The Audio Shield supports 44.1 kHz and 48 kHz sample rates.
How many simultaneous effects can Teensy 4.1 handle?
With 600 MHz Cortex-M7 and FPU, Teensy 4.1 can handle 50+ simultaneous audio objects. CPU usage monitoring with AudioProcessorUsageMax() helps avoid overloads.
Add comment