Page 1 of 2

### Some beginner questions concerning YM2612

Posted: Sun Apr 21, 2019 8:43 pm
Sorry for the naive questions, but I'm totally new to these things...

Since it's a technical question about something I don't master, I'll ask in English and in French, in case my English would be a little broken. Also, if your French is better than your English, please answer in French, it'll be easier for me

Here is what I undersood up to now :

There are six channels. Each channel has its own fundamental frequency (set by registers A0 to A6). I didn't study yet the special behaviour of the last channel.

The sound of a channel is synthetised by 4 different oscillators (called operators), tied together by one of the 8 algorithms (called connexions). Each operator is descibed by :

* its frequency, which is an integer multiple of the fundamental frequency (or half of it), thanks to MUL, maybe slightly modified by detune DT1

* a volum enveloppe, described by TL, AR, D1R, T1L, D2R, RR

Did I understand correctly ? Each operator has its own volum enveloppe ? Not just the channel ?

What bothers for the moment is : how to read the diagrams describing the 8 algorithms ? (which can be seen here, for example)

For example, if at some moment operator #i has an amplitude of a_i and a frequency of w_i, and that I use the 1st algo, will the output be :

a_1*sin(w_1*t + a_2*sin(w_2*t + a_3*sin(w_3*t + a_4*sin(w_4*t)))) ?

Whereas, if I use the 2nd algo, it'll be :

a_1*sin(w_1*t + a_2*sin(w_2*t + a_3*sin(w_3*t) + a_4*sin(w_4*t))) ?

=========================================================

Voici ce que je crois avoir compris :

Il y a six canaux.

On peut affecter à un canal une fréquence fondamentale (à l'aide des registres \$A0 à \$A6)

Le son d'un canal est produit par 4 oscillateurs (appelés opérateurs) différents, reliés par un algorithme, parmi 8 possibles, appelés connexions. Chaque opérateur dispose :

* d'une fréquence propre, qui est un multiple entier (ou la moitié) de la fondamentale, grâce aux registres MUL, éventuellement légèrement modifié par le detune DT1

* d'une enveloppe propre, décrite par les TL, AR, D1R, T1L, D2R, RR

Déjà, est-ce que c'est bon jusqu'à présent ? Chaque opérateur a bien sa propre frequence et enveloppe ?

Ce que je n'ai pas compris : comment dois-je lire les diagrammes qui représentent les algorithmes (qu'on peut trouver ici, par exemple) ?

Par exemple, si à l'instant t les 4 opérateurs ont des amplitudes a_i et des fréquences w_i, et que j'utilise le premier algorithme, le signal de sortie est-il : a_1*sin(w_1*t + a_2*sin(w_2*t + a_3*sin(w_3*t + a_4*sin(w_4*t)))) ?

Alors que pour le deuxième ce serait : a_1*sin(w_1*t + a_2*sin(w_2*t + a_3*sin(w_3*t) + a_4*sin(w_4*t))) ?

### Re: Some beginner questions concerning YM2612

Posted: Tue Apr 23, 2019 7:04 am
Not much success, but I have more questions

Concerning volume envelope, what are the resolution of both time and amplitude ?

For the 1st part of the envelope, I understand that I must "add" AR to the amplitude, but how often ?

Also, I read that one unit in AR was equivalent to a gain of 0.75 dB, so I must multiply amplitude by (10^(.75/10))^AR = 1.189^AR ?

==============

Sur l'enveloppe, quelles sont les résolutions horizontale (temps) et verticale (amplitude) ?

Par exemple, si j'ai bien compris, je dois additionner l'AR à chaque pas de temps (enfin, le soustraire mais l'amplitude finale doit être, en dB, 96 - l'amplitude calculée), mais c'est quoi, le pas de temps ? Le seul nombre que j'ai trouvé dans la Doc est un étrange 8 Mhz, mais ça m'étonnerait que le signal de sortie soit à cette fréquence...

Quant au gain d'amplitude, il est dit qu'une unité d'AR correspond à un gain de 0.75 dB, donc je suppose que l'unité est logarithmique, donc je dois multiplier l'amplitude par (10^(.75/10))^AR = 1.189^AR ?

### Re: Some beginner questions concerning YM2612

Posted: Tue Apr 23, 2019 9:25 am
And another one :

Concerning frequency, the document at smspower linked above says a typical 12 tones sequence is :

Code: Select all

``````Low                                                              High
617   653   692   733   777   823   872   924   979  1037  1099  1164
635   372   392   755   800   847   898   951   1008  1131  1199
(36)  (39)  (41)  (44)  (46)  (49)  (52)  (55)  (58)  (62)  (70)``````
That leads to several questions :

1) it's a typical half-tone sequence? (have I said that I have no musical education ? )

2) if so, what are the second line values referring to ? Shouldn't the 372 and 392 be 672 and 692 ?

3) what's the 3rd line for ?

4) why do we use only value between 617 and 1199 whereas we have 2^11 = 2048 possible ?

================================

À propos des fréquences, le document du site smspower cité au-dessus dit qu'on peut obtenir une suite de 12 tons de la façon suivante :

Code: Select all

``````Low                                                              High
617   653   692   733   777   823   872   924   979  1037  1099  1164
635   372   392   755   800   847   898   951   1008  1131  1199
(36)  (39)  (41)  (44)  (46)  (49)  (52)  (55)  (58)  (62)  (70)``````
J'ai plusieurs questions :

1) la première ligne, c'est pas plutôt des demi-tons ? Je suppose qu'il veut parler d'une "gamme" complète (DO, DO#, etc. jusqu'au SI, ça fait 12 demi-tons, si j'en crois le peu de culture musicale que je possède)

2) dans ce cas, c'est quoi, la deuxième ligne ? Des quart de tons ? Dans ce cas, le 372 et le 392, c'est pas plutôt 672 et 692 ?

3) quant à la 3ème ligne (entre parenthèses) , c'est quoi ?

4) et pourquoi a-t-on des valeurs 617 et 1199 alors qu'on a 11 bits pour décrire la gamme ? Les valeurs avant 617 et après 1199 sont donc hors de l'octave, du coup y'a des redondances ?

### Re: Some beginner questions concerning YM2612

Posted: Tue Apr 23, 2019 3:34 pm
1) Start here: https://en.wikipedia.org/wiki/Musical_n ... atic_scale
Keep reading past the section on 'Note frequency (hertz)'.

2) Yes, those numbers are clearly wrong. The 372 should 672, and the 392 should be 713. The last two numbers are also clearly wrong. The first line are the major notes for a 12 note octave. The second line are the half-tones between the major notes.

3) The third line seems to be the difference between notes count values.

4) The chip is fed with a high frequency clock that is divided down to get the frequencies that make the standard scale notes. They aren't exact, but rather just "close". You want the clock to be high enough that you get fairly big divisors to make the error small, but not so big as to require a big frequency divider circuit. Values from 600 to 1200 are pretty good in that respect, at least for the time period when the 2612 was relevant.

### Re: Some beginner questions concerning YM2612

Posted: Tue Apr 23, 2019 5:19 pm
1) Ok, seems a misconception of the word "tone" here. They indeed are half-tones (or semi-tones).

2, 3) Thanks for clarifying.

4) Thanks. I've just discovered the translation of the japanese manual posted by Nemesis years ago, it explained where these figures came from. I'm looking into it for answers to other questions

### Re: Some beginner questions concerning YM2612

Posted: Tue Apr 23, 2019 10:53 pm
Nope, there's something fundamental I missed. I don't understand how to determine the delay between two update of the envelope generator.

For example, if AR = 63 (Attack Rate), how long does it take to reach the maximum amplitude ?

I don't even understant if AR is supposed to be a delay (in which unity) or a slope (in which unity), documents countradict themselves on this subject...

### Re: Some beginner questions concerning YM2612

Posted: Wed Apr 24, 2019 7:39 am
AR is the attack rate, telling you at which speed we raise the Total Level (TL). 63 is a special value so envelop immediately reach the Total Level.
The best way to find those information is to analyze sources of YM2612 emulator.

Something you may have a look into is the init() method of Gens YM2612 core :
https://www.javatips.net/api/JVerge-mas ... M2612.java

It's definitely not the most accurate core but the init method at give at least hint about how different internal rate tables are computed from the YM frequency.

Also searching for some good YM2612 document i found that awesome stuff :
https://www.mathieudemange.fr/wp-conten ... Manual.pdf

### Re: Some beginner questions concerning YM2612

Posted: Wed Apr 24, 2019 12:54 pm
The limit for AR is 31 tho. It's also instantaneous in that case anyway (since it's the maximum value).

Also AR/DR/SR/RR all represent slopes (i.e. the angles). Not sure the exact way to measure them, but higher value = steeper slope (and 0 = stays flat… something you should probably avoid in AR's case, but makes sense for DR and SR).

### Re: Some beginner questions concerning YM2612

Posted: Thu Apr 25, 2019 6:56 am
Stef wrote:
Wed Apr 24, 2019 7:39 am
AR is the attack rate, telling you at which speed we raise the Total Level (TL). 63 is a special value so envelop immediately reach the Total Level.
The best way to find those information is to analyze sources of YM2612 emulator.
I looked into an old (and quite ugly) version of MAME driver (from a vgm player), a more recent one, Blastem... They are quite difficult to follow when you have obscure ideas as to how it works
Something you may have a look into is the init() method of Gens YM2612 core :
https://www.javatips.net/api/JVerge-mas ... M2612.java

It's definitely not the most accurate core but the init method at give at least hint about how different internal rate tables are computed from the YM frequency.
It makes no exception Maybe a little easier

I'm struggling to understand what every parameter is for... Also, I have no idea where these numbers come from. I didn't see most of them on any documentation.
Also searching for some good YM2612 document i found that awesome stuff :
https://www.mathieudemange.fr/wp-conten ... Manual.pdf
Unfortunately, this document stays quite evasive about precise figures (and in particular about how long each step of the envelop lasts).

For the moment, the most precise document I found is this one.

### Re: Some beginner questions concerning YM2612

Posted: Thu Apr 25, 2019 7:01 am
Sik wrote:
Wed Apr 24, 2019 12:54 pm
The limit for AR is 31 tho. It's also instantaneous in that case anyway (since it's the maximum value).
This isn't the case that cause me headaches
Also AR/DR/SR/RR all represent slopes (i.e. the angles).
Angles, or derivates (i.e. tangent of angles) ? That's more the meaning of "rate" for me (and it is different if angle isn't small). I know very few bout electronics, but I guess a device full of oscillators may not have much more difficulties in handling trigonometrics functions than simple accumulators...

And then again, the problem of unities is crucial.

### Re: Some beginner questions concerning YM2612

Posted: Thu Apr 25, 2019 7:28 am

### Re: Some beginner questions concerning YM2612

Posted: Thu Apr 25, 2019 4:21 pm
tryphon wrote:
Thu Apr 25, 2019 7:01 am
Angles, or derivates (i.e. tangent of angles) ? That's more the meaning of "rate" for me (and it is different if angle isn't small). I know very few bout electronics, but I guess a device full of oscillators may not have much more difficulties in handling trigonometrics functions than simple accumulators...
I think it just adds a given value every time it processes the envelope.

For what's worth it, you may want to look into the FM Towns documentation (FM Towns also has a YM2612), they went absurd with the details there (they straight up included every outcome for every single possible value for just about everything). Only problem is that it's in Japanese.

### Re: Some beginner questions concerning YM2612

Posted: Sat Apr 27, 2019 8:32 pm
I tried another approach : I created a very simple VGM file, only one note, with variable AR (1 to 8) and TL (0 or 64), played it in various decoders (winamp with vgm reader plugin, Gens) and looked the resulting wav file in Audacity.

Some strange things :

1) the results are not exactly the same (even if it was expected)

2) the envelops are not linear (whether I use logarithmic scale or linear), which contradicts all documents I've read...

3) From what I had understood, if I double TL without changing AR, the Attack phase should last twice as long. But I observed exactly the same time in both situations...

ASAP, I'll try to find a Jack cable to record from my Model 1 MD...

### Re: Some beginner questions concerning YM2612

Posted: Sat Apr 27, 2019 11:13 pm
Attack is done with reverse logarithmic slope while other things are done with normal logarithmic slopes. The way envelopes progress is tied to couple LUTs, after every certain amount of samples according to one LUT and ADSR settings, a value from another LUT is added to the attenuation value. Attack phase does little extra calculation to produce the reverse log slope compared to remaining phases of the envelope.

### Re: Some beginner questions concerning YM2612

Posted: Sun Apr 28, 2019 9:37 pm
TmEE co.(TM) wrote:
Sat Apr 27, 2019 11:13 pm
Attack is done with reverse logarithmic slope while other things are done with normal logarithmic slopes.
Thanks, it makes perfect sense !
The way envelopes progress is tied to couple LUTs, after every certain amount of samples according to one LUT and ADSR settings, a value from another LUT is added to the attenuation value. Attack phase does little extra calculation to produce the reverse log slope compared to remaining phases of the envelope.
Are these referenced somewhere ?