YM2151 LFO - Does my interpretation sound right?

Chat about anything CX16 related that doesn't fit elsewhere
ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

YM2151 LFO - Does my interpretation sound right?

Post by ZeroByte »


I'm beginning work on a YM2151 patch design program to run on X16. While going over all of the various inputs in the application manual, I came across something that is confusing (shocker, I know) regarding the LFO.

The PMD/AMD register is used to set the magnitude of the effect which the LFO has when modulating the phase / amplitude of the generated sound. phase = frequency in their terminology, and amplitude = sound's volume (obviously).

So here's the catch: there's just one register for both values.

My interpretation is as follows:

The OPM actually stores these two parameters separately inside the chip, but only uses one register to access them both. The register is 8 bits wide, but the values are 7-bit values. The MSB is used to tell the YM whether you're writing the PMD or the AMD. So if you were to write $8F, this would mean that you're setting PMD=$0F. If you write $04 to the register, it's going to set AMD=$04, and the PMD would remain $0F.

Here's the datasheet:

image.png.a00538dbef34004cb1f3e255c00ce2c5.png

So, community... do you agree with my interpretation of this?

ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

YM2151 LFO - Does my interpretation sound right?

Post by ZeroByte »


So in my design, I'm going to make separate knobs for PMD and AMD and presume that the chip considers these to be independent values, but that they're both set using the same register. (which is baffling, as there are several unused register addresses in the globals range $00-$1F)

Elektron72
Posts: 137
Joined: Tue Jun 30, 2020 3:47 pm

YM2151 LFO - Does my interpretation sound right?

Post by Elektron72 »



30 minutes ago, ZeroByte said:




So, community... do you agree with my interpretation of this?



I believe you have interpreted the documentation correctly, as VOPM allows these values to be controlled separately. Strangely, DefleMask does not allow these values to be controlled at all.

ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

YM2151 LFO - Does my interpretation sound right?

Post by ZeroByte »



21 minutes ago, Elektron72 said:




Strangely, DefleMask does not allow these values to be controlled at all.



I'd noticed that as well. I figured I may as well go plunk around with the LFO in Deflemask, which wouldn't be quite as easy as using the instrument editor IMO. The LFO and the noise function are two things I definitely want to make more easily accessible in my program than they currently exist in Deflemask.

Here's a mockup of the screen I'm working on...

image.thumb.png.a67140443a6ce62a2991a8a3451b80eb.png

The circles are "knobs" - I'll be doing some "tile work" to make them be graphical knobs, and the white squares are going to be those "flourescent" looking 8-segment digits. I'm going to build in a few simple music patterns for it to be running in the background as you twiddle the values so you can hear the effect real-time. Choices are going to be a few basic bass lines, a few chord progressions, and a single note. Probably also allow single note just play whenever you press a key. The biggest issue I see with that last mode is going to be detecting keys being held/released.

 

User avatar
Yazwho
Posts: 167
Joined: Fri Feb 19, 2021 2:59 pm
Contact:

YM2151 LFO - Does my interpretation sound right?

Post by Yazwho »



1 hour ago, ZeroByte said:




I'm beginning work on a YM2151 patch design program to run on X16. While going over all of the various inputs in the application manual, I came across something that is confusing (shocker, I know) regarding the LFO.



The PMD/AMD register is used to set the magnitude of the effect which the LFO has when modulating the phase / amplitude of the generated sound. phase = frequency in their terminology, and amplitude = sound's volume (obviously).



So here's the catch: there's just one register for both values.

My interpretation is as follows:



The OPM actually stores these two parameters separately inside the chip, but only uses one register to access them both. The register is 8 bits wide, but the values are 7-bit values. The MSB is used to tell the YM whether you're writing the PMD or the AMD. So if you were to write $8F, this would mean that you're setting PMD=$0F. If you write $04 to the register, it's going to set AMD=$04, and the PMD would remain $0F.



Here's the datasheet:

image.png.a00538dbef34004cb1f3e255c00ce2c5.png



So, community... do you agree with my interpretation of this?



You don't need to squint too hard to look at that and see the PSG in the VERA. 

So now I'm a bit confused. This is probably old news to everyone else here, but that does seem a bit odd. Do we have a feel for which we should be targeting?

Elektron72
Posts: 137
Joined: Tue Jun 30, 2020 3:47 pm

YM2151 LFO - Does my interpretation sound right?

Post by Elektron72 »



26 minutes ago, Yazwho said:




You don't need to squint too hard to look at that and see the PSG in the VERA. 



So now I'm a bit confused. This is probably old news to everyone else here, but that does seem a bit odd. Do we have a feel for which we should be targeting?



This is describing the YM2151's Low Frequency Oscillator (LFO). Rather than directly producing sound, the LFO uses these waveforms to change the frequency and volume of the audible channels. This can be used to produce vibrato, tremolo, and other effects without requiring extra writes to the chip. There is only one LFO in the YM2151.

ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

YM2151 LFO - Does my interpretation sound right?

Post by ZeroByte »


The data sheet is rife with errata. The section describing the LFO frequency register states that the LFO’s range is from 0.008hz to 53Mhz. Like that’s almost FM radio band lol.

edit: had to look it up. 50Mhz is maritime mobile, and/or old VHF TV.

BruceMcF
Posts: 1336
Joined: Fri Jul 03, 2020 4:27 am

YM2151 LFO - Does my interpretation sound right?

Post by BruceMcF »



7 hours ago, ZeroByte said:




I'm beginning work on a YM2151 patch design program to run on X16. While going over all of the various inputs in the application manual, I came across something that is confusing (shocker, I know) regarding the LFO.



The PMD/AMD register is used to set the magnitude of the effect which the LFO has when modulating the phase / amplitude of the generated sound. phase = frequency in their terminology, and amplitude = sound's volume (obviously).



So here's the catch: there's just one register for both values.

My interpretation is as follows:



The OPM actually stores these two parameters separately inside the chip, but only uses one register to access them both. The register is 8 bits wide, but the values are 7-bit values. The MSB is used to tell the YM whether you're writing the PMD or the AMD. So if you were to write $8F, this would mean that you're setting PMD=$0F. If you write $04 to the register, it's going to set AMD=$04, and the PMD would remain $0F.



Here's the datasheet:

image.png.a00538dbef34004cb1f3e255c00ce2c5.png



So, community... do you agree with my interpretation of this?



It specifies that the individual piece of information (datum, "data" is its plural) is the 7bits and the high bit distinguishes between the two, and it refers to a PMD controlled item and an AMD controlled item, so yes, going by the language, there are two internal 7bit registers controlling those two functions and they are accessed via a common register address.

ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

YM2151 LFO - Does my interpretation sound right?

Post by ZeroByte »


The thing that really clued me in is the way the keyon register has similar behavior- multiple internal values all accessed via a single register based on what value is in certain bits.

Greg King
Posts: 162
Joined: Wed Jul 08, 2020 1:14 pm

YM2151 LFO - Does my interpretation sound right?

Post by Greg King »


The language in the description doesn't make it clear whether or not the LFO can do both modulations at the same time.  Maybe, the F bit controls the output Function of the LFO (either it changes the frequency of another oscillator, or it changes the volume of that oscillator, but not both).

Post Reply