The Song
How has the popular song's form been shaped by the technologies that sold it, from sheet music to streaming?
The hit single's introduction shrank from over twenty seconds in the mid-1980s to about five by the mid-2010s (Léveillé Gauvin, 2018), and on streaming services a play pays only after about thirty seconds. The part follows the song from Tin Pan Alley's thirty-two-bar AABA to verse and chorus and the song factories; from progressions to loops (I-V-vi-IV, bVII-IV-I, the aeolian loop), where melody and harmony part company (4 of the 12 on-beat notes of our hook lie outside the chord); riffs, and why distortion forces power chords; the backbeat, funk's one, disco's four on the floor, house and half-time trap, with drum-machine swing on the sixteenths; hooks, titles and prosody, measured as the share of syllables whose stress matches the beat; the 808 from first principles, a struck resonator sagging from 81 to 52 Hz and six square waves for the hats, tuned into a bass line; the break, the sampler and the law; flow, a verse of ours placed on the beat and in threes, measured after Ohriner; and the build, the drop and the sidechain. Corpus studies (Mauch and colleagues; Serrà and colleagues) frame what sixty years of charts show, and what they leave out. The Tune becomes a pop single and then a beat that samples Variation 7.
What you need. Part 11 for meter; Part 14 for melody; Part 21 for form; Part 37 for timelines and interlocking; Part 38 for swing and the blues; Part 39 for standards. Oscillators and resonators, compressors, corpus statistics.
- Ideas, mathematics and history
- AABA to verse-chorus to the loop, rock harmony, groove, the hook, hip-hop's breakbeat and flow, the drop, pop measured over sixty years
- What we build, compute and hear
- corpus statistics of charts; the Tune as a pop single and a sampled beat
What you will be able to do
Foundations
- Hear AABA and verse-chorus forms, loops and riffs, and name them.
- Hear the backbeat, four on the floor and a half-time beat, and drum-machine swing.
- Hear a sidechain pump and a power chord stay clear through distortion.
Full course
- Build drum-machine voices from their circuits' principles: a struck resonator and six square waves.
- Measure prosody and flow on a sixteenth-note grid.
- Compute a sidechain's ducking and recovery, and chop and re-sequence a recording.
Research
- Design a study of whether new platforms change how songs are written or only which win.
Practice
- Program a beat, tune an 808 and sidechain a pad, as producers do; clear samples or replay them.
Contents
Each chapter has a home level. Choose a track to see what to read and watch: Foundations 20 min · Full course 28 min · Research 31 min · Practice 28 min.
- 0Twenty seconds to fiveFoundations2 min
- 1From AABA to verse and chorusFoundations2 min
- 2Loops and rock harmonyFoundations2 min
- 3RiffsFoundations3 min
- 4The backbeat and grooveFoundations3 min
- 5Hooks and prosodyFoundations3 min
- 6The drum machinePractice3 min
- 7The break and the samplerPractice2 min
- 8FlowPractice3 min
- 9The build, the drop and the sidechainFoundations2 min
- 10Frontier: sixty years of chartsResearch3 min
- Variation 40, recap and problemsAll tracks2 min
Also on this page: Lecture · Key results · Try it · Lab · Problems · Notes and sources · Build the film.
Lecture
The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film. A dashed box stands for a number the film computes when it is rendered (hover over it to see what is computed); the README's figures for each chapter, where it lists them, follow the chapter's text.
Twenty seconds to fiveFoundations2 min
This part follows the popular song from sheet music to the drop. First, a test. The same song of ours, twice, with two different openings. In each, how long before the singer comes in: about five seconds, ten, or twenty?
About twenty seconds in the first, and about five in the second. That is roughly what happened to the hit single. A study of top-ten singles in America found that the average introduction shrank from over twenty seconds in the mid-1980s to about five by the mid-2010s.
The study was Hubert Léveillé Gauvin's, in 2018: three hundred and three American top-ten singles from 1986 to 2015. The intros shrank by about four fifths, the voice and the title arrived sooner, and tempos rose. Why? One possible incentive: some major streaming services count a stream after thirty seconds, although payment arrangements vary. That threshold may encourage an early hook, but this historical trend does not by itself establish streaming as its cause. This part follows the popular song from the sheet-music standard to the drop, and finds each form shaped by the technology that sold it.
Here is the plan. From AABA to verse and chorus, loops and rock harmony, and riffs. The backbeat and groove, from rock to trap. Hooks, and how words sit on beats. The drum machine, with an 808 built from first principles. Sampling, the break, and rap's flow, measured. And the build, the drop and the sidechain; then what sixty years of charts show. Every song, riff, beat and verse is ours; the voice is Part 17's model, which sings vowels rather than words.
1From AABA to verse and chorusFoundations2 min
How did the shape of a song change?
For the first half of the twentieth century, American popular songs came from Tin Pan Alley, songwriters in New York writing to sell sheet music, and then records. The standard form was a verse, often dropped, then a thirty-two bar refrain in four eight-bar sections: A A B A. A states the tune twice; B, the bridge or middle eight, goes somewhere else; A returns. Gershwin, Berlin, Porter and Rodgers wrote in it, and jazz took their songs as standards, as Part 39 heard. The title usually sits at the start or end of each A.
Hear the shape in a song of our own, each section shortened to four bars: the A tune, the A tune again, the bridge, which moves to the subdominant and leans on the dominant, and the A tune to close.
From the 1960s the verse and chorus took over. The verse tells the story, with new words each time; a pre-chorus lifts; the chorus repeats the same words, carries the title, and is the fullest moment, here with a second voice and a pad.
Why the change? Rock and roll and the seven-inch single favoured shorter, repeated, danceable forms. The Beatles and their contemporaries mixed both, writing verse and chorus songs with a middle eight. Radio rewarded a chorus heard early and often. The chorus became the song's hook and its title: the part you remember. Chapter two turns to the harmony under those choruses.
Songs have often been made in factories. In New York's Brill Building in the early 1960s, teams of writers in small rooms wrote to order. Motown, in Detroit from 1959, had writers, a house band and weekly quality-control meetings, modelled on the city's car plants. From the 1990s Swedish writer-producers such as Max Martin wrote hits for singers around the world. The song became a designed product, tested against an audience. Part 42 treats composing as search, and the market is one of the judges.
2Loops and rock harmonyFoundations2 min
What happens to harmony when it goes round in a circle?
Much rock and pop harmony is a loop: a few chords repeated, rather than a progression going somewhere. One, five, six, four: the four-chord loop under countless choruses. Flat seven, four, one: chords falling by fourths into the tonic, the double plagal motion of mixolydian rock. And the aeolian loop, minor, one, flat six, flat three, flat seven, which never reaches a dominant at all.
Hear each twice round, with guitar, bass and drums. Notice that none of them feels finished at the end of the loop: each one simply goes round again.
Over a loop, the melody is freer. The theorist David Temperley pointed out in 2007 that in rock, melody notes on strong beats are often not in the chord, a melodic-harmonic divorce. Monochord counts our own chorus hook over one, five, six, four: of its notes on the beat lie outside the chord. A chorale analysis would inspect preparation, duration and resolution before judging such notes; the count alone does not identify errors in either style. The melody follows the scale, and the chords follow the loop.
Which scales does rock use? Temperley's survey finds the major scale, the mixolydian with its flat seventh, the aeolian or natural minor, and the pentatonics. The flat seventh chord, B flat in C, is rock's signature: the blues's seventh from Part 38, made into a chord. Melodies often use the minor pentatonic over major chords, the blue third again. These are Part 12's modes, used within varied tonal and modal practices. The harmony serves the riff and the voice.
There is a difference in kind here. A progression, as in Part 18, goes somewhere: tension, then arrival at the tonic. A loop repeats, though listeners may still hear a tonic or goal within it; an arrangement can end it or fade it out. Rock prefers the plagal, four to one, and the flat seventh to the dominant's pull. So form comes from the arrangement: who plays, how loud, how dense. Chapter three turns to the loop at its most physical, the riff.
3RiffsFoundations3 min
Can a whole song stand on one short figure?
A riff is a short figure, usually one or two bars, repeated as the backbone of a song. It runs from the swing bands' riffs of Part 38 through rhythm and blues to rock and funk. It is often built on the minor pentatonic, the blues scale of Part 38. A riff is melody, rhythm and harmony at once, and with a strong one the chord changes can stop altogether. Here are two of ours, a rock riff and a funk riff.
First the rock riff, in E minor pentatonic, on the plucked-string guitar through a model amplifier, over a rock beat. Four times round.
The rock guitar's sound is an amplifier pushed past its limits. A clean amplifier is a straight line from input to output; driven hard, the line bends over, here modelled by a hyperbolic tangent. A sine wave through the bend comes out nearly square, and a square wave is rich in odd harmonics, Part 3's spectrum created by a curve. Distortion can make dense chords less clear, which helps explain the use of power chords; distorted guitar also uses thirds and fuller chords.
A question for your ears. Two chords strummed through the same model amplifier, turned up. One is a full major triad; the other has only a root, a fifth and an octave. Which is the full triad, the first or the second?
The first is the full triad, the muddier of the two. The curve does not only add harmonics to each note: it mixes the notes, adding tones at their sums and differences. Their alignment depends on tuning, register and the distortion curve. In this model the fifth is clearer than the major triad; that does not make all thirds unusable under distortion.
Now a funk riff: clean, short notes on the sixteenth-note grid, most of them off the beat, with bass and drums landing together on beat one of every bar. In funk, every instrument is a drum.
The riff has a lineage. Blues and rhythm and blues riffs became rock's, through Chuck Berry and then the British bands. Heavy metal built whole songs from riffs, often in power chords. And James Brown's funk, from 1965, made the whole band a set of interlocking riffs, Part 37's interlocking parts in a different idiom. Chapter four turns to the drums under them.
4The backbeat and grooveFoundations3 min
Why do the drums hit hardest on two and four?
The backbeat is the snare on beats two and four of every bar, loud. It came from gospel's handclaps and swing's hi-hat on two and four, through New Orleans rhythm and blues, and drummers such as Earl Palmer made it the ground of rock and roll in the 1950s. The kick takes one and three, the snare two and four: a dialogue, like the two surdos of Part 37's samba. Almost every style since keeps it, or bends it on purpose.
Here are five beats drawn on the sixteen-step grid of a drum machine. Rock: kick on one and three, snare on two and four, hi-hat in eighths. Funk: the snare adds ghost notes, the hat runs in sixteenths, and the kick dances around beat one. Disco: the kick on every beat, four on the floor, with the open hat on every off-beat. House keeps disco's kick and open hat on a drum machine. And a trap-style beat: the snare only on beat three, so the beat feels half as fast as the hats.
Hear two bars of each, in turn. Funk moved the weight. James Brown's band put it on the one, the first beat of the bar, everyone together, and syncopated everything else around it: guitar scratches, bass, horn stabs. His drummers, Clyde Stubblefield and John Jabo Starks, were later sampled endlessly, as chapter seven explains. Groove is many parts, each simple, locked together, like Part 37's ensembles. And measured, funk's sixteenths often swing slightly, as Part 38's eighths did.
Drum machines offered programmable sixteenth-note swing, building on human timing practices that already existed. Roger Linn's machines had a swing setting: how far through each pair of sixteenths the second one falls, fifty per cent for straight, more for swung. Hear our funk beat straight, then at sixty per cent.
Disco, in the 1970s, set four on the floor at about a hundred and twenty beats a minute, with the open hat on the off-beats. Giorgio Moroder's sequenced synthesizers, in 1977, pointed to dance music made by machines. Chicago house and Detroit techno, in the mid-1980s, were built on drum machines, by DJs, for clubs. The DJ became a performer, beat-matching two records into one continuous groove. Chapter six turns to the drum machines themselves.
5Hooks and prosodyFoundations3 min
What makes a line stick, and words sit right?
A hook is the part of a song built to be remembered, often the chorus and its title. It may be a melody, a rhythm, a sound such as a riff or a vocal effect, or a line of words. Repetition is the main tool: the chorus returns, and repeats within itself. The melodies are Part 14's again: a small range, mostly steps, and one leap that stands out. Speech stress can guide a setting, while deliberate departures are common expressive devices.
Prosody is how words sit on music. Spoken, beautiful day stresses BEAU and DAY. Set them on the strong positions of the bar, the tall bars here from Part 11's metrical grid, and every syllable agrees with the beat. Set them the other way, stresses on weak positions and weak syllables on strong ones, and the setting conflicts with this chosen speech-stress pattern. Dialect, duration and deliberate musical displacement can change the judgment. Monochord's measure is simply the share of syllables whose stress agrees with the strength of their position.
Songwriters check prosody by speaking the line over the beat. Good settings put stressed syllables and important words on strong beats and long notes. Deliberate mis-stress is a device: it makes a word stand out. In rap the words lead, and prosody becomes the rhythm itself, as chapter eight shows. The lab lets you score a line of your own.
Where does the title go? Usually it is the hook itself: the first or the last line of the chorus, repeated. In the AABA song it opened or closed each A section; in verse and chorus it anchors the chorus. Léveillé Gauvin found titles arriving earlier in later hits. A listener should be able to name the song after one chorus, because the title is the song's address.
Some hooks stick too well. Earworms are tunes that replay involuntarily in the mind. Kelly Jakubowski and colleagues found in 2017 that earworm tunes tend to be faster than comparable songs, with common melodic contours and some unusual intervals: a familiar shape with one surprise, Part 46's expectation at work. Chart success also depends on exposure, timing and luck, which no melody controls. Chapter six turns to the machine that made the beats.
6The drum machinePractice3 min
How do you build a drum from a circuit?
In 1980 Roland released the TR-808, an analog drum machine with a step sequencer. Its analog sounds differed from sampled acoustic drums; after discontinuation, affordable used units reached new producers. Cheap, it reached young producers, and became the sound of electro, hip hop, Miami bass, and much later trap. Marvin Gaye's Sexual Healing, in 1982, made it a sound of the charts. Each of its sounds is a small analog circuit, and we can build them from the same principles.
The 808's bass drum is a resonant network, a bridged-T filter, struck by an electrical pulse. A struck resonator rings at its own frequency and dies away, like Part 1's string reduced to a single mode: a damped sine. The strike also detunes it for a moment, so this simplified model's pitch falls from about eighty-three hertz toward fifty-two with a twenty-millisecond time constant, which the ear hears as punch. Monochord's model rings at hertz, measured, with a knob for the decay and a millisecond click from the pulse.
Hear the model kick at three settings of the decay knob, twice each. At the longest it is almost a bass note, which is exactly how hip hop and trap producers came to use it: tuned to the song's key, as its bass line.
With a long decay, the kick is a bass note, and producers tune it. Here the same struck resonator plays a bass line of ours, C, A flat, B flat, F, G, each note a retuned kick, under a clap and hats. In trap the eight-oh-eight is the bass.
The 808's hi-hats and cymbal come from six square-wave oscillators at fixed frequencies that bear no simple relation to one another: about two hundred and five, three hundred and four, three hundred and seventy, five hundred and twenty-three, five hundred and forty, and eight hundred hertz. Each square wave has odd harmonics, a third, a fifth and so on, so together they fill the upper spectrum with a dense, inharmonic cluster, like Part 9's cymbal; a high-pass filter keeps only the top, and an envelope makes it a closed hat or an open one.
And the whole kit in a half-time pattern of the kind trap producers use: the kick, a clap built from three bursts of noise and a tail, hi-hats in sixteenths, and a sine sub-bass under the kick.
Other machines followed. Roger Linn's LM-1, also from 1980, played samples of real drums, and the 909 of 1983 mixed both. The step sequencer made rhythm a grid of switches: Part 33's necklaces, as hardware. Today the 808's sounds live on as samples and software in every studio: a discontinued instrument that became a musical language. Chapter seven turns to beats made from records.
7The break and the samplerPractice2 min
How do you make a new beat out of an old record?
Kool Herc's early Bronx parties, including the celebrated 1973 event, helped establish break-centered DJ practice; the familiar two-copy looping technique developed across early hip-hop DJing. The break is the few bars where the band drops out and the drums play alone. Dancers danced the breaks and MCs talked over them, and hip hop began. A turntable became an instrument, and a beat could be made from a recording. From 1979 hip hop was recorded, and from the mid-1980s samplers did what the turntables had done.
Here is the sampler's method, on a two-bar drum break of our own, played by the acoustic kit models. First the break as it is. Then cut into sixteen slices, one per eighth note, and played back in a new order with a rest. Then the new beat played 1.2 times faster, by reading the samples faster, so the pitch rises too, as an early sampler did.
The samplers that made the sound were E-mu's SP-1200, of 1987, and Akai's MPC60, of 1988, each sampling and sequencing in one box. Their short sample times forced short loops, and producers sped records up to fit more in. They chopped, re-pitched and layered, a collage of other people's recordings. The most sampled breaks were those of funk and soul drummers, from chapter four. And the same idea runs through every digital audio workstation, Part 53's subject.
Then the law arrived. In 1991, in Grand Upright Music against Warner Brothers Records, an American court held that an uncleared sample infringed copyright. Sampling can involve separate rights in the recording and composition, with exceptions and permissions depending on jurisdiction and use, and in 2005, in Bridgeport against Dimension Films, the Sixth Circuit rejected a de minimis defense for sound-recording sampling; other courts have disagreed, so this is not a universal rule for every short sample. So sampling grew expensive, and producers turned to replaying parts, or to sounds of their own. This film samples only its own Variation 7; Part 60 returns to the law.
8FlowPractice3 min
How does a rapper make words into rhythm?
Rap is rhythmic speech over a beat, from Bronx parties in the 1970s to a major global commercial and cultural force. Its rappers speak of flow: how the syllables are placed against the beat, grouped, accented and rhymed. The music theorist Mitchell Ohriner's book Flow, from 2019, analyzes syllable timing and metrical placement; this lesson simplifies timing onto a sixteenth-note grid. Accented syllables fall into groups of two and three sixteenths, like Part 37's timelines. Here is a verse of ours, placed two ways.
Here is a four-line verse of ours, ending each line on the same rhyme. First placed on the beat: syllables mostly in eighth notes, accents on the beats, every line arriving on its rhyme at the end of the bar. Then placed in threes: syllables in sixteenths, accents every three sixteenths, cutting across the beat, the rhyme arriving early.
Monochord's flow measures. Both placements carry the same forty syllables, a beat, and rhyme on the same syllables. What differs is where they fall: per cent of syllables on a beat in the first, in the second; and the gaps between accents, fours and twos in the first, almost all threes in the second, the grouping Ohriner found in many rappers' most celebrated verses.
Rhyme in rap is also rhythm. End rhyme falls on the last syllable of each line, on or near the last beat. Internal rhyme falls inside the line, like time and line in our first line. Multisyllabic rhyme makes two or more syllables rhyme at once, chained across lines. And rhyme marks the meter: it tells the ear where the groups end. Our verse has five rhymes on one sound and two on another.
Writers on rap have described its flows. Adam Krims, in 2000, named styles such as sung, percussion-effusive and speech-effusive, and Kyle Adams, in 2009, analysed their metrical techniques. Rappers' notebooks and interviews describe writing to the beat, syllable by syllable. Rhyme inside the line, across lines and on several syllables at once grew denser over the decades. Flow is chapter five's prosody, made into the music itself. Chapter nine turns to the build and the drop.
9The build, the drop and the sidechainFoundations2 min
How does dance music make tension without chords?
Electronic dance music, from house and techno to the festival anthems of the 2010s, built its form from texture. A build-up adds layers, density and brightness; the drop releases the tension at once. The build's devices are a snare roll that doubles its speed, a rising sweep of noise, and a filter opening. It is tension without a dominant chord: rhythm, register and timbre do the work. Here is a build and drop of ours.
Four bars of build: a snare in quarters, then eighths, sixteenths and thirty-seconds; a noise sweep rising; a pad whose filter opens bar by bar. Then the drop: a drum-machine kick on every beat, a sine sub-bass between the kicks, and the pad pumping against the kick.
That pumping is the sidechain. A compressor turns a sound down when something is loud; keyed from a sidechain input, it listens to a different sound. Key the pad's compressor from the kick, and the pad ducks fourteen decibels at every kick and recovers exponentially: after about a fifth of a second it is still roughly five decibels down, and reaches within one decibel after about half a second. It began as a way to make room for the kick in a mix, and became an effect in its own right, the breathing sound of house and its descendants. Part 50 builds the compressor.
A question for your ears. A pad under a steady kick, twice: once left alone, once sidechained to the kick. Which version pumps, the first or the second?
The second. The pad dips at every kick and swells back between them: four breaths a bar.
The producer became the author: a track can be made in software by one person. Loudness rose through the 1990s and 2000s, the so-called loudness war, until streaming services began to normalise it. Part 57 measures loudness, Part 50 builds compressors, and Part 53 the digital workstation. The song is now shaped in the mix as much as in the writing. Chapter ten asks what sixty years of charts show.
10Frontier: sixty years of chartsResearch3 min
What can a corpus of hits tell us?
In 2015 Matthias Mauch and colleagues analysed about seventeen thousand songs from the American Hot 100, from 1960 to 2010. They analysed the audio itself, by machine, for chord types and timbre. Change came in bursts, which they called revolutions, around 1964, 1983 and 1991. The largest, in 1991, came with the rise of hip hop: fewer chord changes, more rhythm and timbre. Part 62 builds the chord and beat trackers such studies need.
Others agree in part. Joan Serrà and colleagues, in 2012, analysed the Million Song Dataset from 1955 to 2010, and reported narrower pitch transitions, more homogeneous timbre, and rising loudness over time. Hubert Léveillé Gauvin's shorter intros, earlier voices and earlier titles fit the same story. But caution: charts reflect sales, marketing and the way they are measured, not only taste. A corpus shows what changed; explaining why needs history and experiment.
The newest change is still under way. Several chart analyses report that hit songs have grown shorter since the 1990s. Some streaming services count plays after thirty seconds, with varied payment arrangements, and short-video platforms circulate excerpts of varying length, which can reward an excerpt that travels independently; establishing a general causal effect on songwriting requires more evidence. Whether the platforms cause the change, or only accelerate it, is open. The medium shapes the form: Part 21's lesson, for the twenty-first century.
And what do the charts leave out? Most corpus studies use the American or British charts: English-language, commercial, recorded music. Global streaming charts now mix Latin pop, K-pop, Afrobeats and Indian film music. A theory of the song built on one country's charts describes that country. Act Six's lesson applies: measure each music in its own terms. Part 47 asks what is shared across all of them.
A concrete version. Build a corpus of hits with release dates, platform histories and audio. Measure intro length, time to the hook, song length and repetition, year by year. Compare songs that spread on short-video platforms with those that did not, before and after. Do new platforms change how songs are written, or only which songs win? The answer separates the composer's choice from the market's selection.
Variation 40, recap and problemsAll tracks2 min
Every part ends by doing something to the Tune with what it built. First as a pop single of ours: a short intro, the voice entering after seconds; a verse made from the Tune's second phrase, sung low; and a chorus that makes its first phrase the hook, over one, five, six, four, with a second voice and a sidechained pad. Then as a beat that samples Variation 7, the Tune played by Part 7's strings: its recording cut into sixteen slices and re-sequenced over drum-machine voices.
Row forty of the ledger: seconds; the measurements are when the voice enters, and how the beat was cut.
What did we find? The thirty-two bar song gave way to verse and chorus, and loops became prominent alongside directional progressions. Riffs and the backbeat carry the music, from funk's one to four on the floor. Good prosody puts stresses on strong positions, and hooks repeat. An 808 is a struck resonator and six square waves. Sampling chops and re-sequences, and flow is syllables on a grid. The drop and the sidechain make tension without chords; and the hit single's intro shrank from twenty seconds to five.
Five problems. One to compute, one to prove, one for your ears, one to build, and a research problem, marked with a star. Solutions are in this part's notes. Pause here.
Where does this come back? In composing as search. In filters, dynamics and the compressor. In synthesis and the workstation. In mastering and loudness. And in the business of music.
And in practice. Songwriters put the hook early, and test the words by speaking them over the beat. Producers program drums on a sixteen-step grid and sidechain the pads. Rappers write to the beat, syllable by syllable. Rights checks distinguish recordings from compositions; replaying avoids using the original recording but does not automatically remove composition rights.
The books and papers this part follows. The full list, with notes, is in the README.
Where it goes next. Composing as search in Part 42; dynamics and the compressor in Part 50; synthesis in Parts 51 and 52; the workstation in Part 53; mastering and loudness in Part 57; the business of music in Part 60.
Key results
The part's results in one place, for revision.
Try it
Lab 40 · The song studio, computed
Build drum-machine voices and a beat of your own; hear the sidechain at different depths; and score a line's prosody and a verse's flow.
python -m videos.music.labs 40
needs numpy, scipy, matplotlib · download lab40.py ·
source on GitHubkick at decay 0.45 s: pitch at the strike / settled (Hz) 81 / 52.0
time for the kick to fall 60 dB (s) 3.11
hi-hat oscillators (Hz) 205.3, 304.4, 369.6, 522.7, 540, 800
your pattern: snare hits on 2 and 4 100%
your LINE: syllables whose stress agrees with the beat 100%
your VERSE: syllables a beat, on the beat, gaps between accents 2.00, 38%, [4, 3, 3]
ear problem: sidechain depth of each pad, in order (listen first) 18 dB, 12 dB, 12 dB, 6 dB
The kick is one damped mode whose pitch sags after the strike; the hat is six square waves' odd harmonics, high-passed; a sidechain dips by its depth and recovers in release times ln(depth); prosody and flow are positions on a sixteenth-note grid.
The code (81 lines; it asserts its own result)
"""Lab 40: the song studio, computed: drum-machine voices, step patterns with swing, the sidechain, chopping, and
the measures of prosody and flow."""
import numpy as np
from videos.coursekit import labs
from explainer.music.monochord import SR, Clip, concat, mix
from explainer.music.monochord import song as S
from videos.music.music40 import compute as C
TITLE = "The song studio, computed"
GOAL = ("Build drum-machine voices and a beat of your own; hear the sidechain at different depths; and score a line's "
"prosody and a verse's flow.")
TASKS = [
"Edit PATTERN (sixteen steps a bar) and SWING. What makes it feel like rock, funk or house?",
"Change DECAY and the kick's pitch. At what decay does the kick become a bass note?",
"Write your own LINE (syllable, stressed, sixteenth) and VERSE, and score them.",
]
PATTERN = {"kick": [0, 6, 10], "snare": [4, 12], "hat": list(range(0, 16, 2)), "open": [14]}
SWING = 0.55
BPM = 104
DECAY = 0.45
LINE = [("HAP", True, 0), ("py", False, 2), ("BIRTH", True, 4), ("day", False, 6)]
VERSE = [("I", False, 0, None), ("count", True, 2, None), ("the", False, 3, None), ("time", True, 6, "A"), ("in", False, 8, None),
("threes", True, 9, None), ("and", False, 11, None), ("rhyme", True, 12, "A")]
def run(seed=0):
rng = np.random.default_rng(seed)
lab = labs.Lab()
k = S.kick808(52.0, DECAY)
lab.row(f"kick at decay {DECAY} s: pitch at the strike / settled (Hz)", f"{S.measured_pitch(k, 0.0, 0.01):.0f} / {S.measured_pitch(k):.1f}")
lab.row("time for the kick to fall 60 dB (s)", f"{DECAY * np.log(1000):.2f}")
lab.row("hi-hat oscillators (Hz)", ", ".join(f"{f:g}" for f in S.HAT_HZ))
bb = S.backbeat_share({"snare": PATTERN["snare"]}) if PATTERN["snare"] else 0.0
lab.row("your pattern: snare hits on 2 and 4", f"{bb:.0%}")
pr = S.prosody(LINE)
assert 0.0 <= pr["agree"] <= 1.0
lab.row("your LINE: syllables whose stress agrees with the beat", f"{pr['agree']:.0%}")
fl = S.flow(VERSE, 1)
lab.row("your VERSE: syllables a beat, on the beat, gaps between accents", f"{fl['per_beat']:.2f}, {fl['on_beat']:.0%}, {fl['gaps']}")
# the pattern, with swing, two bars, drum-machine voices
step = 60.0 / BPM / 4
parts = []
for bar in range(2):
for kind, ons in PATTERN.items():
for s in ons:
pos = (2 * (s // 2) + (0 if s % 2 == 0 else 2 * SWING)) * step
snd = {"kick": k, "snare": S.clap808(), "hat": S.hat808(), "open": S.hat808(True)}[kind]
parts.append((Clip(snd, SR), bar * 16 * step + pos, {"kick": -2.0, "snare": -6.0, "hat": -12.0, "open": -12.0}[kind]))
beat = Clip(mix(parts, duration=32 * step + 0.8).y, SR).at_level(-20.0)
# ear problem: a pad under a kick, at random sidechain depths
depths, clips = [], []
b = 60.0 / 124
for i in range(4):
dep = float(rng.choice([0.0, 6.0, 12.0, 18.0]))
line = np.concatenate([C.pad([9, 0, 4], 4 * b, bright=4000), C.pad([5, 9, 0], 4 * b, bright=4000)])
hits = [j * b for j in range(8)]
y, g = S.sidechain(line, hits, depth_db=dep) if dep else (line, None)
ps = [(Clip(y, SR), 0.0, -6.0)] + [(Clip(S.kick808(52.0, 0.3), SR), h, -4.0) for h in hits]
clips.append(Clip(mix(ps, duration=8 * b + 0.6).y, SR).at_level(-20.0))
depths.append(f"{dep:g} dB")
lab.audio = concat([beat] + clips, gap=1.0)
lab.row("ear problem: sidechain depth of each pad, in order (listen first)", ", ".join(depths))
fig, (ax1, ax2) = labs.figure(2)
t = np.arange(len(k)) / SR
ax1.plot(t[: int(0.6 * SR)], k[: int(0.6 * SR)], color=labs.GOLD, lw=0.6)
ax1.set_xlabel("seconds")
ax1.set_title(f"the kick: a struck resonator, decay {DECAY} s")
f, spec = S.hat_spectrum()
ax2.semilogy(f[f < 12000], spec[f < 12000] + 1e-6, color="C0", lw=0.6)
ax2.set_xlabel("Hz")
ax2.set_title("six square waves: the hi-hat's raw spectrum")
lab.fig = fig
lab.note = ("The kick is one damped mode whose pitch sags after the strike; the hat is six square waves' odd harmonics, "
"high-passed; a sidechain dips by its depth and recovers in release times ln(depth); prosody and flow are "
"positions on a sixteenth-note grid.")
return lab
Now change it
- Edit PATTERN (sixteen steps a bar) and SWING. What makes it feel like rock, funk or house?
- Change DECAY and the kick's pitch. At what decay does the kick become a bass note?
- Write your own LINE (syllable, stressed, sixteenth) and VERSE, and score them.
Problems, with solutions
Try each problem before opening its solution.
-
Compute. For the kick model, how long until it falls 60 dB at a decay setting of 0.45 s?
Solution
The amplitude falls as e^(−t/τ); 60 dB is a factor of 1000, so t = τ ln 1000 = 0.45 × 6.91 ≈ 3.1 s. The lab prints it for any decay.
-
Prove. Prove that a sidechain ducking D dB with release time τ is back within 1 dB after τ ln D seconds.
Solution
After the attack the gain in decibels is −D e^(−t/τ). It is within 1 dB of full level when D e^(−t/τ) ≤ 1, that is when t ≥ τ ln D. For 14 dB and τ = 0.18 s, 0.18 × ln 14 ≈ 0.48 s.
-
Ear. The lab plays pads under a kick, some sidechained; say which, and how deep.
Solution
The lab prints the depths. At 6 dB the pump is a gentle breathing; at 12 to 18 dB the pad nearly disappears on each kick and swells back between them.
-
Build. Write a verse of your own on the sixteenth grid and measure its flow.
Where to look. List (syllable, accented, sixteenth, rhyme class) as in
compute.VERSE_RAP_TEXTandrap_layout, then callsong.flow: compare the share on the beat and the gaps between accents for two placements of the same words. -
★ Do new platforms change how songs are written, or only which songs win?
Where the frontier is. Build a corpus of hits with release dates, platform histories and audio; measure intro length, time to the hook, song length and repetition year by year; compare songs that spread on short-video platforms with those that did not, before and after; separate the composer's choice from the market's selection.
Notes and sources
Sources
- D. Temperley, The Musical Language of Rock (2018) and "The melodic-harmonic 'divorce' in rock", Popular Music (2007); J. Covach and A. Flory, What's That Sound? (5th ed., 2018).
- H. Léveillé Gauvin, "Drawing listener attention in popular music: testing five musical features arising from the theory of attention economy", Musicae Scientiae (2018).
- M. Mauch, R. M. MacCallum, M. Levy and A. M. Leroi, "The evolution of popular music: USA 1960–2010", Royal Society Open Science (2015); J. Serrà, Á. Corral, M. Boguñá, M. Haro and J. L. Arcos, "Measuring the evolution of contemporary western popular music", Scientific Reports (2012).
- M. Ohriner, Flow: The Rhythmic Voice in Rap Music (2019); A. Krims, Rap Music and the Poetics of Identity (2000); K. Adams, "On the metrical techniques of flow in rap music", Music Theory Online (2009).
- K. Jakubowski, S. Finkel, L. Stewart and D. Müllensiefen, "Dissecting an earworm: melodic features and song popularity predict involuntary musical imagery", Psychology of Aesthetics, Creativity, and the Arts (2017).
- J. Seabrook, The Song Machine (2015); A. Danielsen, Presence and Pleasure: The Funk Grooves of James Brown and Parliament (2006).
- Part 9 for membranes; Part 21 for form; Part 37 for interlocking; Part 38 for swing and the blues.
- W. Everett, The Foundations of Rock (2009); A. F. Moore, Song Means: Analysing and Interpreting Recorded Popular Song (2012); R. Middleton, Studying Popular Music (1990).
About this partfrom its README
Part 40 of a sixty-eight-part course in music (see the series plan and
the syllabus), the last part of Act VI. The average introduction of a hit single shrank from over
twenty seconds in the mid-1980s to about five by the mid-2010s, and on streaming services a play counts only after about
thirty seconds. This part follows the popular song from the thirty-two-bar standard to the loop and the drop, and finds
its form shaped by each technology that sold it: forms and loops, riffs and distortion, the backbeat and groove, hooks and
prosody, the drum machine (an 808 built from first principles), the break and the sampler, rap's flow, the build, the
drop and the sidechain, and what corpus studies of the charts show. The tools are Monochord's
(explainer/music/monochord/song.py). Every song, riff, beat and verse heard is ours; published chart statistics are
quoted, not recomputed (the chart data's licences were not cleared for redistribution). Published findings are the ones
listed under Sources.
- Twenty seconds to five. An ear question (the same song of ours with two intros: when does the voice enter?); Léveillé Gauvin's 303 singles and the thirty-second rule; the plan.
- 1. From AABA to verse and chorus. Tin Pan Alley's 32-bar refrain; an AABA song of ours, heard; verse, pre-chorus and chorus, heard; why the change; song factories (the Brill Building, Motown, Max Martin).
- 2. Loops and rock harmony. Three loops (I–V–vi–IV, ♭VII–IV–I, i–♭VI–♭III–♭VII); the three heard; Temperley's melodic-harmonic divorce (4 of our hook's 12 on-beat notes outside the chord); rock's scales; progressions and loops.
- 3. Riffs. The riff; a rock riff of ours, heard; distortion as a curve; an ear question (triad or power chord, through distortion?); a funk riff of ours, heard; a lineage.
- 4. The backbeat and groove. The backbeat; five beats on a sixteen-step grid; the five heard; the one; swing on the sixteenths, heard straight and at 60%; disco to house.
- 5. Hooks and prosody. Hooks; prosody measured (“beautiful day” set two ways: 100% and 25% of syllables agreeing with the beat); setting words; the title; earworms.
- 6. The drum machine. The TR-808; its kick as a struck resonator (83 Hz at the strike, 52 Hz settled); three decays, heard; the kick tuned as a bass line, heard; the hats from six square-wave oscillators; the whole kit, heard; after the 808.
- 7. The break and the sampler. Kool Herc's breaks; a break of ours, chopped into sixteen, re-sequenced and sped up, heard; samplers; the law (Grand Upright, Bridgeport).
- 8. Flow. Rap and flow; a verse of ours placed on the beat and in threes; both heard; measured (40 syllables each, 2.5 a beat; on the beat 40% against 30%; accents mostly fours and twos against almost all threes); rhyme; the writers.
- 9. The build, the drop and the sidechain. The drop; a build and drop of ours, heard; the sidechain (14 dB, recovering to within 1 dB in about half a second); an ear question (which pad pumps?); the producer's song.
- 10. Frontier: sixty years of charts. Mauch and colleagues (about 17,000 Hot 100 songs, three revolutions); Serrà and colleagues; platforms; what the charts leave out; ★ research problem: do new platforms change how songs are written, or only which songs win?
- Variation 40, recap and problems. The Tune as a pop single of ours (the voice entering after 4.6 s; its second phrase as the verse, its first as the hook, a sidechained pad), then a beat built from sixteen slices of Variation 7's recording with four rests; the ledger; what we found; five problems; where it comes back; in practice; references; Part 41.
What is computed and built
python -m videos.music.music40.compute (under a minute) fills .cache/music40/.
| Item | What it computes | Checked against |
|---|---|---|
hook, forms |
two intros; AABA and verse–chorus songs of ours | the intro lengths (tests) |
loops, riffs, power |
three loops; the divorce count; two riffs; triad against power chord | hand counts (tests) |
beats, swing16 |
five step patterns; straight and swung sixteenths | the backbeat share (tests) |
eight, tuned |
the struck-resonator kick, its pitch and decay; the six-square hat; a tuned kick bass | measured pitch and decay (tests) |
breaks |
a break chopped, re-sequenced, sped up | the slicing (tests) |
flow |
a verse placed two ways; prosody | hand counts (tests) |
drop |
a build and drop; the sidechain's gain curve | ducking depth and recovery (tests) |
tune, variation |
Variation 40 | — |
Monochord's tools are held in tests/music/test_song.py; this part's claims and clips in tests/music/test_music40.py.
Sounds. Guitar and bass are Part 35's retuned plucked string (the guitar through a model amplifier: soft clipping and a
speaker's band limit); the acoustic kit is Part 9's membrane with filtered noise; the drum-machine voices are built from
their circuits' principles (a struck resonator; noise bursts; six square waves); pads and sub-bass are additive; the
voice is Part 17's model, which sings vowels, not words (clips with it are labelled synthesized). Variation 40 samples
the series' own Variation 7. There are no other recordings.
What the models are, and are not. The 808 voices follow the circuits' principles, not their component values; the pitch sag is a designed envelope. The amplifier is a tanh curve and a band-pass, not a model of any amplifier. The voice cannot speak words, so the rap verse is heard as rhythm and contour only. The patterns, songs, riffs and verse are ours, written to show the features named. Chart findings are quoted from the cited studies.
Notes
Chart trends describe the cited US samples, not all popular music or proof that streaming caused shorter intros. A stream-count threshold does not define a universal payment rule. Loops can retain tonic goals, and non-chord tones require contextual analysis. Distortion depends on tuning, register and the transfer curve; full chords remain usable. The 808 voices are simplified models, with exponential time constants rather than fixed settling deadlines. Prosody and flow use chosen grid and stress proxies, not universal judgments. Recording and composition rights differ; sampling exceptions and court holdings vary by jurisdiction. Replaying does not automatically remove composition rights.
Companion material in this repository
The syllabus's plan for this partfrom SYLLABUS.md, the plan of record
- Hook: an ear question (when does the voice enter?); the thirty-second rule; the plan.
- From AABA to verse and chorus: Tin Pan Alley; an AABA song heard; verse, pre-chorus and chorus heard; why the change; song factories.
- Loops and rock harmony: three loops; the three heard; the melodic-harmonic divorce counted; rock's scales; progressions and loops.
- Riffs: the riff; a rock riff heard; distortion as a curve; an ear question (triad or power chord?); a funk riff heard; a lineage.
- The backbeat and groove: the backbeat; five beats on the grid; the five heard; the one; sixteenth swing heard; disco to house.
- Hooks and prosody: hooks; prosody measured; setting words; the title; earworms.
- The drum machine: the 808; the kick as a struck resonator; three decays heard; the kick as a bass heard; six-square hats; the kit heard; after the 808.
- The break and the sampler: Kool Herc; a break chopped and re-sequenced heard; samplers; the law.
- Flow: rap and flow; a verse placed two ways; both heard; measured; rhyme; the writers.
- The build, the drop and the sidechain: the drop; a build and drop heard; the sidechain; an ear question (which pumps?); the producer's song.
- Frontier: Mauch and colleagues; Serrà and colleagues; platforms; what the charts leave out; the research problem.
- Variation 40: the Tune as a pop single, then a beat that samples Variation 7. Outro: problems, payoffs.
Covers: AABA and verse-chorus; loops and rock harmony; riffs; the backbeat and groove; hooks and prosody;
funk; disco to house; the breakbeat, sampling and the drum machine; flow; the drop and the sidechain; corpus
studies of sixty years of charts.
Built and computed: monochord/song.py: drum-machine voices from their circuits' principles (a struck-resonator
kick sagging from 81 to 52 Hz; six square waves at 205.3–800 Hz for the hats; noise claps); step patterns and
sixteenth-note swing; a sidechain (back within 1 dB after τ ln D); chopping and re-sequencing; prosody (the share of
syllables whose stress matches the beat) and a flow analyzer on an original verse (after Ohriner). Chart statistics
are quoted from the published studies rather than recomputed: the licences of the open chart annotations were not
cleared for redistribution.
Variation 40: the Tune as a pop single (the voice entering after 4.6 s), and as a beat that samples Variation 7
(sixteen slices, four rests).
Frontier: corpus studies; how short-video platforms may be changing form (open).
Rights: statistics quoted, skeletons, and original songs (§2.4); the only sample is the series' own.
Reading: Temperley, The Musical Language of Rock; Ohriner, Flow; Serrà et al. (2012); Mauch et al. (2015).
Build the film
python -m videos.music.music40.compute # the part's numbers, into .cache/music40
python tools/build.py music40 # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py music40 Hook # one chapter, silent, with a contact sheet
Scenes: videos/music/music40. Setup: see the course page. Source of these notes: the README and the scenes' narration.
Build it
python -m videos.music.music40.compute # numbers and sounds (under a minute)
EXPLAINER_TTS=silent python tools/build.py music40 -q l --fps 15 # a silent-narration preview, with the sounds
python tools/qa_sound.py music40 --sync # the sound gates
python tools/dead_air.py renders/music40_480p.mp4 --sound music40 # no empty screen; no sound over a still one
python tools/lecture_length.py music40 # 30 to 60 minutes, listening included
python tools/build.py music40 # 1080p30, narrated
python -m pytest -q tests/music # Monochord against its references; this part's claims and clips
python -m videos.music.labs 40 # the lab (writes a figure and a short WAV)