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.
Now imagine how far we’ve come by comparing that to an Arduino with DSP or a PiZero..
Mind-blowing!
Man, that beats the ever-loving shit out of my audio efforts from back in the day. Phenomenal quality.
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.
“into the inaudible region”
Spotted the “audiophile”
No, I’m not an audiophile. But I had some lectures about signal processing.
Just look at the spectrum. He didn’t even try to do noise shaping.
Impressive! Nice job!
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.
No, someone with at least a basic understanding of DSP.
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.
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).
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.
You maybe want to address with his real name, Antonio,not Antonia
Thanks Andrea :-)
*Andreo
This is 44kHz 8-bit for Atari 8-bit (800XL) streaming from the CF card (https://www.youtube.com/watch?v=IB37a1oGkfw) :).
Ah that’s a nice one. But the goal of this demo is to use Stock HW from the 80s. Streaming from a CF is not… Fair :-)
That is a 600XL, the little brother of the 800XL.
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…
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.
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.
If you are interested in this technique, here is a (boring) explanation:
http://brokenbytes.blogspot.com/2018/03/a-48khz-digital-music-player-for.html
By the way, it’s Antonio. But my aunt Antonia says hello! :-)
Ooops, sorry for the mistake. It’s all fixed now!
BTW, that’s “Antonio” Savona, not “Antonia”. He’s a man :-D
I wonder if it might be possible to build a circuit to interface a VCR to one of the I/O ports for data storage, using only parts that were commonly available to hobbyists at the time.
I used a VCR to do backups with an Amiga500 so I guess that would be possible. retires slowly waiting to be corrected :D
very possible i should think, but why would you want to store more than the ram could hold on datasette?
c64 cassette can already store over 2MB with Turbo loader.
Yes, you could, but you wouldn’t have enough CPU to read from it fast enough to do something like this demo :)
Nice job!
Now for the Gigatron version.
https://github.com/sgjava/garage/blob/master/commodore/c64/digiblaster64/src/26kbps.out
This is something I did back in the 80s to record and playback using a Covox Voice Master . It maxed out at 26 KHz, but it was way better than the Covox software.
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.
Semplicemente, fantastico!
A demo in the best spirit of the things — combing several tricks, each of which are completely impossible. The first link in the article covers how the whole thing works; here’s the missing part on how to do 8 bit sample playback on a SID chip:
https://livet.se/mahoney/c64-files/Musik_RunStop_Technical_Details_by_Pex_Mahoney_Tufvesson_v2.pdf