Music Theory for Programmers

(runjs.app)

70 points | by birdculture 3 days ago

13 comments

  • raulparada 4 minutes ago
    If you’re a programmer interested in music, do check out Strudel, at least the examples at https://strudel.cc/examples. If you like those (I love them, so much art in a few lines of code), the docs _will_ get you started. Enjoy!
  • polotics 42 minutes ago
    Let us try an experiment shall we: listen to any music you like and try and match the information the article provided to the complexity of what you are hearing. How much do you see a path from A(rticle) to S(ound in your ear).

    This article is trivializing music down to a few not-so-important facts and mistaking some math for anything that would help `programmers` (?) understand music.

    Maybe start by rewatching "This is Spinal Tap" instead, and consider that https://www.reddit.com/r/musictheory/comments/59n3pg/remembe...

  • theanonymousone 1 hour ago
    How come the same article has been posted four times in the past 18 days? https://news.ycombinator.com/from?site=runjs.app

    Doesn't HN have a temporal deduplication system?

  • euroderf 7 minutes ago
    If tasked with this, I would start with an image of a piano keyboard and ask: Why the hell does it look so weird ? Black and white keys in some infernally strange layout ? WHY ?

    Which takes you very quickly to equal temperament and perfect fourths and perfect fifths. This tells us where the notes C and F and G are located on the chromatic scale, but then the rest are pretty arbitrary eh. Semitones from C to C go 2-2-1-2-2-2-1, but there is nothing heavenly ordained by this particular arrangement. E-to-F and B-to-C are a collective choice.

    If I had been presented with this kind of explanation fifty years ago, I might have been less skeptical of the entire enterprise.

  • _kb 26 minutes ago
    If this is the sort of thing that interests you, I highly recommend setting aside 90 minutes and strapping yourself in for a listen to https://malwebb.com/notnoi.html.
  • ergonaught 1 hour ago
    I want to read it, because it’s interesting. And yet.

    https://bcantrill.dtrace.org/2026/09/05/the-revolt-of-the-re...

    • youoy 53 minutes ago
      It looks good at the begining, but at some point it starts saying "half truths", or stating facts/conclusions with confidence as if that was the main reason, but its just half of it (and maybe not the most important half)...

      I wanted to read it because I like the topic, but i somehow felt it was folluting my brain. I think i will also start joining the club of AI;dr to protect myself from pollution, even though i may miss some iteresting articles.

    • yiren 51 minutes ago
      I did read it, found it mildly informative/interesting, then saw your comment, read the link, and pasted in two paragraphs into Pangram 4... ouch! I guess I'm not LLM-weary enough?

      https://www.pangram.com/history/25773627-adfa-4efb-8c10-f4fd...

    • tessierashpool 1 hour ago
      yeah, this is robot garbage.

      the post says: I wanted to start from scratch and learn music from first principles, and I began that journey by writing code.

      but we know that's not true. you began that journey in Claude Code, or Codex, or ChatGPT, or whatever. you just want to demo your startup that embeds JavaScript in web pages.

  • lefra 1 hour ago
    I should not have to install a browser plug-in to opt out of Google analytics (that's what's proposed as an opt-out option in the privacy policy).

    Where's the "reject non-essential cookies" button?

  • altmanaltman 1 hour ago
    I learned to play guitar by my own when I was around 12. You don't really even need to know music theory to play guitar, as long as you understand the shapes etc.

    Over time, I developed shorthands for understanding theory like i can easily look at a fretboard and know which note it is.

    But what bugged me is that you seem to imply the reason why you couldn't learn a instrument was because you did not understand the why. That makes very little sense to me. I know several professional musicians who don't even know what a mode is or what formal notation is. One of them has pitch perfect ear, he can literally hear anything and tranpose that on his guitar. He has no idea how notes work and just writes tabs.

    So while this is very nicely from a programmer point of view and an objective explanation of things but learning all this will not make you a better musician is the point.

    Practice above all. Dont try to fit all theory into the pratice but understand what you are practicing particulalry using the theory. Otherwise you end up with all theory and no practice experience of using that theory and creativity.

    As a perosn who likes code, this is interesting. As a musician who also understands music theory, this is kind of alienating in terms of how it presented. Like if someone just read this article and thought they understood music theory now, they would be pretty unsufferable to actual musicians.

    • rTX5CMRXIfFG 37 minutes ago
      Re: not knowing how to play because author doesn’t get the why

      Quite a lot of people learn by imitation without knowing the underlying theory. Some people need a theoretical framework so that they have a mental model with which to understand everything else.

      Fundamentally, you’re arguing against learning theory. Not everyone learns the same way. If you have a problem with that, then you have a problem with a basic fact of life.

      • altmanaltman 29 minutes ago
        No I don't have a "problem with that". And yes, people learn by imitation, which is what I meant by practice. Playing the guitar is a fundamentally different activity than knowing music theory. Becoming good at one doesn't make you good at the other naturally (since you are practicing two different things) and I am worried some people think its the same thing.

        Furthermore, in real life, I have seen the same approach actually be detremental to learning guitar. Its a bit like football - there is a physical skill level to the sport which you can practice and then there is a theoritical part (tactics and formation) that help you understand the game and play better.

        But if you just want to start by kicking a ball and you know everything about Pep Guardiola's new counterattacking system. Yet when you are kicking the ball and practicing the basic skills, you are not thinking woah am i a midfield playing the right side and looking for a pass? That type of thinking is not useful when you are learning how to kick a ball.

        Ideally you should do the two together and work really hard on practice first if you actually want to be a footballer is my point. If you say oh no everyone is different, some people just like tactics, I don't think I say anything against it.

        Theory first is not a good way to learn an instrument is my qualified statement. Not that theory is not important or doesnt matter or everyone should follow the same way of learning.

    • jemmyw 1 hour ago
      It's funny though how different people respond to learning music theory differently. I started on guitar when I was 19. I played for a long time at campfire level. When my kids started learning music I also learnt a lot, and now I know scale shapes and modes on guitar, so I can reasonably play to a song I'm hearing for the first time, then figure it out by ear. But I just cannot make the leap to knowing the notes at each position. I can read music, very slowly, to play on piano, but fluency has never clicked for me even though I've put the time in.

      My 8 year old hardly ever practices but just looks at the music and knows the notes on piano and violin.

      In any case, I agree that this isn't that helpful to being able to play, it's just an interesting way to understand why things are as they are.

      • dyzone 1 hour ago
        Your kid might have absolute pitch. Only a few percent of people have it.

        https://www.youtube.com/watch?v=t3Cb1qwCUvI

        • sjrd 1 hour ago
          Perfect pitch is not correlated with the ability to see written notes and immediately know how to play them on any instrument. It is only barely correlated with the same but for singing the note.

          I do not have perfect pitch, but I could always do what GP's kid does. I am now a pretty good amateur singer.

          What matters for this is learning to read the music notation and developing a sense (mostly subconscious) of scales and harmony. Perfect pitch does not help either of those things.

      • altmanaltman 25 minutes ago
        I think it gets significantly harder to learn new things as you age. It could make sense though like its significantly easier to learn a new language as a child than an adult, something simillar could apply to sheet music also i guess where they are naturally more intuined with its language vrs you who has to kinda use a dictionary for time to time because the "normal" way for you to speak has been so different for so long. But for your child, its another form of expression almost. Its really good to get kids into music while they are young imo
  • kmoser 1 hour ago
    This article is quite well done, especially from a programmer's perspective, but falls flat (no pun intended) for me because of my terrible ear for pitch.

    > Here are five notes. Every one is double the frequency of the one before it. [...] They are different pitches, and yet they sound like the same note.

    Nothing about these notes seem similar to me. You could play pretty much any sequence of rising notes and (falsely) claim they're the "same note" and I'd believe it. This is one reason I've always had trouble learning music.

    > √2 the awkward one -> 311.13Hz

    That one doesn't sound particularly awkward to me. Again, I blame my inability to distinguish pitch.

    The only instrument I was able to pick up pretty easily was drums.

  • JonathanRaines 3 days ago
    Fantastic post. You took a subject that never made sense to me and made it seem simple.
  • Fannon 1 hour ago
    Very nice, thanks for creating this!

    > The system we want, where the octave is pure and the fifths are pure and everything closes into a neat loop, does not exist and never has. Every tuning system in history is a different choice about where to dump the error.

  • aidio 3 minutes ago
    [dead]