notes for CX16 music/SFX creation.

Talk about anything not remotely related to retrocomputing here!
GTR3QQ
Posts: 146
Joined: Wed Apr 05, 2023 8:04 pm

Re: notes for CX16 music/SFX creation.

Post by GTR3QQ »

OPNx 2 OPM/P LFO speed convertion.

There's three bits on OPNx chips, ranging a speed from 3.98hz to 72.2hz phiM@8mhz.

But on OPM, there's 8 bits controlling the speed, ranging from 0.0008hz to 57.4127hz(?)
if you can read the YM2151's app manual.....

if you can't, here's the code for calculating it.

from Github/mooinglemur/zsmtool

lfo = ((((0x10 | (n & 0xf)) << (n >> 4))) /2**36) * 3579545

if this's not good enough, here's a LUT

Mooinglemur's cycle accurate LFO speed lut
YM2151 LFO.xlsx
(17.29 KiB) Downloaded 93 times

It's easy to conclud 7 setting on OPNx can't be reached, it just maxs to FF at 57hz.

here's some photos from Yamaha of OPM running at 4mhz for reference only, don't take for granted as x16 running at 3.58mhz.
image.png
image.png (318.32 KiB) Viewed 1522 times
image (1).png
image (1).png (83.76 KiB) Viewed 1522 times
GTR3QQ
Posts: 146
Joined: Wed Apr 05, 2023 8:04 pm

Re: notes for CX16 music/SFX creation.

Post by GTR3QQ »

Here's some very well-established differences of OPNx and OPM/P/Z chips, but no one's (on English web that is) talking about.
See OPNA OPM application manual for details.
And IKAOPM IKAOPN for Verilog codes of what's up internally.
if I typed PMD/AMD, I mean PMS AMS, don't know where I picked the PMD AMD up.


A. on OPNx, the LFO waveform is Sine wave, while OPM/P/Z, it's Trianlge/Saw/Square/Noise.
See graph for the starting point/phase difference.
Phaseforthoughts.png
Phaseforthoughts.png (47.69 KiB) Viewed 1415 times
OPM would starts from the lowest 'db'(highest TL..) then work it's way increasing volume/bandwidth until reaching highest point of amplitude(lowest TL) then invert.
OPNx would starts at the mid point.

It's uncertain what the TL written to the operator dictates, a quick check of IKAOPM I should.

B. DT1 is different, when running OPNx at 7.6MHz(PAL, SEGA MD) and OPM at 3.58MHz. Very small, but you're going to hear the beat frequency is different. OPM DT1 running faster than OPNx at above phiM.

C. on OPM, you can't turn off LFO.
It's still running at very slow speed after /IC is cleared, 0.0008hz or 21 minutes per cycle.
You might want to clear PM/AMD AMON bits to avoid unwanted things.......
I've been told there's a hardware bug on OPN that does similar behaviour, I quote 'If you disable LFO of OPNx and set AMS to to a non-zero value operators that has AM enabled will be attenuated. LFO Speed doesn't have any effect. It's mostly noticeable with AMS = 3
'
I presume the OPNx bug is intentional to retain somewhat of a similar behaviour from OPM, I can't be sure as I didn't check the IKAOPM IKAOPN yet.

D. AMD/PMD is of different depths on OPM OPNx with OPM being more sensitive.

E. LFO frequency is mostly overlapped but 7(OCT) on OPNx can't be reached on OPM.
A reference LUT for conversion.
From SEGA MD(PAL,OPN2@7.61MHz) to CX16(OPM@3.58MHz)
$lfotable = array ( 0xc2, 0xC9, 0xCB, 0xCD, 0xCF, 0xD6, 0xFB, 0xff );
It's still not perfect as it's essentially running at different phiM with different core, but close enough apart from 7(OCT).

F. sample rate is different, this affects the NyquistFrequency, i.e. where it would start aliasing.

0.SSG-EG.............no need to say no more, as it's the only point on this list being gone into mostly.


Think twice when seeing things like OPM=OPN but SSG-EG.
Please check IKAOPM IKAOPN for more info.
Post Reply