New Documentation: An authoritative reference on the YM2612

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

Moderator: BigEvilCorporation

AamirM
Very interested
Posts: 472
Joined: Mon Feb 18, 2008 8:23 am
Contact:

Post by AamirM » Sun Jun 08, 2008 4:28 am

Hi,

No. At least not in Regen. But I think the current linear approximation is good enough.

stay safe,

AamirM

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sun Jun 08, 2008 10:00 pm

AamirM wrote:Hi,

No. At least not in Regen. But I think the current linear approximation is good enough.

stay safe,

AamirM
Correctly emulated in Gens as far i remember.
Last edited by Stef on Mon Jun 09, 2008 5:33 pm, edited 1 time in total.

AamirM
Very interested
Posts: 472
Joined: Mon Feb 18, 2008 8:23 am
Contact:

Post by AamirM » Mon Jun 09, 2008 5:18 am

Hi,

Nice. I'll have a look at that. With what exponential relation does it rise? Do you have a formula?

stay safe,

AamirM

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

Post by Eke » Mon Jun 09, 2008 3:54 pm

I'm curious, what is the SSG part mapped in registers 00-0Fh (which does not exist on YM2612).

Otherwise, for keeping some record of it, I tried to list some of the new informations that we don't have in the first doc and that might applied to Ym2612 also:


.Key OFF/ON register and operator assignation:


Image


.Feedback values:
Image


.SSG-EG register:
Image
I imagine this could be quickly tested in a modified emu ?

.Timer exact periods:
Image
This confirms what we were initially thinking, internal clock is VCLK/144 and timerA period is half the internal period. We retrieve this value in FNUM calculation:

Image

. CH3 special mode and "illegal" CSM mode:
Image
we need some translation for this one ;)

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Mon Jun 09, 2008 5:39 pm

AamirM wrote:Hi,

Nice. I'll have a look at that. With what exponential relation does it rise? Do you have a formula?

stay safe,

AamirM
Enveloppe is defined in the "ENV_TAB", first part is for attack and i defined it as follow :

Code: Select all

  for(i = 0; i < ENV_LENGHT; i++)
  {
    // Attack curve (x^8 - music level 2 Vectorman 2)
    x = pow(((double) ((ENV_LENGHT - 1) - i) / (double) (ENV_LENGHT)), 8);
    x *= ENV_LENGHT;
    ENV_TAB[i] = (int) x;

    // Decay curve (just linear)
    x = pow(((double) (i) / (double) (ENV_LENGHT)), 1);
    x *= ENV_LENGHT;
    ENV_TAB[ENV_LENGHT + i] = (int) x;
  }
As you can see i used x^8, i guess level 2 in vectorman was very sensitive to that (see the comment i left) ;)

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

Post by Shiru » Mon Jun 09, 2008 5:52 pm

Eke wrote:I'm curious, what is the SSG part mapped in registers 00-0Fh (which does not exist on YM2612).
It is not related to FM synth or SSG-EG register. It's AY-3-8910/YM2149 part, same as in YM2203.

I think, SSG-EG register named so just because it controls envelope in similar way like AY-3-8910 does.

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) » Mon Jun 09, 2008 9:29 pm

YM2612 timers in MD manual are all wrong. They're based on 8MHz not 7.6MHz and the Freq numbers for one octave's notes they had are all whipped off form this datasheet it seems, all wrong for MD.
I had so much trouble getting the the value of the timer when I tried to have MD tracker and TMSE running at same speed... according to PC's PIT, the speed I got would be 49.4Hz, but the correct YM2612 calculation says its 49.9Hz... the PC runs faster with its 49.4 than MD with its 49.9 which makes no sense...
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 » Tue Jun 10, 2008 1:44 am

Fortunately, they do provide clock-independent formulas for calculating frequency values and timer intervals in this manual:

Code: Select all

F-Number = (144 * fnote * 2^20 / M) / 2^(B-1)
	fnote:  Frequency Data
	M:      Master clock (Hz)
	B:      Octave Data

tA = 72 * (1024 - NA) / M
	NA:     0~1023
	M:      Master clock (MHz)

tB = 1152 * (256 - NA) / M
	NB:     0~255
	M:      Master clock (MHz)
EDIT: Note that the frequency calculation uses the clock frequency in Hz, while the timer calculations use the clock frequency in MHz. Also note the timer calculations are returning the timer interval in microseconds. You can see from the formulae that timer A counts down once every 72 clock pulses, and timer B counts down once every 1152 clock pulses (72 * 16).

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

Post by Nemesis » Tue Jun 10, 2008 2:59 am

Looking again at the Sega documentation, the formulae they provide for timer calculation are very different to the numbers from the YM2608 manual.

Code: Select all

Timer A:
18 * (1024 - TIMERA) microseconds

TIMER A = all 1's -> 18usec = 0.108ms
TIMER A = all 0's -> 8400usec = 18.4ms

Timer B:
288 * (256 - TIMERB) microseconds

TIMER B = all 1's -> 0.288ms
TIMER B = all 0's -> 73.44ms
Comparing those simplified formulae to the ones in the YM2608 manual, Sega have either calculated these assuming a clock speed of 4MHz, or the dividers for the timers are different. It's quite possible the YM2612 has timers which have half the rate (144 clock pulses for Timer A, 144*16=2304 clock pulses for Timer B), and they've calculated for 8MHz. Can anyone confirm this?

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

Post by Eke » Tue Jun 10, 2008 8:09 am

here's the calculation I once made to find the exact timer period, however this is purely theorical:

http://www.spritesmind.net/_GenDev//for ... .php?t=228

YM2612 is probably dividing input clock by 2:
72/(VCLK/2/1000000) = 18.77 microseconds
1152/(VCLK/2/1000000) = 300.37 microseconds

AamirM
Very interested
Posts: 472
Joined: Mon Feb 18, 2008 8:23 am
Contact:

Post by AamirM » Tue Jun 10, 2008 9:07 am

Hi,

@ Stef

Thanks a lot.

@ Eke

Nemesis has given a translation of CSM mode on the previous page.

@ TmEE

Could you please tell what quirks are you talking about besides the DAC?

stay safe,

AamirM

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) » Tue Jun 10, 2008 12:35 pm

Quirks are setting the "ganged" together registers backwards, previous instruments' settings affecting next instrument to some extent...

It is very possible that YM2612 divides input clock by 2, as when I calculated the timer period, I got double result, ~100Hz instead of ~50Hz.
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

AamirM
Very interested
Posts: 472
Joined: Mon Feb 18, 2008 8:23 am
Contact:

Post by AamirM » Tue Jun 10, 2008 2:42 pm

Hi,

Do you have some examples (audible) containing those quirks? I only have your DAC test program.

stay safe,

AamirM

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) » Tue Jun 10, 2008 8:17 pm

just make a small test proggy for MD, and listen in Fusion, it does ALL sound as real HW, all the various noises and such.
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 » Sun Jun 15, 2008 12:08 pm

Ok, I've just completed a translation of this document, using the OCR function in Adobe Acrobat Professional, and a web-based Japanese translator at http://www.excite.co.jp/world/english which was recommended to me. I've been manually correcting OCR errors along the way, which in some cases meant looking through tables of several thousand Kanji, and bashing away at problem portions of the text until they made sense. I've preserved the page numbers of the original document, and largely preserved the original formatting. Yes, it took a lot of work. Here's the translated PDF:
http://nemesis.hacking-cult.org/MegaDri ... slated.PDF

The results are surprisingly good. The scans are clear enough and high resolution enough for the OCR to clean up. There was probably around a 99% success rate for the OCR, with most of the errors being simple accent problems. The web-based translator is also probably the best one I've seen. It's on a Japanese site, it only deals with English and Japanese, and it beats the Google translator into the ground. I haven't rewritten or restructured the output of the web translator, so some of it is a little backwards, but if you have a good grasp of English, the meaning should be clear in most cases. I'm not going to reword the output from the online translator, as I can't read Japanese, so I can't proof-check my translation against the original meaning of the text, and I don't want to risk losing any more information in the translation process.

Note that pages 57-67 are not included in this translation. These pages aren't actually part of the main document, they're part of a separate document which is all about the physical properties of the chip, and the bus timings. Unfortunately, the quality of the scan is worse than the main document, and the font is different. The OCR doesn't cope nearly as well with it, so it would be slow and painful to translate, and I don't feel the urge to do it. These are probably different for the YM2612 anyway. You won't find anything important in this section though if you're just trying to emulate or use the YM2612.


Anyway, hopefully this will open the document up for some more people to make use of.

Post Reply