Re: [stella] New idea for 6 channel music on the 2600
Subject: Re: [stella] New idea for 6 channel music on the 2600|
From: Kevin Horton <khorton@xxxxxxxxxxx>
Date: Wed, 19 Sep 2001 18:21:38 -0500
At 12:48 9/19/01 +0200, you wrote:
> I have an interesting idea for generating 6 channel music using nothing
> a stock 2600. The basic idea is to use the two volume registers on the
> chip to generate 3 channels each.
What's the reason for the 6 channels? Is it due to hardware restrictions,
or don't you just have enough cycles to do more?
Each volume register can have a maximum of 16 values between silence and
full volume. To add multiple channels together, you simple add :-).
Each "channel" can range from 0 to 5. This gives 5*3 or a maximum of 15
levels used. Since there are two volume registers, 3*2 = 6. I was thinking
of defaulting the channel volume to 1, so the TIA's sound regs could still
be used to generate things like percussion and SFX or something.
A square wave (50% duty cycle) would look like this, for example:
A triangle wave would look like this:
The idea is you plug these 8 values out to the volume register in quick
succession, then repeat the pattern again. This should produce a waveform.
My idea was to use the upper 3 bits (or maybe the lower 3 bits of the upper
byte) to index a table of waveforms from the phase accumulator. What is a
phase accumulator? It's simple- just a register (in my case, 16 bits)
which has a constant added to it every pass through the loop. To get a
higher note, you simply add a larger number. lower numbers = lower
notes. This will allow one to get enough precision to play decent sounding
music, with a pretty good range. It is accurate because when the
accumulator "rolls over" from ffffh to 0000h, the "remainder" is added too,
so you do not build up any error (read: the notes sound clean and do not
change in frequency).
One very neat effect of this phase accumulator topology is if the frequency
gets high enough where you can no longer use all 8 bytes of the waveform,
it will selectively use only say, every second sample, or every 3rd sample
depending on the state of the phase accumulator. This lets you get to the
nyquist of the sample rate (in our case, the same rate == the rate at which
the phase accumulators are updated) nyquist is half your sample rate, so
theoretically if my sample rate is 1/4th the horiz refresh then I should
net ~15.5Khz/8, or ~1.9Khz maximum note frequency. This isn't too bad and
is very workable. Right now, my code (untested) uses wsynch to maintain
If you post it, unless the code is to simple, I'm quite sure, the members
of the list will be able to find cycles :)
Yeah I'm sure of that :-) I'm surprised no one has done this before, since
it's not that hard of a thing to do.
Cool, I can't wait to see this!
Maybe by reducing the number of channels, we could also be able to mix
graphics and sound.
I hope, at least one of the emulators (z26?) will procude that music...
Me too.. I don't wanna bust out the EPROM emulator, socketed cart, and
2600 if I don't have to :-)
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/