Page 1 of 1

Toe Jam & Earl. Sound Engine

PostPosted: Tue Apr 15, 2014 7:26 pm
by Delek
Hi!, I just opened in DefleMask the track converted from the VGM and I was trying to understand why there's no a "channel dedication" for each one of the instruments. I mean, the bass is playing randomly on each one of the 5 FM Channels when it is needed. You can't simply "listen only to the bass".

I think that the sound engine used was made by using a priority queue or something like that, because it decides which channel to use dynamically depending how much time elapsed from previous note in that channel. It's pretty interesting.

If you don't understand what I'm talking about, please open the Toejam & Earl 2 - Theme Song vgm/deflemask module to mute some channels and try to separate a instrument. You will find that it is not done in a standard way.

Do you know any other game that uses this Technic? or the sound engine name?

Toe Jam & Earl. Sound Engine

PostPosted: Tue Apr 15, 2014 8:20 pm
by dissident93
This has to do with the GEMS sound driver (which the game uses). There are other songs/games that do this too (Sonic Spinball comes to mind, and I'm sure many others)

I think it has to do with a main feature of GEMS, which was the ability for it to directly convert MIDI data into something the Genesis' sound hardware could read and play back without any knowledge of programming from the composer. The Japanese had hex editing, the Europeans had trackers, and the Americans had GEMS/MIDI convertors, lol

maybe Valleybell could answer the question in more technical detail though?

Toe Jam & Earl. Sound Engine

PostPosted: Sat Apr 19, 2014 4:06 am
by ValleyBell
dissident93 wrote:and I'm sure many others
see the MD sound driver list

The GEMS sound driver is a MIDI playback engine. (It doesn't play raw MIDIs though, but a custom format that is optimized to be very small.)
It has 16 "virtual" MIDI channels, all of these channels can have a separate instrument. Also you can have overlapping notes and chords on a single channel, i.e. everything you expect from a MIDI engine.

When it has to play a new note, it loops through all channels (FM or PSG, depending on the MIDI instrument), searching for the first free one. Unlike most other MIDI engines, it tries to keep a monophonic MIDI channel on the same FM/PSG channel though.
This is called "dynamic channel allocation", btw.

Toe Jam & Earl. Sound Engine

PostPosted: Sat Apr 19, 2014 8:38 am
by dissident93
ahh, that makes sense. such a shame none of them could program or even use a tracker (like Matt Furniss and Jesper Kyd used, and their games sound amazing)

so what would happen if there wasn't a free space for an instrument? I guess it wouldn't play and the composer would have to re-work the song a bit?

Toe Jam & Earl. Sound Engine

PostPosted: Sat Apr 19, 2014 4:19 pm
by ValleyBell
In that case it would stop another instrument.
Every channel has a priority (usually set by a command at the beginning of a track) and it stops the note with the lowest priority.

This actually happens in a few well-known GEMS games.
Aladdin - Arab Rock 1 (AR 2, too) tries to play 1 note too much in the chords right before it loops back. (If you listen closely, you'll notice the missing bass strings between 2:00 and 2:04.)
Cool Spot - Rave Dancetune has the 2 of the 3 notes that raise from low to high cut, because it reaches the polyphony limit of the FM chip. (This happens in every loop at 0:42, but not at the beginning of the song.)