The author attempted to learn music from first principles by writing code, starting with a single number changing over time and deriving the twelve notes, scales, chords, and chord progression. They used the Web Audio API to create sound waves and explore musical concepts.