Page 1 of 1

Pitch of rhythm instruments

PostPosted: Thu Sep 04, 2014 10:25 am
by Malvineous
Hi all,

I'm currently reverse engineering a handful of music file formats from early 1990s computer games, many of which used the OPL2/3 chips for playback.

I have unfortunately run into a bit of a dead end as far as documentation goes for the OPL's rhythm mode, so I am hoping that someone here may have investigated this and can provide some answers.

The main problem is that I can't find concrete answers about how note pitch is handled for the percussive instruments in rhythm mode. Some of the documentation I have found says that specific instruments have a fixed pitch, others say the pitch cannot be set at all, certain file formats allow pitch to be set for all percussive instruments but don't sound right if you set those frequencies, etc.

So I am looking for a definitive answer. Does anyone know with 100% certainty:

  1. Whether you can set the pitch of all percussive instruments? If not, which ones are fixed?
  2. If the pitch can be set, how? Do you write to the channel block/fnum and end up setting the pitch of both percussive instruments at the same time? Will this pitchbend an active percussive note?
  3. Are there any channel-wide settings (aside from the block and frequency, like registers 0xC0-0xC8) that affect both percussive instruments sharing that channel? If not, which operator/instrument (if any) do the channel-wide settings affect?
Any help will be much appreciated!

Re: Pitch of rhythm instruments

PostPosted: Thu Sep 04, 2014 10:44 am
by carbon14
It's two years since I last worked on the rhythm section, and my findings at the time are in this post:

http://forums.submarine.org.uk/phpBB/viewtopic.php?f=9&t=1174


You might find some clues in there.

Someone else might be able to supply more information.

Re: Pitch of rhythm instruments

PostPosted: Fri Sep 26, 2014 2:05 pm
by Malvineous
Thanks for the tip and sorry for the late reply. It doesn't look like much has been done with the pitch of rhythm instruments and there is a lot of conflicting information, so I wrote some sample .dro files and tested them out. Unfortunately I used an emulator which kind of defeats the purpose I know, but perhaps those writing the emulators know how this works correctly and just didn't document it anywhere.

The result is that yes, the percussive instruments do share the pitch set on a channel. So if you set the pitch on channel 8 and play a snare drum, then change the pitch on channel 8 to play a hi-hat at a different frequency, you will pitchbend the snare drum in the process. Typically the percussive instruments are so short you won't notice this, but there is one annoying situation where this is crucial.

Certain file formats, especially .cmf, allow you to play the two percussive notes that share a channel at the same time, at different frequencies. This obviously causes a conflict - which pitch do you use? It turns out the answer is "it depends on the file format." For CMF files, the official Creative Labs SBFMDRV processes the events in the same order they are in the file, so if the snare drum event is first and the hi-hat is second, but both notes are scheduled to play at the same instant, the pitch will be set to that of the hi-hat because that event came last in the file.

This caught me out because typically with music, especially MIDI which is the underlying event data in CMF files, the event order is not important if events occur at the same instant. One note doesn't affect another on a different MIDI channel. But in this case there are side effects of note ordering, so this has to be taken into account too.

But at least it explains that yes, the pitch can be set for all percussive instruments and it is shared for those instruments that share a channel.

Incidentially I noticed that most of the other shared registers seem to be ignored completely for the percussive instruments, which was unexpected.

But now I have an answer to my question so I'm happy :-)