Project 12: Audio Synthesizer

A real-time audio synthesizer with oscillators, filters, envelopes, and effects—like a mini software synth that responds to MIDI or keyboard input.

Quick Reference

Attribute Value
Primary Language Odin
Alternative Languages C, Rust
Difficulty Level 3: Advanced
Time Estimate 2-3 weeks
Knowledge Area Audio / DSP / Real-Time
Tooling miniaudio (Odin bindings)
Prerequisites Understanding of audio concepts, basic signal processing

What You Will Build

A real-time audio synthesizer with oscillators, filters, envelopes, and effects—like a mini software synth that responds to MIDI or keyboard input.

Why It Matters

This project builds core skills that appear repeatedly in real-world systems and tooling.

Core Challenges

  • Lock-free audio callbacks → maps to real-time constraints
  • Oscillator math (sin, saw, square) → maps to Odin math functions
  • Filter implementation → maps to state management
  • MIDI handling → maps to binary protocol parsing

Key Concepts

  • miniaudio in Odin: vendor:miniaudio
  • Digital Signal Processing: “The Audio Programming Book” Ch. 1-5
  • Lock-Free Programming: For audio thread safety
  • SIMD for Audio: Processing multiple samples at once

Real-World Outcome

$ odin run synth

Odin Synthesizer v0.1
---------------------
Audio: 44100 Hz, 256 sample buffer (5.8ms latency)
MIDI: Connected to "Arturia KeyStep"

[Window shows virtual keyboard and visualizers]

Oscillators:
  OSC1: Saw wave, +0 cents
  OSC2: Square wave, -12 semitones (sub)

Filter:
  Type: Low-pass (Moog ladder)
  Cutoff: 800 Hz
  Resonance: 0.7

Envelope:
  Attack: 10ms
  Decay: 200ms
  Sustain: 0.6
  Release: 500ms

Effects:
  ✓ Reverb (hall, 0.3 wet)
  ✓ Delay (300ms, 0.4 feedback)
  ✓ Chorus (rate: 1.5 Hz)

CPU: 4.2%
Playing: C4, E4, G4 (C major chord)

Implementation Guide

  1. Reproduce the simplest happy-path scenario.
  2. Build the smallest working version of the core feature.
  3. Add input validation and error handling.
  4. Add instrumentation/logging to confirm behavior.
  5. Refactor into clean modules with tests.

Milestones

  • Milestone 1: Minimal working program that runs end-to-end.
  • Milestone 2: Correct outputs for typical inputs.
  • Milestone 3: Robust handling of edge cases.
  • Milestone 4: Clean structure and documented usage.

Validation Checklist

  • Output matches the real-world outcome example
  • Handles invalid inputs safely
  • Provides clear errors and exit codes
  • Repeatable results across runs

References

  • Main guide: LEARN_ODIN_PROGRAMMING_LANGUAGE.md
  • “The Audio Programming Book” by Boulanger & Lazzarini