Capstone 7 · Frontend
The Rhythm Machine
Build a drum machine. Sixteen steps, several tracks, and a play head that moves in time. That much is a weekend. The part that makes it worth showing is timing. Naive sequencers schedule each sound with a timer and drift audibly within a minute, because browser timers are not accurate enough for music and get throttled when the tab loses focus. Doing it properly means scheduling ahead against the audio clock rather than the wall clock: a lookahead loop that queues notes slightly in the future, so the audio thread plays them at exactly the right moment. Then make it musically interesting. West African and diasporic rhythm is built on polyrhythm, so allow tracks with different step counts running against each other: a 16 against a 12 produces patterns that take four bars to resolve. Let people hear that. Encode the pattern in the URL so somebody can send a link and the other person hears the same thing.
Concepts used
Your dataset
No external data. Synthesise the sounds or include a small set of samples you have the right to use.
Milestones
The graded core
The rest of this project is yours to shape. This one function is the piece everything else depends on, so it runs against hidden tests to prove it is right before you build outward.
Your workspace
Build the full project here. Work through the milestones in order, in both languages.