Music Theory for Programmers(runjs.app)
397 points by birdculture 7 days ago | 242 comments
tl;dr: A programmer derives Western music theory from first principles using JavaScript and the Web Audio API, showing how the 12-note system emerges from reconciling powers of 2 (octaves) with powers of 3 (fifths), why equal temperament is a necessary compromise, and how scales, chords, and progressions reduce to arrays of integers. Along the way it explains consonance via overlapping harmonics, why major and minor differ by a single semitone, why V-to-I resolution works (the tritone inside the dominant 7th), and treats musical notation as a lossy serialization format with historical constraints.
HN Discussion:
  • Music professionals argue the article mislabels acoustics/math as music theory and is misleading
  • The article oversimplifies music, reducing it to trivial math that doesn't explain real musical complexity
  • Music involves significant cultural convention, not just physics, making the article's framing one-sided
  • Appreciates the article as an enjoyable technical exploration, even if mislabeled
  • Defends domain experts against programmers who dismiss non-engineering expertise