(hide navigation)
  • Swedish content
Fund my projects
Don't miss
Page thumbnail
Log in
Latest comments
RSS feed
Music downloads
Video clips
Scene productions
Chip music

Machine Yearning

Machine Yearning is a 4 KB musicdisk for a modified C64 with two SID chips.


This album is redistributable under Creative Commons CC-BY-NC 4.0.

Dual SIDs

The designers of the C64 got many things right, and most users feel no need to modify their machines. The most common improvement back in the day, I think, was to add a reset button. But installing a second SID chip was not unheard of, and at this day and age it's even more popular.

The reason it's popular now is that modern C64 music is composed either for the old SID chip (6581) or the new SID chip (8580). In most respects the two chip models are functionally equivalent, but they have slightly different quirks, and composers increasingly rely on these quirks. Thus, SID afficionados will use something like SID FX, a piece of 3rd-party hardware installed inside the C64, to allow both an old and a new SID chip to be present at the same time, with a flip-switch to select between them. But SID FX also allows both chips to be active, responding to different memory addresses, and that's the setup I'm using here.

Consistency compresses

So these are seven songs distributed as a single executable file. They work together thematically to form a coherent concept, exploring the creative relationship between man, machine, constraints, and creativity.

But there are also technical reasons for bundling the seven songs together. The total size of the file can be reduced when the songs share a common playroutine, and the compression algorithm will pick up similarities in the data across the entire set of songs. So while a program that plays a single track from this album would be about 1 KB in size, the total set can fit inside 4 KB (with a bit of work).

Roughly speaking, each song accounts for about 512 bytes (½ kilobyte) of compressed data, while the playroutine and visuals share the remaining 512. But this is only a very loose approximation; to begin with, some of the tunes are more complex than others.

Compared to A Mind Is Born, 512 bytes per song may seem like a lot, even if we take into account the fact that two SID chips would realistically need twice as much data as one. Indeed, I have given myself more control over the compositions this time around. It's still a man-machine collaboration in the sense that many decisions have been influenced by the 4 KB limit and the constraints of the SID chip. But the resulting music is less inevitable this time, if we put it like that.


I won't go into the details of the implementation here, but I'll sketch the overall structure of the program. Looking at the executable file, the first 128 bytes consist of a BASIC header and a decruncher that decompresses the rest of the program and jumps to it. The size of the decompressed data is very nearly 6 KB: 1 KB of program code and 7x3 chunks of page-aligned song data. By page-aligned, I mean that every chunk is padded with null-bytes to fill a complete 256-byte page in memory. But the last page of the last song doesn't have to be padded.

The playroutine implements a virtual machine, and the music is expressed as snippets of code for this machine. Many such mini-programs can run at the same time, and they can update SID registers and playroutine parameters. The programs can also start and stop each other, and delay their own execution. For instance, every song has a master program responsible for the overall song structure. This program launches a number of “scenes” (intro, verse, ascent, drop, ...) with appropriate delays in between. The program responsible for a scene starts a number of programs in parallel, each in control of the rhythm of a particular musical part. These programs in turn invoke programs that trigger individual notes by writing to the SID registers.

The instructions for the virtual machine consists of two bytes—a command and a parameter—stored in separate pages. This accounts for two of the three pages that make up each song. The third page contains tables of data values that can be retrieved by the mini-programs, indexed by linear-feedback shift registers. Thus, for instance, the program responsible for a particular rhythmical figure might delay execution by an amount retrieved from a table, then launch a separate program to trigger a note, and finally restart itself. Meanwhile, the launched program might retrieve information about what note to play from another table, indexed by a separate shift register.

In this way, rhythms and melodies often emerge from shift registers and data tables, whereas the large-scale musical structures tend to be encoded in the programs themselves. But it's not a strict boundary; there are cases of hardcoded rhythms, as well as e.g. data-driven muting of parts.

One musical trick that I use throughout this music collection is sidechain “ducking”: The volume of some voices is muted in time with the beats, and gradually fades back up again. This is achieved by adjusting the master volume of the 8580 SID. Therefore, any parts that shouldn't duck, such as the bass drum, have to be played by the 6581 SID. In fact, the bass drum is always played by the same voice (Voice 3) of this SID chip. By assigning sounds to voices in a consistent way, their corresponding programs end up quite similar, and this improves compression across the album.

Song titles

Finally, a word on the titles. As you may have guessed, these are error messages from the C64 ROM. Relying on strings from the ROM makes the program a little bit smaller, and every byte counts. But there is also a symbolic value in using these titles: There isn't much text in the C64 ROM—again because of size constraints—and what's there is mostly concerned with cases where something has gone wrong. So if there's a soul in this machine, it seems to be a troubled soul, disconsolate and wistful. Since I had to compose the music to fit the available song titles, the machine has influenced the creative process not only with technical constraints, but also by this wistfulness, this machine yearning, that sets the emotional tone of the entire album.

Posted Sunday 9-Apr-2023 16:52

Discuss this page

Disclaimer: I am not responsible for what people (other than myself) write in the forums. Please report any abuse, such as insults, slander, spam and illegal material, and I will take appropriate actions. Don't feed the trolls.

Jag tar inget ansvar för det som skrivs i forumet, förutom mina egna inlägg. Vänligen rapportera alla inlägg som bryter mot reglerna, så ska jag se vad jag kan göra. Som regelbrott räknas till exempel förolämpningar, förtal, spam och olagligt material. Mata inte trålarna.

Mon 10-Apr-2023 04:03
This is incredibly cool. I cannot express how impressive this is and how much I respect it.
Mon 10-Apr-2023 13:28
Oh my. This is so crazy good. Next time I run into you, let me buy you a beer (or hot chocolate, whatever you prefer). Eller fikar tillsammans.
Sat 15-Apr-2023 18:14
Absolutely love every bit of it.
Mon 24-Apr-2023 18:57
Andreas Toth
Fri 28-Apr-2023 16:28
This is so incredibly impressive! It's a masterpiece not just in coding, but philosophically, technically, and musically!
Sun 21-May-2023 21:32
i have hacked a simple sid player to yield fake stereo sound. makes songs much less painful on the ears. noise gets particularly wide, sinewaves not so wide.

purists dont like it of course.
Sat 27-May-2023 08:09
if you love the machine, you'll understand everything. Beautiful!

PCH / Unreal
Thu 3-Aug-2023 12:09
Hi Linus,

a marvelous piece of software, but unfortunately it is only running as intended on newer models with 8521 as CIA1. On machines with a 6526 as CIA1 the Bit 7 of the ICR is set one clock after the Timer A underflows and Bit 0 is set. But a read of the ICR with BIT $DC0D at $40C9 can in rare cases reset Bit 0 while Bit 7 is still not set yet and in return Bit 7 will not be set and the underflow is lost, resulting in missed detection of underflows and therefore a playback that is too slow.

Although in german language I have written a detailed explanation about this problem in the Forum64. Feel free to have a look...

Link: https://www.forum64.de/index.php?thread/138247-ultimate-64-lft-machine-yearning-leiert/&postID=2024805#post2024805

Thomas, a.k.a. Freak
Fri 16-Feb-2024 19:40
Great music, I hope you'll make second album, yo still have at least these:
Wed 19-Jun-2024 17:27
This is such a fantastic concept with a fantastic execution. I've never heard such a beautiful and literal interpretation of the soul of a Commodore 64. It's beautiful, haunting, simple and elegant. This work needs to reach a wider audience.