Lesson 5 of 15
Interval Ratios
Intervals and Frequency Ratios
An interval is the distance between two notes measured in semitones.
In 12-TET, every interval has a precise frequency ratio:
ratio = 2^(semitones / 12)
Common Intervals
| Semitones | Name | Ratio |
|---|---|---|
| 0 | Unison | 1.0000 |
| 3 | Minor 3rd | 1.1892 |
| 4 | Major 3rd | 1.2599 |
| 7 | Perfect 5th | 1.4983 |
| 12 | Octave | 2.0000 |
The perfect fifth (7 semitones) has ratio ≈ 3/2, making it one of the most consonant intervals. Two notes a perfect fifth apart sound naturally "in tune" together.
From Ratio to Frequency
If the root is at frequency f, the note n semitones above is at:
f × intervalRatio(n)
Your Task
Implement intervalRatio(semitones) that returns the frequency ratio.
Run your code to hear A4 and its perfect fifth (E5) played together.
Web Audio API loading...
Loading...
Click "Run" to execute your code.