The Amiga is one of my favorite machines, especially when it comes to the audio. Most of you who had an Amiga back in the day (and maybe still do) remember that it had four eight-bit, stereo-separated sample based audio channels. But what if I told you there's a way to get a fifth audio channel?
Ok, so it's not a real, real audio channel, but I'm talking about something capable of outputting audio: the Amiga composite video port. It's the same socket as the other two audio ports, it outputs terrible video quality and is not in use on most Amigas. So why not put it to work?
The concept is simple: a bright color outputs a high voltage, while a dark color outputs a low. By changing the screen colors at just the right speed, I'm able to generate audio frequencies and use them to play music.
Let's look at it in detail by examining the video signals for a perfectly black screen:
Now, compare this to a white screen:
The first obvious thing you'll notice are the "dips" in the curve every 64µS. These are the horizontal sync signals, one "dip" per line, and they cannot be disabled. Consequentally, they will also produce an audible humming sound, which you will hear in the video further down.
It is clear that we can easily manipulate the video signals by changing the screen graphics, and by carefully changing the graphics at just the right time, we should be able to make video that's.. well, audible.
I wrote a simple assembly program that fills the screen with 285 raster lines from top to bottom. This means that one line represents the voltage level between two horizontal syncs (or "dips" if you like) as seen in the pictures above. All lines are updated 50 frames per second with the next values from the audio sample.
The code automatically adds a DC offset to the AC audio waveform so the sample data varies from 0..255 instead of -127..127. And since the Amiga only has 16 gradients from black to white, we only use the upper 4 bits of the sample. (Using gradients of various colors will not increase the sound quality, look up how colors are encoded in composite video.)
Now, what I needed next was some way of composing music with this fifth audio track. There are existing programs that emulate multiple tracks through software mixing, but I decided to take the short route and use spare 800 commands in Protracker for playing the last track. To keep things simple, I'm dedicating the 5th track just to the drums, so I don't have to worry about adding support for various notes. The command 8xx simply plays the instrument xx at a preset pitch. As you can see above, instrument 1 (801) is the bassdrum, 2 (802) is the snare, and 6 (806) is the hi-hat. The Protracker replay routine was modified to support these "video samples."
Just like the other audio ports, this one needs to be amplified to be heard. I connected a set of active PC speakers via this adapter cable. Although I built this one myself, similar cables are dirt cheap on eBay, if you want to try this out for yourself.
Take a chill pill, Picard, and listen.
Here's the proof-of-concept demo. The audio is a bit low, but if you listen closely, you can hear that I'm gradually spending all 4 audio channels before introducing the drums.