How music works, using Ruby
summary
Ruby code reads WAV samples with a WAV gem, renders waveforms with chunky_png, and shows that audio is just arrays of numbers at thousands of samples per second. Louder = multiply samples, clipping appears when values exceed range, mixing = summing aligned channels, and a two‑step compressor finds samples over a threshold, reduces them by a ratio, then applies makeup gain. Oscillators generate square and sine waves, random noise makes snares, and combining oscillators demonstrates the Fourier transform idea; a full cover is produced from these tools.
AI-written summary · about
chapters (13)
- 0:00Start
- 2:24Waveform
- 6:12Thomas Edison
- 8:52What Digital Audio Actually Is
- 10:03Helper Code
- 14:01Clipping
- 14:44Mixing
- 19:12Sanding Compressor
- 21:47Square Wave
- 22:02Oscillator
- 24:05Sine Wave
- 25:17Musical Chord
- 29:44How Are Overtones Created and or Visualized








