[Coco] more 1 bit madness
Nick Marentes
nickma at optusnet.com.au
Mon Jan 20 01:10:37 EST 2014
Allen Huffman <alsplace at ...> writes:
>
> On Jan 19, 2014, at 5:41 PM, Steve <6809er at ...> wrote:
> > I took look at the code that Simon just posted today and it could never
be used while a game is running. The CPU
> overhead is just too much.
>
> Grumble. I was afraid that might be the case.
Generating music "on the fly" eats into much of the CPU time required by a
fast action type game on the CoCo.
You can lower the sound quality to reduce the overhead but then it starts
sounding very choppy and buzzy with heaps of aliasing.
The best way to provide music within a fast action game is to use whole
sampled sound. This has the overhead of requiring a lot more RAM and limits
the length of a tune but it means the music routine is not spending time to
generate the musical notes. It merely throws a byte out to the sound output
port at a set interrupt interval. The frequencies and multiple sound
channels have already been pre-processed.
I use a 2 voice interrupt driven sound routine allowing for 2 sound effects
to occur simultaneously, such as firing and explosions.
No reason why I couldn't use one for sound effects and the other to play a
sampled music track but most people will find the repetitive sound track
monotonous.
If you're a good programmer like John Kowalski, who can create the
impossible, maybe a proper 2 channel MOD type player can be had with
gameplay but I have always tried to keep my sound overheads low to allow for
as much as possible to the game itself. (I'm also not as good as John).
Nick
More information about the Coco
mailing list