3.22.2013

Music, Experiment & Audio Dev : SEGA YM2612 CSM Speech synthesis

Music, Experiment & Audio Dev : 

SEGA YM2612 CSM Speech synthesis

This is going to be a simple blog where I will share some news, infos and how-to regarding my funky adventure in the world of Synthesis, Signal Processing, Vintage Hardware Emulation, DIY Electronics audio projects and things..
I can answer or post some help in french when I am around if needed :)

Actually, I am about to release a VSTi Emulation of the SEGA MEGADRIVE/GENESIS CONSOLE SOUND CHIP, aka YM2612. The Software is called F-MDRIVE2612.

I will post everything about that when it will be out!

For a start;
here is some infos on programing some writes to the SEGA MEGADRIVE YM2612 fm sound chip.
In order to test the infamous CSM mode aka "Composite Sine Wave Modeling" or "Speech Mode"
There is not much information regarding this technique and it was barely used in past sega megadrive games,
I can even say never.. why? because it is quite hard to program from scratch...well we will see.

You will need: (google it)
  1. -Basic C++ knowledge
  2. -SGDK (to program a rom binary file for the SEGA MD)
  3. -IDE: Codeblocks

A good understanding of how the ym2612 works ( see the link below for a start.)

--------------------------------------------------------------
HOW TO WRITE TO YM2612 : PART1  //SET THE TIMER
--------------------------------------------------------------
//REGISTER MAP http://www.smspower.org/maxim/Documents/YM2612

//ym2612 mode selection
// disable timer & set channel 3 to normal mode
    YM2612_writeSafe(0, 0x27);
    YM2612_writeSafe(1, 0x00);

// disable timer & set channel 3 to special mode
    YM2612_writeSafe(0, 0x27);
    YM2612_writeSafe(1, 0x40);   

// enable timer A & set channel 3 to csm mode
    YM2612_writeSafe(0, 0x27);
    YM2612_writeSafe(1, 0x81); 

The CSM mode will perform auto KEY ON/OFF at Timer A speed.
First test with only one Operator OP4 (C2) Carrier/ Channel 3.

The frequency of the sine wave and the rapid phase sync by timer A will act as a kind of filter to emphasis certain frequencies.
Using different frequencies (SUP CH3 FNUMBERS) for each OP with appropriate timing and different TL (volume), it becomes some vocal formant synthesis, you define f1, f2, f3...(google formant)

In this mode you can also mask certain Operator in sequence to produce interesting effects.
Last but not least with appropriate programing you can sort of play the timer like a series of notes.
Timer A period ms>> to hz >> to note.
ex: Timer A = 18.4ms = 54.347826087 hz, near 55 hz  note A octave 0 for the lowest period (NTSC)
for the (PAL) megadrive the Timer A is closest to 19.4ms (G# /Bb).


Registers 24H and 25H are ganged together to form 10-bit Timer A, with register 25H containing the least significant bits. They should be set in the order 24H, 25H.
The timer lasts:
                       18 × (1024 - Timer A) microseconds

Timer A = all 1′s -> 18 µs = 0.018 ms
Timer A = all 0′s -> 18,400 µs = 18.4 ms

Registers 24H & 25H - Timer A
            D7     D6     D5     D4     D3     D2     D1     D0
24H     Timer A MSBs
25H                                                               Timer A LSBs 

// set timer A to the longest period for csm mode test
   

    YM2612_writeSafe(0, 0x24);
    YM2612_writeSafe(1, 0x00);  //8Bit from 0x00 to 0xFF
    YM2612_writeSafe(0, 0x25);
    YM2612_writeSafe(1, 0x00);   //2Bit from 0x00 to 0x03
//example values:
                  24 0xFF 25 0x00 = 1020
                  24 0xF0 25 0x00 = 960
                  24 0x78 25 0x00 =480


No comments:

Post a Comment