techniques to play digi-samples on C64
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
Castle Wolfensteinreleased in 1983 (also used on later titles like 1984Jump Jet). It uses 1-bit samples played at around 7kHz and the quality is... not so great.
- Back in 1984 Impossible Missionthen 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
Kung Fu Fightingmay serve as an example here.
- For the years that followed the 4-bit D418-volume-register based stuff like
Arcade Classics,ArkanoidorDigi-Piece for Telecomsoftwas 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: Ice Guys
- And three years later somebody else came up with the idea to use pulse-width-modulation to play samples:
Wonderland IX part 9or the more recentWonderland XII-Digi part 1(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
Tristar BoulderorFanta in Space, or the more recentDevoid of. An interesting case from 2010 is the songCubase64that 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: Musik Run Stop
Comments (4)
-
Guest (Ben in Seattle)
PermalinkYou 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!
0 Like -
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).
0 Like -
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.
0 Like
Leave your comments