Rhythm Sequencer
Make some noise. A 16-step drum machine running entirely in your browser with synthesized audio.
The Mathematics of Music
Music is fundamentally mathematical: pitch is frequency (A4 = 440 Hz), octaves are frequency doublings, and consonant intervals are simple ratios (perfect fifth = 3:2, perfect fourth = 4:3). Rhythm divides time into regular beats grouped into measures, creating the temporal structure that makes music feel organised and danceable.
Digital Audio Synthesis
This sequencer uses the Web Audio API to generate sound in real time. Each instrument is synthesised from basic waveforms: sine (pure tone), square (hollow, retro), sawtooth (bright, buzzy), and triangle (mellow). Drums use noise bursts shaped by envelopes (Attack-Decay-Sustain-Release), giving each percussive hit its characteristic shape and timbre.
Step Sequencing and Drum Machines
The grid represents time (columns = steps) and instruments (rows). Each cell is either on or off. As the playhead moves left to right, active cells trigger sounds. This paradigm was pioneered by the Roland TR-808 (1980) and TR-909 (1983), which defined the sound of hip-hop, techno, and electronic music and remain hugely influential today.
Rhythm, Tempo, and Time Signatures
Tempo (BPM) controls playback speed. 4/4 time (four beats per measure) is the most common time signature in pop and rock music. 3/4 gives a waltz feel; 6/8 creates a compound groove. Polyrhythms layer different time signatures simultaneously, creating complex interlocking patterns used in African drumming, jazz, and progressive rock.
Experiments to Try
- Create a basic 4/4 rock beat: kick on beats 1 and 3, snare on 2 and 4, hi-hat on all eighth notes
- Try a boom-bap hip-hop pattern with syncopated kick placement
- Create polyrhythms with different cycle lengths for each instrument
- Adjust tempo from 60 BPM (slow, ambient) to 200 BPM (fast, drum and bass)
- Add synth accents to create melodic interest alongside the percussion
Rhythm & Time Signatures
A time signature (e.g., 4/4, 3/4, 7/8) specifies how many beats are in each measure and what note value counts as one beat. A beat is the basic unit of musical time; tempo (BPM beats per minute) sets its speed. At 120 BPM, one beat lasts 0.5 s. The sequencer’s step grid divides each measure into sub-divisions, creating the rhythmic backbone of music.
Polyrhythms
A polyrhythm is the simultaneous use of two or more conflicting rhythms. The most common 3-against-2 overlays three equal beats over two, creating a rocking cross-rhythm. 4-against-3 (the hemiola) appears in Chopin waltzes. African and Indian classical music feature highly complex polyrhythms. The sequencer lets you hear these patterns clearly by assigning different rhythms to separate voices.
Sound Synthesis
Percussion sounds are synthesized using the Web Audio API. A kick drum uses a brief sinusoidal burst with exponential frequency sweep; a snare combines filtered noise with a short sine transient. Fourier synthesis is the basis for all additive synthesis: any periodic waveform can be expressed as a sum of sinusoids, f(t) = Σ Ansin(2πnƒt). The timbre of an instrument is determined by its harmonic amplitudes An.
Musical Acoustics
Pitch is determined by fundamental frequency (Hz). The standard tuning A4 = 440 Hz; each octave doubles the frequency. Musical intervals correspond to simple frequency ratios: an octave is 2:1; a perfect fifth is 3:2; a perfect fourth is 4:3. Equal temperament divides the octave into 12 equal semitones, each a factor of 21/12 ≈ 1.0595 above the previous, allowing transposition to any key.
Key Equations
| Concept | Formula | Notes |
|---|---|---|
| Beat duration | T = 60/BPM (s) | At 120 BPM: T = 0.5 s |
| Semitone ratio | r = 21/12 ≈ 1.0595 | Equal temperament; 12 semitones = 1 octave |
| Note frequency | fn = 440 ⋅ 2(n−69)/12 | n = MIDI note number; A4 = 440 Hz at n=69 |
| Octave relationship | fn+12 = 2fn | One octave up doubles frequency |
| Fourier series | f(t) = A0 + Σ Ancos(nωt) + Bnsin(nωt) | Harmonic decomposition of any periodic sound |
| Polyrhythm LCM | Period = LCM(m, n) / BPM | m:n polyrhythm repeats after LCM(m,n) beats |
Curriculum Relevance
| Level | Topic | Relevance |
|---|---|---|
| GCSE Music | Rhythm, metre, notation | Time signatures, note values, beat divisions |
| A-Level Music / Physics | Acoustics & waves | Frequency, harmonics, timbre, standing waves |
| IB Music | World music & rhythm | African, Indian polyrhythm traditions; additive rhythm |
| Undergraduate | Music technology / DSP | Signal processing, Fourier transforms, synthesis algorithms |
| Postgraduate | Music cognition / MIR | Beat tracking algorithms, onset detection, tempo induction |
🔒 Unlock All 32 Simulations
Get unlimited access to all 32 simulations — including the Rhythm Sequencer, Fourier Epicycles, String Wave and more with MySimulator Premium.
Upgrade to PremiumDiscussion and comments (Premium)
Premium members can discuss use-cases and ask questions inside this page.
Video tutorial (Premium)
A short guided walkthrough is available for premium users.
Unlock Tutorial ->Downloadable worksheet (Premium)
Printable worksheet with tasks and reflection questions.
Unlock Worksheet ->Share this simulation
Send this page to students or colleagues.
Related simulations
Continue with similar experiments.
📖 Recommended Reading
Deepen your understanding with our in-depth articles.