All puzzles › Music
Music Practice Problems
13 puzzles (6 easy, 6 medium, 1 hard), 3 free, in Python, JavaScript and C++.
Notes, scales, intervals and rhythm turned into code puzzles.
The puzzles, easiest first
- Spread the Beats Evenly (Easy, free): Place 3 drum hits as evenly as possible across 8 steps and you get the tresillo, the rhythm under a huge share of Latin and pop music.
- Interval in Semitones (Easy): Given two MIDI notes, return how many semitones apart they are.
- Lowest Note (Root) (Easy): Given the notes of a chord, return the lowest one.
- Total Beats (Easy): Given a list of note lengths in beats, return the total.
- Transpose a Melody (Easy): Given a list of MIDI note numbers and a shift n, return every note moved up by n.
- Transpose Down (Easy): Given a list of MIDI notes and a number of semitones, return every note lowered by that much.
- Find the Beat (Medium, free): A music app detects the tempo of a song from the moments when notes begin, called onsets.
- Name That Chord (Medium, free): Three notes played together form a triad, and its sound depends on the gaps between them.
- Count Accidentals (Medium): Given a list of MIDI notes, return how many land on black piano keys.
- In Key? (Medium): Given a scale as pitch classes (0 to 11) and a MIDI note, return true if the note is in the scale.
- Longest Rising Run (Medium): Given a melody as note numbers, return the most times in a row the melody goes up.
- Same Pitch Class (Medium): Given a list of MIDI notes and a target note, return how many notes are the same pitch as the target, in any octave.
- Build a Major Scale (Hard): Given a root note, return the seven notes of its major scale.
Practice another pattern
Or browse by subject
Browse all 676 puzzles