Linus Live-Codes Music On The Commodore 64

In this tremendously educational video, [Linus Åkesson] takes us through how he develops a synthesizer and a sequencer and editor for it on the Commodore 64, all in BASIC. While this sounds easy, [Linus] is doing this in hard mode: all of the audio is generated by POKE, and it gets crazier from there. If you’re one of those people out there who think that BASIC is a limited language, you need to watch this video.

[Linus] can do anything with POKE. On a simple computer like the C64, the sound chip, the screen chips, and even the interrupts that control program flow are all accessible simply by writing to the right part of memory. So the main loop here simply runs through a lot of data, POKEing it into memory and turning the sound chip on and off. There’s also a counter running inside the C64 that he uses to point into a pitch lookup table in the code.

But the inception part comes when he designs the sequencer and editor. Because C64 BASIC already has an interactive code editor, he hijacks this for his music editor. The final sequencer interface exists inside the program itself, and he writes music in the code, in real time, using things like LIST and editing. (Code is data, and data is code.) Add in a noise drum hack, and you’ve got some classic chiptuney sounds by the end.

We love [Linus]’s minimal C64 exercises, and this one gets maximal effect out of a running C64 BASIC environment. But that’s so much code in comparison to his 256-byte “A Mind is Born” demo. But to get that done, he had to use assembly.

Thanks [zogzog] for the great tip!

12 thoughts on “Linus Live-Codes Music On The Commodore 64

    1. Only on 8-Bitters. Owners of an Atari ST or Amiga had the choce to do proper programming on GFA Basic and Amiga Basic, respectively.
      PC Users had BASCOM and Quick Basic or Turbo Basic. Or Locomotive Basic v2 on GEM.
      All being available since 1985, circa. The C64 wasn’t much younger, either.
      C64 coders with ambitions hat used SIMONS’ BASIC. Or ran GEOS.

  1. Thanks for the write-up. I scrolled past this vid in my youtube feed several times thinking “eh, I’ll get to it next time, maybe” but a couple key points in this writeup made it “I can’t believe I almost missed that. Must watch Now!” And while I tuned-out a bit on some of the details of a machine I know little about, I got sucked-in when he was changing the song in realtime via REM statements.
    Awesome work.
    Gonna have to watch again morre closely to see how he did it, and quite a bit more.

    Thanks for highlighting this, Elliott!

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.