What's Next?
Congratulations
You have completed all 15 lessons of Music Programming. You can now convert between MIDI and frequencies, name notes, build scales and chords, transpose progressions, schedule melodies with precise timing, apply gain in decibels, modulate parameters with an LFO, and build a 16-step drum machine — all with the Web Audio API.
What to Explore Next
- Tone.js — A higher-level audio framework built on the Web Audio API. Provides Transport, Sequencer, and a large library of synthesis and effects nodes
- Web MIDI API — Connect a real MIDI keyboard and route its input to your Web Audio synthesis code
- AudioWorklet — Run custom DSP code on the audio thread for custom oscillators, convolution reverb, and spectral processing
- SuperCollider — The server-client audio synthesis language used by electronic musicians worldwide
Key Formulas
| Concept | Formula |
|---|---|
| MIDI to frequency | 440 × 2^((n − 69) / 12) |
| Frequency to MIDI | round(69 + 12 × log₂(f / 440)) |
| Interval ratio | 2^(semitones / 12) |
| Beat duration | 60 / bpm |
| Note duration | 60 / bpm × (4 / noteType) |
| dB to gain | 10^(dB / 20) |
| Gain to dB | 20 × log₁₀(gain) |
| LFO | depth × sin(2π × rate × t) |
References
- MDN Web Audio API — The canonical reference
- The Audio Programming Book — Comprehensive DSP and synthesis theory
- Music Theory for Computer Musicians by Michael Johnson