Sunday, January 10, 2010

On Extending the Instrumentation of the YM2413

The YM2413, which is present in the Japanese variant of the SEGA Master System (and can be installed in consoles from other regions) has some interesting 'cost-cutting' characteristics. It has nine pitched voices of FM sound (or six pitched and five percussive when in percussion mode).

In terms of instrument settings, each pitched voice can be set to one of sixteen preset settings, labeled internally from zero to fifteen. Setting zero is the only instrument preset whereby the programmer / music composer has control over the sound that is produced - all of the other settings are hard presets, as follows:

0. (custom voice)
1. violin
2. guitar
3. piano
4. flute
5. clarinet
6. oboe
7. trumpet
8. organ
9. horn
10. synthesizer
11. harpsichord
12. vibraphone
13. synthesizer bass
14. acoustic bass
15. electric guitar

As stated, only instrument zero can be customised in terms of sound. However, more than one voice might be set to instrument zero, in which case both voices will sound identical, even when the settings of instrument zero are changed. This scenario can seem a little limiting.

However, it is possible to extend the preset instruments in at least two ways.

Instrument Change Envelope
The idea with an instrument change envelope is that each note-on event automatically also triggers an instrument change event shortly after. Two predefined instruments are chosen - A and B. Instrument setting A is before the instrument setting change (and directly at the attack of the initial note-on event), and instrument B is after the instrument setting change (and is after the initial note-on event).

By changing the settings whilst the chip is currently synthesising sound for a given voice, it seems that it is possible to produce notes that are not strictly of a predetermined instrument setting (or at least, it has this effect).

The time between a note-on and the instrument change is approximately 10 ms.

Sound examples of using the instrument change envelope:
- instrument 4 (dry)
- instrument 4 --> instrument 8
- instrument 6 (dry)
- instrument 6 --> instrument 3

Instrument Change Modulation
It is also possible to modulate the instrument setting of a given voice. This involves the following process. When a note-on event is received, a software-based control oscillator is activated, which is then used to modulate between two instrument settings, creating more complex sounds than using the presets individually.

Typically frequencies for the control oscillator range from 1 KHz down to 20 Hz, so I guess we might call this a low to mid frequency oscillator.

At times, this sounds similar to a standard amplitude modulation, however, this is definite timbral merit in pursuing techniques such as these, as it pushes the limits of what the chip is capable of, and what sorts of sounds can be extracted from a limited sonic framework.

Sound examples of using the instrument change modulation:
- instruments 10 and 14 forming the modulation points
- instruments 11 and 13 forming the modulation points
- instruments 12 and 8 forming the modulation points
- instruments 2 and 3 forming the modulation points


boomlinde said...

Nice findings! Is the sound in the envelope trick different depending on where you trigger the instrument change?

Unknown said...

If I recall correctly both these methods were used in the MSX tracker called "Oracle" back in the day, another platform where the YM2413 was used extensively (known as the FM-Pac or MSX-MUSIC).

If anyone wants a go at it, it has been released for free at