[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mockingboard



BLuRry wrote:
Midi conversion can be kind of painful though, especially when you want
to convert a multi-polyphonic stream down to only 6 oscillators and 1
noise generator.  It's possible, sure.  Your awesome apple crate
experiments confirm that.

It's not so bad that an assembly language routine couldn't do it faster
than real time, if we assume that the file is pre-loaded into memory.

But it might be more practical (hah.. that's
funny.  my other half constantly tries to persuade me there's nothing
practical about this hobby of mine) to produce a player that uses an
optimized data structure to reduce the amount of logic necessary during
playback.  Make the playback interrupt driven and tune it to use less
than 10-20% of the CPU time and you have a music playback engine for a
game!

That could always be done quite easily by simply capturing the event
queue to a file.  The first thing to do, though, would be to decode
a MIDI file and play it with the Mockingboard.

BTW, you have two noise generators with six tone generators, but that's
a detail, and noise generators are probably hard to use, anyway.

I think the trick is to reset the interrupt interval on every cycle so
that the timer doesn't start another interrupt until another playback
action is necessary.  With midi, you could pull this sort of thing off
by doing a look-ahead but it would be more expensive than, say,
compressing the empty space by representing "nothing happens for 1000
milliseconds" as a command.  That way, you know that the next command
in the queue is "wait 1000 milliseconds"

That's exactly what I was meant when I suggested that an IRQ routine
could "play" a circular buffer of "events".  Clearly, you'd not like
a lot of IRQ's that a) don't do anything, or b) aren't synchronized
with the next music event.

MIDI is nothing but a collection of time-tagged queues of note-start
and note-end events, so the look-ahead is pretty trivial--you just
compute the time tag of the next event after each event being handled,
and deal with the soonest one, merging them in real-time.

I had sort of started down this path, but got stalled by my test code
failing to produce a tone, and then I got distracted by the raycasting
bit.  Shame on me. :-D

Take another shot!

-michael

Music synthesis for 8-bit Apple II's!
Home page:  http://members.aol.com/MJMahon/

"The wastebasket is our most important design
tool--and it is seriously underused."