Lesson 9 of 15

Note Durations

Note Values

Western music notation divides beats into standard note values. At a given BPM, each note value has a precise duration in seconds.

Note Values

NoteTypeBeatsFormula
𝅝Whole44 Γ— beat
𝅗π…₯Half22 Γ— beat
β™©Quarter11 Γ— beat
β™ͺEighthΒ½Β½ Γ— beat
♬SixteenthΒΌΒΌ Γ— beat

Formula

noteDuration(bpm, noteType) = 60 / bpm Γ— (4 / noteType)

Where noteType is 1 (whole), 2 (half), 4 (quarter), 8 (eighth), or 16 (sixteenth).

Example at 120 BPM

Quarter (4):   60/120 Γ— (4/4)  = 0.5000 s
Eighth  (8):   60/120 Γ— (4/8)  = 0.2500 s
Sixteenth (16): 60/120 Γ— (4/16) = 0.1250 s

Your Task

Implement noteDuration(bpm, noteType) returning the duration in seconds.

Run your code to hear quarter notes followed by eighth notes.

Web Audio API loading...
Loading...
Click "Run" to execute your code.