0 → 1 sound · signal · number

Understanding
Music

A breakdown of music, from frequency to PCM.

amber = pressure / time domain cyan = frequency domain vermilion = your controls
module 01intro

Play with the keys.

One octave digital piano with a sawtooth-like waveform. Every key plays a note and shows both its solfège and letter name. The knob sets the amplitude.

amplitude
0.50-6.0 dB
note
·
octave
·
pitch class
·
frequency
·

Just play and look at the numbers for now.

module 02what is sound?

What, how and where is sound?

Every sound source does the same job: it displaces the air next to it. Most often that is a vibrating surface (a string, a drum head, a speaker cone, vocal folds), but it can also be a fluctuating jet of air (a flute, a whistle) or a sudden expansion (a spark, thunder). The displacement compresses the air locally, and that compression travels outward as a pressure wave at about 343 m/s. What reaches your ear is air pressure changing over time.

stringvibrating surface
drumvibrating surface
glassvibrating surface
whistleair jet
voiceair jet
thundersudden expansion
earpressure → vibration

All six displace the air, in three different ways. The ear receives all of them the same way: pressure changing over time.

a real string · tuned to grab the string, pull it sideways, let go
slow motion ×50·
pull distance
0.0 mm
amplitude
0.00
dBFS
·
frequency · set by the peg
130.81 Hz
note · set by the peg
C3 / Do3
or preset strengths:
Amplitude: what pulling harder changes

Pull the string above harder and these four numbers change. Not one of the note or frequency boxes moves. Amplitude lives on its own axis, and this is where sound turns into digits.

linear
0.00
dBFS
·
int16 peak
0
perceived
·
Frequency: what the peg changes

Turn the peg and all eight of these change together, because they are all the same one number rewritten. Pulling harder touches none of them.

note
C3
solfège
Do3
midi
48
octave
3
pitch class
0
frequency
130.81 Hz
period
7.65 ms
wavelength λ
262 cm
sub bass
bass
low mid
mid
upper mid
treble
  • Pull hard: the sound gets louder. The amplitude rises and you literally see the string swing further, the thickness of that blurred band is the amplitude.
  • But the number of trips per second never changes. The counter on screen ticks at the same rate whether you pull gently or hard.
  • A hard pull does make the string move faster in metres per second, but it does not make more trips. It covers more distance in the same time, that's all.
  • Why: the restoring force is proportional to the displacement (F = −kx). Pull twice as far and the force doubles too → twice the distance at twice the speed → same duration.
f = (1 / 2L) · √(T / μ) // L = length · T = tension · μ = mass per unit length
  • Those three things set the frequency. Pluck strength does not appear in the formula.
  • So this string always plays whatever it is tuned to, however hard you pull it. To change the note you have to turn the peg (tension), press a fret (length), or swap the string (mass). The selector above is that peg.
one honest caveat F = −kx is an approximation that holds for small displacements. Pull really hard and the string physically stretches, tension T rises, and the pitch goes slightly sharp for the first instant before settling as the sound decays. That is exactly why you always tune at normal playing strength.
The core idea: a note name is the remainder of a calculation

A note name and an octave are not two separate pieces of information. They are parts of one calculation:

1Take the logarithm of the frequency log₂, because the ear hears ratios. The result: how many octaves away we are.
2Multiply by 12 and round Because the octave is split into 12 equal steps. The integer that comes out is the MIDI number.
3Divide by 12: quotient and remainder The quotient is the octave. The remainder is the note name (pitch class).
m = 69 + 12·log₂(261.63 / 440) = 60
Electric guitar: every link of the chain

On an electric guitar every stage of that transfer is separately visible:

  • String: vibrates back and forth a fixed number of times per second.
  • Pickup: a magnet and coil convert that motion into voltage by electromagnetic induction.
  • Amplifier: raises the voltage and drives the speaker coil.
  • Cone: moves air, producing compression and rarefaction.
  • Air: the pressure wave travels at about 343 m/s and moves your eardrum at the same rate.

Every stage carries the same two quantities: rate (repetitions per second) and magnitude (size of the deviation). The medium changes; the two quantities do not.

the live chainstring → pickup → amp → cone → air · all on the same beat
pressure / time · what your ear receives·
4.0 Hz*
0.60

* Slowed to 1–14 cycles per second so you can see it. The C4 you pressed in module 01 does this 261.63 times every second.

module 03sound to note

What is a note? A frequency? A wave?

A note is a name given to a sound with a definite fundamental frequency. It is a label attached to a steady periodic wave.

Does a note have only one frequency?

Almost never. A note usually contains more than one frequency, and which ones it contains depends entirely on the waveform it is played with. Its pitch comes from the fundamental and does not change with the waveform; what does change is everything above the fundamental.

waveform · timesine
spectrum · frequency
where these shapes come from: click an instrument to hear a chord with its own envelope
waveharmonics presentamplitude lawcharacter
sinef only1bare, hollow
trianglef, 3f, 5f, 7f … odd only1/n²soft, flute-like
squaref, 3f, 5f, 7f … odd only1/nhollow, woody, clarinet
sawtoothf, 2f, 3f, 4f … all of them1/nrich, buzzy, bowed string

Only sawtooth contains the complete harmonic series. That is exactly what a string produces, which is why every key on this page uses a spectrum close to sawtooth.

tuning forksine The one real object that makes an almost pure sine. Built to be exactly 440 Hz.
flute≈ triangle Played softly, its upper harmonics stay very weak. 1/n² dies away fast.
clarinet≈ square A cylindrical tube closed at one end suppresses the even multiples: odd harmonics only.
violin≈ sawtooth The bow grips the string, drags it, the string slips back. That stick-slip cycle gives the full harmonic series.
in electronics The simplest waves a circuit can make: a charging capacitor gives a sawtooth, a flipping comparator a square. In instruments the tube or the string sets the shape.
So where is a single oscillator actually used, and why does it still exist?
usewhich wavewhy
Tuning reference, test tonesineNo harmonics wanted; a single frequency is the point
Hearing tests (audiometry)sineThreshold measured at one exact frequency
Room and speaker measurementsine sweepEach frequency is examined one at a time
EDM sub basssineAround 40 Hz harmonics only make mud
LFOanyNot heard; it modulates a parameter
Analog synth (subtractive)saw / squareOne rich oscillator plus a filter gives a moving spectrum
8-bit game musicsquare, triangleThe NES chip had 2 square, 1 triangle and 1 noise channel

Why it survives: cost. Additive needs one oscillator per harmonic per note. A 32-voice instrument with 6 harmonics means 192 oscillators. Subtractive does the same job with 32 oscillators and 32 filters.

A third route, FM: two oscillators, one modulating the other's frequency. Lower the modulation depth over time and the spectrum thins out over time. The Yamaha DX7 electric piano is exactly this, made from just two oscillators.

module 04note to harmony

What is harmony, and how do you build one?

A harmony is the relationship formed by two or more notes sounding at the same time. What decides that relationship is not the difference between their frequencies but their ratio: the simpler the ratio, the more their harmonics overlap, and the more fused they sound.

Understand the multipliers, and the Hz they produce

Play notes one after another, or together with chord mode. Hear how they complement each other. Look at the number you multiply by to get from one note to the next; try to work out how you reach F from C. In a moment we will build harmony out of exactly these frequency multipliers.

what the keys play: |
amplitude 0.50−6.0 dB
waveform · 12 ms·
Do
0

How do you get one note from another? Where do these multipliers come from?

A ratio is one frequency divided by another.

pairfrequenciesquotientits name
C4 → C5523.25 / 261.632.000octave▶
C4 → G4392.00 / 261.631.498 ≈ 3/2fifth▶
C4 → F4349.23 / 261.631.335 ≈ 4/3fourth▶
C4 → E4329.63 / 261.631.260 ≈ 5/4major third▶

Click a row: the keyboard above plays the first note, then the second.

  • Octave is the name of the interval whose frequency ratio is 2.
  • Fifth is the name of the interval whose ratio is 1.5.
fifth · ×1.5 · hear the pairs

Ratio 3:2. It is the 3rd harmonic of the lower note, folded down into the octave. Their harmonics overlap heavily, so the pair fuses.

major third · ×1.25 · hear the pairs

Ratio 5:4. This time it is the 5th harmonic folded in. There is less overlap than in the fifth, so it fuses less strongly but sounds brighter.

Where did the NUMBERS in these multipliers come from? 3/2, 4/3, who decided these ratios?

When a string vibrates at f it does not vibrate at f alone. It vibrates at 2f, 3f, 4f, 5f… at the same time. These are its harmonics, and they are not a choice: they are the physics of the string.

When you strike C4, what is actually in the air is:
261.63 + 523.25 + 784.9 + 1046.5 + 1308.1 + … Hz, summed.
One complex wave. And we call it C4 because that is the lowest frequency in it.

The ear pins the pitch label onto the bottom of that stack. That is why the lowest one is called the fundamental.

strike it and watchthe rows never move · only the bars melt
frequencynoteharmonicstrength (amplitude)
t = 0.00 s
notice The decay happens on the amplitude axis. Nothing moves on the frequency axis, the two columns on the left never change. The sounds get quieter, they do not move. The pitch is C4 from the first instant to the last.
So why seven notes? Is that cultural?

Stacking the 3/2 ratio just means multiplying by 1.5 over and over. Start at C: 261.63 → 392 (G) → 588 (D) → 883 (A) → 1324 (E) → 1987 (B). Five multiplications, six notes. Divide once as well: 174 (F). That is seven. Fold them all into one octave and five large and two small steps appear on their own: T T S T T T S. Nobody decided E–F should be close; it is not a design, it is an arithmetic remainder.

What is universal: the harmonic series. Every string has 2f, 3f, 4f, everywhere. That is why the octave (2/1) and the fifth (3/2) are foundational in nearly every known musical culture.

What is cultural: where you cut the chain, and how you divide what is left.

traditiondivisionnote
China (三分损益)3/2 chain, cut at 5Same method, different cut → pentatonic
Western3/2 chain, cut at 7, then equalised to 1212-TET
Turkish art musicWhole tone split into 9 commas, octave into 53Bakiye, küçük and büyük mücennep are distinct, there is no single "semitone"
ArabicOctave into 24 (quarter tones)Maqam system
Indian22 shrutiFixed ratios, not equally spaced
Indonesia (gamelan)slendro / pelog, 5 or 7Not derived from a fifth chain, it fits the instruments' inharmonic spectrum

This is why Hicaz cannot be played on a piano: those intervals simply are not on the 12-step grid. The perde Segâh is not "somewhere between E♭ and E" either, it is a pitch in its own right. 12-TET is not a law of nature; it is an engineering trade that gave up purity in order to modulate from any key to any other.

And why 440 Hz?

There is no scientific reason for it. The ratios come from physics, but where the whole chain gets pinned down is pure convention.

place / periodA4
Baroque (France)~392 Hz
Mozart's Vienna~421 Hz
Verdi's preference432 Hz
19th-c. Northern European orchestras450–460 Hz
ISO 16 (1955)440 Hz

Through the 19th century orchestras kept raising the pitch to sound brighter. Singers revolted, standardisation followed; something between 435 and 445 had to be picked, and 440 was picked. (The claims about 432 Hz being "the frequency of the universe" have no physical basis.)

module 05harmony and timbre

Timbre, chords, and harmonics. Paving our way to Fourier.

  • So far: what sound is, how a frequency becomes a note, and how notes form harmony.
  • A real note is not one frequency but a stack of harmonics. Which ones are in the stack and how strong each one is is the timbre of the note: what separates a violin from a flute.
  • When two notes sound together their stacks overlap. The more they overlap, the more the ear fuses them, and the more consonant the harmony sounds.
  • So both are made of the same material: harmonics inside one note, and harmonics shared between notes.

Fourier's idea comes from here too: every periodic wave is a sum of sines. Below you first build a note out of its harmonics, then a chord out of notes.

frequency→ note→ harmonics→ timbre→ harmony
1 · one single frequency
261.5 Hz
C4 +0 cent

One single frequency, with nothing else inside it. The note name is just a label stuck onto that frequency.

1 · build one note from its harmonicsmix 8 harmonics · fundamental = C4, 261.63 Hz
resulting waveform·
presets:

With only slider 1 up you hear a pure sine, which sounds like no instrument at all. Add harmonics and the sound comes alive. The presets are the same waveforms as in module 03, this time assembled one harmonic at a time.

2 · build a chord from notesput the pedal down to build a chord; without it keys just sound one at a time
palette: right-click a key in your set: colour wheel
chord
·
notes
·
intervals from root
·
consonance (0–1)
·
preset chords:
the red box on the map Timbre is not the same number rewritten, the way most terms on this page are. It is not one number but a list: how much at 261.63 Hz, how much at 523.25, how much at 784.9. It carries genuinely new information, which is why the map marks it in red.
the bridge In this module you added harmonics: a note with the sliders, a chord with the keys. An FFT does the exact opposite, looking at a wave and reporting how much of every frequency is in it. In module 09 we take the same sounds apart.
module 06frequency

Deep dive to frequency.

  • Frequency is how many times per second the sound wave repeats. Its unit is the hertz (Hz).
  • Its period is the inverse: T = 1 / f. Its wavelength is λ = 343 / f.
  • Human hearing covers roughly 20 Hz to 20,000 Hz, which is about 10 octaves.
  • We cut that range into octaves, then cut each octave into steps. Different cultures cut it differently: Western music into 12, Arabic music into 24, Turkish art music into 53.
  • In the Western system, 1 octave = 6 whole tones = 12 semitones.
  • An octave is the same note, multiplied: ×2 up, ÷2 down. 100 Hz → 200 Hz feels like the same jump as 200 Hz → 400 Hz.
  • One agreed reference: A4 (La) = 440 Hz. Every other note is derived from it.
  • Our C4 included: 440 × 2^(−9/12) = 261.63 Hz, nine semitones below A4.
the reference is arbitrary, the ratios are not The number 440 is a convention; it could have been 432 or 415. Changing the reference shifts every note together but leaves every ratio between them untouched, because a semitone is still ×2^(1/12). What differs between cultures is not the reference but the ratios themselves: in a 53-comma system the step is ×2^(1/53), and those intervals simply do not exist on a 12-step grid.
f = 440 · 2^((m − 69) / 12) // m = MIDI number · every semitone is one multiplication by 2^(1/12)
the same +100 Hz, two different results

A · 100 → 200 Hz

×2.00  ·  1200 cents  ·  a full octave

B · 1000 → 1100 Hz

×1.10  ·  165 cents  ·  less than two semitones

A difference in Hz tells you nothing musically. The ratio does.

the C laddereach step is ×2 · all the same note name
note ruler

Their MIDI numbers: 24, 36, 48, 60, 72, 84, 96, 108. All multiples of 12. Anything with m mod 12 = 0 is a C, a note name really is just a remainder.

interval, the ratio between two notesC4 held fixed · simple ratios sound good
intervalfrom C4semitones12-TET ratiojust ratiodeviation

12-TET detunes every interval a little; in exchange you can modulate anywhere. The fifth is off by 2 cents and nobody hears it. The major third is off by 14 cents and trained ears do. Why simple ratios sound good is answered in module 05: their harmonics overlap.

Notes are not evenly spaced on the frequency spectrum

the same 8 notes, two rulers

On a keyboard the notes look evenly spaced. In Hz they are not.

  • C4 → D4 is one whole tone and 32 Hz.
  • A4 → B4 is also one whole tone, but 54 Hz.
  • Same musical distance, different Hz, because distance here is multiplication, not addition: both are ×1.1225.

So you can lay the same 8 notes on a line in two different ways:

  • The Hz ruler, each note sits at its true frequency. They crowd to the left and the gaps widen to the right.
  • The note ruler, each note sits at its musical distance. Evenly spaced. This is exactly what a keyboard does.
·
click a note to hear it

Look at the two numbers on the bottom row. The red one (the Hz gap) changes at every step: 32, 36, 20, 43, 48, 54, 29. The cyan one (the ratio) takes only two values: whole tone ×1.1225, semitone ×1.0595. The number your ear follows is the cyan one.

guitar fretboard · standard tuningtap a fret

A keyboard hides two things that are visible here:

  • The same note exists in more than one place. C4 sits on three different strings. A note is a number, not a position.
  • Equal musical steps are not equal distances. Fret spacing shrinks as you go up: x_n = L · (1 − 2^(−n/12)).
note
·
midi
·
frequency
·
positions
·
  • Every fret is exactly one semitone, that is ×1.05946.
  • The 12th fret is the exact midpoint of the string: half the length, double the frequency, one octave.
module 07intro to digital sound

PCM. How do we record and save sound digitally?

PCM, or Pulse Code Modulation, is the standard way of storing sound digitally. The continuous pressure curve is measured at regular intervals, each measurement is rounded to a fixed number of steps, and the resulting integers are written down in order. The result is an uncompressed array of numbers, and that is what sits inside a WAV file.

  • 1 · Sampling, slicing the time axis. How many measurements per second?
  • 2 · Quantization, slicing the amplitude axis. How many steps do we round each measurement to?

The result: an uncompressed, raw array of integers. That is literally what's inside a WAV file.

7.1 · samplingthe dots are the only thing stored · the curve is just reference
continuous wave + samples·
24
·

Press play and move the slider: the sound does not stop, the resolution changes live. The source button switches between the continuous wave and the wave rebuilt from the samples. Reduce the dot count and past a point the samples no longer carry the shape; that information is gone for good.

7.2 · nyquist and aliasingactually audible, keep sound on
signal sampled at 8 kHz·
nyquist rule To capture a signal correctly, the sample rate must be at least twice the highest frequency present.
  • That's why 44,100 Hz was chosen: slightly more than twice the 20 kHz hearing limit.
  • Exceed the limit and the frequency doesn't vanish, it comes back as the wrong frequency. That's aliasing.
  • That's why every ADC has an anti-alias low-pass filter in front of it.
1200 Hz
nyquist limit
4000 Hz
what you'll hear
1200 Hz
status
clean
drag the slider while it plays

Push the slider past 4000 Hz: the pitch stops rising, turns around and goes down. The numbers aren't lying, in an 8 kHz world there is no such thing as 6 kHz; it looks exactly like 2 kHz.

7.3 · quantization and bit depththe staircase steps are the available amplitude levels
rounded amplitude·
4 bit
levels
16
integer range
−8 … 7
dynamic range
24 dB
at low bit depths listen for the grit behind the tone: quantization noise

16 bit = 65,536 levels ≈ 96 dB of dynamic range. While recording and mixing you use 24 bit or 32-bit float so errors don't accumulate through processing; 16 bit is plenty for delivery.

7.4 · what actually sits in memory44.1 kHz · 16 bit · stereo · little-endian

The wave on screen becomes this on disk:

sample #time (µs)float −1…1int16bytes (LE)
0.80
  • Each sample is 2 bytes (16 bit). Low byte first, little-endian on Intel/ARM.
  • Stereo is interleaved: L R L R L R… Not separate blocks, alternating.
  • One second of stereo = 44100 × 2 bytes × 2 channels = 176,400 bytes.
  • A WAV file = a ~44-byte header (rate, bit depth, channels) + that raw array. Nothing else.
  • MP3/AAC/Opus compress that array; on playback it's decoded back to PCM. What reaches the speaker is always PCM.
bit rate = sample_rate × bit_depth × channels // 44100 × 16 × 2 = 1,411,200 bit/s ≈ 10.6 MB per minute
how you'll meet it in code Int16Array or Float32Array. Web Audio reads a WAV and hands you floats in -1…1. On the C/C++ side you usually get a raw int16_t*. Same numbers, different scale.
module 08FFT, deciphering PCM

How do computers read digital music?

The trick is startlingly simple and entirely mechanical:

  • Pick a test frequency. Generate a sine at it.
  • Multiply your signal by that test sine, sample by sample.
  • Look at the sum of the products.
  • If that frequency is present, peaks line up with peaks → the sum comes out large.
  • If it isn't, positives and negatives cancel → the sum lands near zero.

That's all of it. Try it by hand below.

8.1 · the one trickthe signal holds 200 and 500 Hz, drag the test frequency onto them
signal
test sine
product·
120 Hz
match strength
while it plays, bring the test frequency onto 200 and 500: you will hear them fuse

Green area = positive, red = negative. With no match the two balance out and the sum collapses to zero. On a match nearly the whole product goes positive. An FFT does this for every frequency at once, very fast.

8.2 · full spectrumthe three notes of a C major chord · let the FFT separate them
time domain · waveform
frequency domain · spectrum
window N:
sample rate
8000 Hz
window N
1024
bin width
7.81 Hz
window length
128 ms
usable bins
512

On the left the three sines pile into an unrecognizable wave. On the right the same thing splits back into three bars, nothing is lost, you're just seeing the same information on a different axis.

8.3 · the trade-off: time or frequency
  • Bin width = fs / N. Raise N → frequency resolution improves.
  • But collecting N samples takes time. N=2048 @ 44.1 kHz is a 46 ms snapshot.
  • If the note changed inside those 46 ms, both notes show up in the same frame → time resolution drops.
  • Uncertainty principle: you can't have both perfectly.
  • A long window is right for a tuner. A short window is right for drums and transients.
bin_width = fs / N freq of bin k = k · fs / N window_length = N / fs
  • Why windowing (Hann/Hamming): an FFT assumes your N samples repeat forever. If the start and end don't line up, a fake discontinuity appears and smears across the spectrum, spectral leakage. A window function tapers the edges to suppress it.
  • FFT vs DFT: same result. A DFT is the plain computation, N² operations. An FFT picks N as a power of two and shares repeated work → N·log₂N. For N=1024 that's ~10,240 operations instead of 1,048,576. That's why it runs in real time.
  • The N/2 rule: only the first N/2 bins are useful. For real-valued signals the upper half is a mirror of the lower half.
module 09digital structure of music

The breakdown of the digitalisation of sound.

Physical measurement ↔ what you perceive

what you measurewhat you hearwhere it shows up
amplitudeloudnesswave height
fundamental frequencypitch / notefirst peak in the spectrum
harmonic ratiostimbrerelative peak heights
envelopeattack, punchhow fast the wave grows
spectral balancebass / treble balanceleft/right weight of the spectrum
phaseposition, widthshift between the two channels

Where they interact

  • Amplitude and frequency are independent: turning it down doesn't change the note.
  • But perceived loudness depends on frequency: at equal amplitude, 60 Hz sounds quieter than 1 kHz.
  • Pitch comes from the fundamental; timbre from the harmonics. Both live in the same sound at once.
  • In PCM, sample rate sets the frequency ceiling and bit depth sets amplitude precision. Two axes, two separate limits.
  • The FFT ties it together: it extracts frequency content from the PCM numbers, and note and timbre are read off from there.
live analysispress a button, or open the mic and hum
waveformtime
spectrumfrequency
spectrogram · time →, frequency ↑
detected
·
note
·
deviation
·
level
·
|

Play the saw wave and watch the spectrum: an evenly spaced harmonic series stacked above the fundamental. Play the chord: three fundamentals and their harmonics interleave. That pattern is what your ear calls a chord.

module 10term summaries

The terms we learned, in an unofficial 2D placement.

Module 03 had two knobs that never touched each other. Those two knobs are the two axes of this graph. Click any term: you'll see which axis it belongs to, what it's derived from, and its formula.

where the terms sitnear the left = strength only · near the bottom = rate only · in the middle = both
RATE AXIS · frequency → STRENGTH AXIS · amplitude ↑
··

Click a term.

·

The chain along the bottom runs left to right in order of derivation: each box is a mathematical transformation of the one before it. The left edge works the same way. The two red boxes in the middle are different, they need both axes at once, which means they carry genuinely new information.

play the same planedrag on the pad, horizontal is note, vertical is loudness
frequency →↑ amplitude
note
·
frequency
·
amplitude
·
dBFS
·

Move only vertically: the note box never moves. Move only horizontally: loudness stays put. The rest of the page goes deeper into these two axes one at a time, first the logarithmic face of the frequency axis, then timbre, then the digital form of both (PCM), and finally the operation that converts one into the other (FFT).

module 11play time

Play time.

The same keyboard, three different physical models. Press a key and every quantity you learned on this page rises out of the note: the name, the frequency, the period, the MIDI number, the int16 value, how many harmonics are sounding.

pick an instrumentpress a key
piano additive · a decay per harmonic A struck string. Instant attack, upper harmonics fade first.
violin sawtooth · bow and vibrato Press a string and drag along it: that is the bow. Stop moving and it fades, because the energy stops.
guitar Karplus-Strong · physical model Pull a string sideways and let go. Fretting shortens the string and raises the frequency.
note
·
frequency
·
period
·
midi
·
harmonics
·
int16 peak
·
waveform · time
spectrum · frequency

Play the same note on all three and watch the spectrum on the right. The pitch never moves, because the fundamental is the same. The only things that change are the harmonic pattern above it and the envelope: that is timbre.

module 12intro to beat

BEAT. Slow a note down and it becomes a beat.

Rhythm and pitch are not two different things. Both answer the question how many times per second. The only difference is the rate: below about 20 Hz the ear counts the events one by one, above it fuses them into a single pitch.

one click, gradually fasterpress play, then drag the slider slowly upward
time axis · 2 seconds·
2.0 Hz
frequency
2.00 Hz
BPM
120
gap between clicks
500 ms
what the ear hears
·
|

At 2 Hz you hear separate clicks, two per second. Around 18 Hz they start to flutter. Past 30 Hz you no longer hear clicks but a low note. At 110 Hz that note is A2. Nothing was switched on or off; one number just got bigger.

in music this is called BPM

Musicians write that number not in hertz but in beats per minute. The conversion is one division:

BPM = f × 60 f = BPM / 60 // beat length = 60 / BPM seconds
BPMHzbeat lengthfeel
601.001000 msslow ballad▶
901.50667 mship hop▶
1202.00500 mspop, house▶
1742.90345 msdrum and bass▶

Click a row to hear four beats at that tempo. 60 BPM is exactly 1 Hz, one beat per second.

module 13understanding composing

Bars, accents and swing. The grid a song sits on.

  • Bar: beats are counted in repeating groups. 4/4 means four beats per bar.
  • Accent: the first beat of the group is stronger. That accent is the only thing that lets you hear the bar at all.
  • Subdivision: each beat can be split into 2, 3 or 4 equal parts. Dividing is, again, just a multiplier.
  • Swing: in a two-part division, lengthening the first part and shortening the second. 50% is straight, 66% is a full triplet feel.
metronomeeverything can be changed while it plays
time signature:
subdivision:
100 BPM
50 %
beat length
600 ms
subdivision
600 ms
bar length
2.40 s
bar frequency
0.42 Hz
swing is only audible on the 1/8 subdivision

Watch the accented beat in red: it is the only thing that makes the bar audible. Switch to 6/8 and the grouping changes at the same tempo. Then set the subdivision to triplet: the beats stay where they were, the gaps split into three.

one axis The bar runs at 0.42 Hz, the beat at 1.67 Hz, the sixteenths at 6.7 Hz, and the note you play at 261.63 Hz. All of them sit on the same axis, at different scales. Music is a structure built along it.
module 14cook time!

Now cook something.

  • A beat is frequency too, only very slow. 120 BPM = 2 Hz.
  • Same formula: f = BPM / 60. Below about 20 Hz the ear stops hearing a pitch and starts hearing a rhythm.
  • The row colours are the same palette as module 05, so you can see how consonant your pattern is.
16-step loopclick cells, then press play
scale: | root: | octave: | timbre:
112 BPM
50 %
tempo
112 BPM
as a frequency
1.87 Hz
step length
134 ms
loop
2.14 s
this column
·
patterns:
  • Click a cell a second time to make it accented, so it plays louder. A third click clears it. That is the amplitude axis from module 02.
  • The octave buttons multiply or divide every note by 2. The pattern stays identical, it just moves.
  • Change the root or the scale: the same pattern moves to another key, or turns from major to minor. The ratios are preserved, the feeling is not.
  • This column names the chord formed by whatever is sounding on the current step, using the same detector as module 05.

Watch the notes that land on the same step: simple ratios fuse, semitone neighbours clash. What you saw as colour in module 05 you now hear laid out in time.

appendixformula card

All of it in one place.

T = 1 / f period
λ = 343 / f wavelength, metres
dBFS = 20 · log₁₀(amplitude) digital level
f = 440 · 2^((m − 69)/12) MIDI number → frequency
m = 69 + 12 · log₂(f / 440) frequency → MIDI number
cents = 1200 · log₂(f₂ / f₁) fine difference between two frequencies
int16 = round(float × 32767) PCM conversion
bit_rate = fs × bit_depth × channels data per second
dynamic_range ≈ 6.02 × bit_depth dB 16 bit ≈ 96 dB
f_max = fs / 2 Nyquist limit
alias_f = |fs − f| for f between fs/2 and fs
bin_width = fs / N FFT resolution
freq of bin k = k × fs / N bin index → Hz
···
frequency·
note·
level·