New Documentation: An authoritative reference on the YM2612

For anything related to sound (YM2612, PSG, Z80, PCM...)

Moderator: BigEvilCorporation

Post Reply
notaz
Very interested
Posts: 193
Joined: Mon Feb 04, 2008 11:58 pm
Location: Lithuania

Post by notaz » Mon Jun 23, 2008 9:59 pm

Tried to add handling for this into MAME core. It took a while to figure out that the behavior Nemesis described is not what actually causes the 'blip' sound, the blip comes from operator1, and the described operator2 behavior eliminates the 'blip' :)

For some reason I'm getting the best results when I use fnum=7ff and blk=5 settings as a maximum. I've checked as many games as I could:

Code: Select all

+- Ariel - The Little Mermaid (intro, 1st level)
+- Battletech (music 03, 07, 12)
+- Berenstain Bears', The - Camping Adventure (music 1, 4, ...)
+- Comix Zone (tracks 5, 10)
+- Flashback (bgm3)
+- Shaq Fu (most of the music)
+- Spider-Man - The Animated Series (intro music)
+- Vectorman 2 ("fall dig" track)
They sound fine, but they all seem to use the same settings (blk=4, mul=12, ...), probably because they all use GEMS.

Nemesis
Very interested
Posts: 791
Joined: Wed Nov 07, 2007 1:09 am
Location: Sydney, Australia

Post by Nemesis » Tue Jun 24, 2008 10:39 am

I've confirmed the presence of the CSM mode in the YM2612, and whatsmore, Kega doesn't emulate it. Hooray, I've found something new! :lol:

I've still got more tests to run before I can post a full description of how the CSM mode works, and I'm not going to have time to complete them all tonight, but I'll post the details as soon as I've confirmed the behaviour.

Eke wrote:btw, is this a bug with ch3 only or did you reproduce it on other channels ?
I've now confirmed that the detune overflow bug occurs on all channels.

Eke
Very interested
Posts: 884
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Tue Jun 24, 2008 12:45 pm

cool, did you found any games using this ?

Btw, you already made a great discovery by explaining the Detune bug, I still can not understand how this could have remained like a dirty secret so long :roll:

sharing informations is the way to move on, especially when some people don't have a way or enough knowledge to make test on real hardware themselves... thanks a lot Nemesis

Nemesis
Very interested
Posts: 791
Joined: Wed Nov 07, 2007 1:09 am
Location: Sydney, Australia

Post by Nemesis » Tue Jun 24, 2008 1:14 pm

I haven't looked for games that use this feature, I've just been experimenting with my own code. If anybody wants to hunt for games which might make use of it, CSM mode is active when the channel 3 mode bits are set to "10", or in other words, when register $27 is set to 10******. CSM mode is not active when the upper bits are set to 11.

notaz
Very interested
Posts: 193
Joined: Mon Feb 04, 2008 11:58 pm
Location: Lithuania

Post by notaz » Tue Jun 24, 2008 8:44 pm

Looking forward to "Undocumented YM2612 features" doc :)

Eke
Very interested
Posts: 884
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Thu Jun 26, 2008 1:30 pm

Stef wrote:Yep, that should do it in theory.
As you said the YM2612 is probably using internally a non signed fixed size register and in some case it underflows. Your fix should emulate it correctly =)
well, it doesn't :(
I'm probably missing something with this phase increment stuff (this is definitely one of the thing I'm still not sure to understand in the emulator code)

notaz: what did you do exactly to fix the MAME core ?

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Thu Jun 26, 2008 2:03 pm

What is this CSM mode ?
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Nemesis
Very interested
Posts: 791
Joined: Wed Nov 07, 2007 1:09 am
Location: Sydney, Australia

Post by Nemesis » Thu Jun 26, 2008 2:48 pm

Eke wrote:
Stef wrote:Yep, that should do it in theory.
As you said the YM2612 is probably using internally a non signed fixed size register and in some case it underflows. Your fix should emulate it correctly =)
well, it doesn't :(
I'm probably missing something with this phase increment stuff (this is definitely one of the thing I'm still not sure to understand in the emulator code)
I added the following lines to CALC_FINC_SL in Gens to approximate the effect when I was doing testing:
if(SL->Finc < 0)
{
finc = FINC_TAB[0x7FF] >> (7 - 0x7);
SL->Finc = (finc + SL->DT[kc]) * SL->MUL;
}
Based on what notaz said, you might find the result sounds closer if you set block to 5 instead of 7.
TmEE co.(TM) wrote:What is this CSM mode ?
CSM mode is another special mode for channel 3, where Timer A automatically does key on/off for the channel.

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Thu Jun 26, 2008 5:59 pm

I can't make use of CSM mode in my sound engine then... Timer A is used for SFX, Timer B for BGM, VBLs are not touched.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Thu Jun 26, 2008 6:01 pm

TmEE co.(TM) wrote:What is this CSM mode ?
It's a mode meant for formant speech synthesis. One of the better methods of synthesizing speech is to break it into the addition of resonant frequencies that last a specific time. These are called formants and if you add the correct ones, you get a phoneme. You might want to check the proper wiki pages for more info.

http://en.wikipedia.org/wiki/Speech_syn ... _synthesis
http://en.wikipedia.org/wiki/Formant

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Thu Jun 26, 2008 6:22 pm

For speech synthesis I use samples... 50K of samples are enough for well understandable text :) only limitation of my synth : you need to be Estonian to make it talk (all languages that have "say what you read" and no pronounciation stuff will do. in Estonian "a" is spelled exactly the same in any word you encounter not like in English where the pronounciation depends on word).
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

TulioAdriano
Very interested
Posts: 81
Joined: Tue Jul 10, 2007 7:45 pm
Location: Brazil / USA
Contact:

Post by TulioAdriano » Thu Jun 26, 2008 6:55 pm

It would work well for Portuguese, though, and most romance languages, except for French which has lots of irregularities... interesting, very nice.

Btw, I haven't seen any concrete report on the famous channel 3 special mode which would allow individual operators to be set on different frequencies.

As far as I know most tests on that feature failed to succeed, maybe wrong documentation again?
Image

notaz
Very interested
Posts: 193
Joined: Mon Feb 04, 2008 11:58 pm
Location: Lithuania

Post by notaz » Thu Jun 26, 2008 7:00 pm

Eke wrote:what did you do exactly to fix the MAME core ?
I changed the start of refresh_fc_eg_slot() to this:

Code: Select all

INLINE void refresh_fc_eg_slot(FM_SLOT *SLOT, int fc, int kc)
{
        int ksr, fdt;

        /* (frequency) phase increment counter */
        fdt = fc+SLOT->DT[kc];
        /* detect overflow */
        if (fdt < 0) fdt += fn_table[0x7ff*2] >> 2;
        SLOT->Incr = fdt*SLOT->mul >> 1;

...
Note that this only works when sampling @ 44.1hHz, so it's probably wrong. Multiplier may have something to do with all this too.

Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru » Thu Jun 26, 2008 7:08 pm

TulioAdriano wrote:Btw, I haven't seen any concrete report on the famous channel 3 special mode which would allow individual operators to be set on different frequencies.

As far as I know most tests on that feature failed to succeed, maybe wrong documentation again?
What you mean 'failed'? This mode works well both in emulators and on real hardware, some games use it. I even added basic support for this mode in TFM MM long ago.

Mask of Destiny
Very interested
Posts: 615
Joined: Thu Nov 30, 2006 6:30 am

Post by Mask of Destiny » Thu Jun 26, 2008 8:11 pm

Shiru wrote:
TulioAdriano wrote:Btw, I haven't seen any concrete report on the famous channel 3 special mode which would allow individual operators to be set on different frequencies.

As far as I know most tests on that feature failed to succeed, maybe wrong documentation again?
What you mean 'failed'? This mode works well both in emulators and on real hardware, some games use it. I even added basic support for this mode in TFM MM long ago.
My guess is he's thinking of the tests as to whether or not Channel 3 special mode also worked on Channel 6.

Post Reply