Lesson 1 of 15
Note to Frequency
Equal Temperament
Modern Western music divides the octave into 12 equal semitones. Each semitone is a frequency ratio of ²¹²√2 ≈ 1.0595.
This system is called twelve-tone equal temperament (12-TET). It lets instruments in different keys play together in tune.
MIDI Note Numbers
Every note has a MIDI number — an integer from 0 to 127:
| Note | MIDI | Freq |
|---|---|---|
| A4 (concert A) | 69 | 440 Hz |
| Middle C (C4) | 60 | 261.63 Hz |
| C5 | 72 | 523.25 Hz |
| A5 | 81 | 880 Hz |
The Formula
f(n) = 440 × 2^((n − 69) / 12)
The anchor is A4 = 440 Hz (MIDI 69). Every 12 semitones is one octave (frequency doubles). Every semitone multiplies by 2^(1/12).
Your Task
Implement noteToFreq(n) that converts a MIDI note number to its frequency in Hz.
Run your code to hear A4 (440 Hz) through your speakers.
Web Audio API loading...
Loading...
Click "Run" to execute your code.