techniques to play digi-samples on C64

Home computers like the Commodore Amiga popularized what is generally referred to as "music trackers", programs that usually use recorded/digitized sounds as instruments. They were based on the sound chips of that era which had introduced built-in support for the playback of respective PCM (Pulse Code Modulation) audio sample data.

The SID chip was never designed to directly play back recorded digi samples... but people found different ways to do it anyway (see my text here for background information).

Without built-in hardware support for respective PCM playback, one of the main challenges is the slow speed of the C64's CPU. Example: In order to play regular "44.1kHz Sony music CD" data the C64's CPU (which is clocked at ca 1MHz) would need to manually play one audio sample every 22 clock cycles. With typical CPU instructions taking between 2 to 6 cycles, there is just not much "runtime space" available to fit these into. To make matters worse things like interrupts have additional overhead and the C64 video chip may steal additional cycles from the CPU.

All of the used C64 solutions have in common that the CPU is used to trigger the output of each individual audio sample and the achieved timing precision heavily impacts the resulting audio quality. Early attemps usually did not bother with precise timing and the used sample rate was low. The novelty of having audio samples at all was deemed good enough. In later years demo scene productions tried to reach the limits of what the C64 is capable of, using precisely timed playback with sample rates reaching 30kHz. (In respective examples the C64's CPU is almost exclusively dedicated to the audio playback and has almost no cycles left to do anything else.)

The little RAM that is available on the C64 (ca 64kB) is obviously also a handicap for anyone that tries to playback sampled audio data: For comparison, the 16-bit PCM audio data that we know from our old CDs would completely fill up all the available RAM of the C64 with as little as 0.75 seconds worth of mono-audio.


SID chip voices

SID volume setting


Here some examples (click a song name to play it on this page):

  • Among the first pulse-waveform based players are released in 1983 (also used on later titles like 1984 ). It uses 1-bit samples played at around 7kHz and the quality is... not so great.
  • Back in 1984 then was one of the earlier examples that used the D418-volume-register to playback samples (4-bit). The sample rate fluctuates wildly in the 6kHz to 13kHz range.
  • Demos using nothing but a "digi playback loop" then demonstrated how quickly the C64 memory is completely filled up with sample data, and may serve as an example here.
  • For the years that followed the 4-bit D418-volume-register based stuff like , or was considered state-of-the-art. And with any well behaved dead home computer the story would have ended here.. except that it didn't.
  • The C64 was already 15 years old when somebody found out that samples can also be played by switching between different waveforms:
  • And three years later somebody else came up with the idea to use pulse-width-modulation to play samples: or the more recent (unfortunately this approach is sometimes associated with an annoying carrier signal)
  • The next approach that surfaced around 2008 uses frequency-modulation and precisely timed sample intervals to achieve 8-bit samples, see or , or the more recent . An interesting case from 2010 is the song that also added a compression scheme on top.
  • The most recent approach is then probably this one here from 2014. It is based on the old D418-volume-register one, but by carefully configuring all three SID voices it creates an "environment" that works on all SID models - unlike the basic D418-approach which tends to work poorly on 8580 SID chips. On top, the used "environment" allows to also use the filter related bits in the D418-register - so instead of 4-bit samples "almost 8-bit" samples can be played:

Leave your comments

0 / 400 Character restriction

People in this conversation

Comments (4)

  • Guest (Ben in Seattle)

    Permalink

    You have so many interesting techniques mentioned here and I'd love to hear them, but the only example I was able to get working is Impossible Mission which is embedded at the top. The rest of the links just go to the generic Tiny R Sid page. Could you maybe embedded the other SIDs on this page the same as you did for Impossible Mission? Thanks!

  • Guest (Tiny'R'Sid)

    In reply to: Ben in Seattle Permalink

    The other SIDs are already embedded the same way. I cannot reproduce your problem and on my Win10 machine all the links work fine in Chrome (131.0.6778.86) as well as in Firefox (104.0.2).

  • Guest (Royal Meservy)

    Permalink

    Are there any publicly available tools for composing songs in the last two methods listed above?

  • Guest (Tiny'R'Sid)

    In reply to: Royal Meservy Permalink

    There is a tool created by THCM that uses the second last approach (It is a converter for existing MOD files. AFAIK it hasn't been publicly released but you can always ask him.). Mahoney has well documented his work on Musik_Run_Stop - so that programmers can use it. But I don't know if there are any enduser tools.