HiFi Audio On The Commodore 64 – 48KHz, Yo!

Prior to the development of CD-quality audio hardware in the mid-1990s, home computers and consoles typically made do with synthesized music. Due to the storage and RAM limitations of the time, there weren’t a whole lot of other practical options. If you’re willing to ignore practicality, however, you can do some wonderful things – such as playing high-quality audio on a Commodore 64!

The project is the work of [Antonio Savona], who set out to play hi-fi audio on a Commodore 64 using only period-correct hardware. That means no 16MB RAM expansions, and no crazy high-capacity carts. The largest carts of the era were just 1MB, as produced by Ocean, and [Antonio] intended to cram in a full 90 seconds of music.

Targeting a sample rate of 48 KHz with 8-bit samples would mean the cartridge could only fit 20 seconds of raw audio into its 1MB of storage. This wasn’t good enough, so the audio would have to be compressed, with the target being a 4:1 ratio to reach the 90 second goal. With the C64’s CPU running at just 1MHz, there are just 21 clock cycles to deal with each sample when playing at 48 KHz.

Obviously, [Antonio] had set quite the challenge, and some masterful assembly coding was used to get the job done. The final result has the audio sounding impressively good, given that it’s being pumped out by a 6502 that is surely sweating to get the job done.

We love a good C64 hack around these parts, and it’s now even possible to build a new one from scratch if that’s your particular itch. Video after the break.

34 thoughts on “HiFi Audio On The Commodore 64 – 48KHz, Yo!

  1. It’s high quality for a C64, but it’s still no match for CD quality. You have to raise the sampling frequency even more to to be able to push the quantization noise of 8 bits into the inaudible region.

        1. There’s an excellent lecture and demonstration of what is and is not important in audio, and down-to-earth proofs of the “golden ears” baloney, at http://www.youtube.com/watch?v=BYTlN6wjcvQ . Yes, it’s on YouTube which compresses the audio and loses information, but he gives the URL where you can download the raw wave files if you want to, otherwise see what he does with various experiments right there. In part of it, he searched for the most offensive noise he could find, and superimposed it on string-quartet music. You couldn’t hear it at all until it was only nine bits below the program material. On my little desk speakers, I couldn’t hear it until it was only seven bits below the program material. That’s not just quantization noise, but rather an intentionally offensive screeching.

    1. Nobody compared it to CD quality. Not sure why you bring up this comparison. This is the best sample replay I ever heard on an 8Bit machine. Some noise, sure, but hey, the soundchip was never designed to replay high quality samples. Absolutely impressive that this is possible on a C64.

      1. He did. The question of “high quality” depends on your point of reference. The bit-depth of the machine doesn’t really matter – it’s a question of speed and amount of information. A 1-bit machine can do better quality if you have about 3 MHz to spare (DSD).

    2. 48khz leaves plenty headroom to make most of the quantization noise inaudible, if some good noise shaping dithering is used. No idea if this demo used it, but it sounds remarkably clean.

  2. Does sound pretty good. Back in the day (circa 1987) I built a parallel port ADC from a magazine article using a serial ADC from Radio Shack. There was a matching DAC circuit that I never got good results from, but I had played some demos/games that had digitized audio, very impressive at the time, so I knew there was a way the C-64/C-128 (I had a C-128) could play digital samples WITHOUT a dedicated DAC. Somehow my high school brain decided to try using the SID VOLUME (4 bits) register as a DAC. Turns out, it actually is a pretty decent 4-bit DAC (oxymoron, yes). The quantization allowed me to pack 2 samples per byte. I recorded Shakespeare’s Sonnet 18 in my own voice and used it in a school presentation, plus an expansion port voice synthesizer to do something in (ahem) Steven Hawking’s voice. Man, the stuff I did at that age… also wedged C-128 BASIC to add Apple IIe low-res graphics commands using the graphical characters of the Commodore to do 40×40 low-res but fast graphics. Pretty sure I was the only student to implement line drawing commands in 6502 assembly code on the Commodore to cross-develop an Apple IIe low-res graphics demo… all that free time in high school…

    1. Using the volume register to play samples originated in 1982 with Software Automated Mouth, where it was used to play generated speech. ESS Speech in Impossible Missing and Ghostbusters similarly used it in 1984.

      Way of the exploding fist played back samples in 1985, although they were compressed in a different way and only ended up with 1 bit rather than 4 bits.

    2. The Atari 2600 also has two 4-bit volume registers, but you have to set the sound channel to an “all-1” mode first. Pitfall 2 used a custom ROM with an auto-increment fetch register to minimize the CPU time required.

  3. I am a Commodore lover, later commodore developed 32bit and it was gaming computer with 16.5billion colors. It was mostly used for graphics, animation and video overlay

    Later a CD player 32bit with excellent audio and used to come with a video card to play full motion video.
    CD 32 was an excellent 3D gaming machine. I still have these with me.

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.