Page 1 of 2

YM2151 LFO - Does my interpretation sound right?

Posted: Fri Jul 16, 2021 5:26 pm
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?


YM2151 LFO - Does my interpretation sound right?

Posted: Fri Jul 16, 2021 5:29 pm
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)


YM2151 LFO - Does my interpretation sound right?

Posted: Fri Jul 16, 2021 6:17 pm
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.


YM2151 LFO - Does my interpretation sound right?

Posted: Fri Jul 16, 2021 6:37 pm
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.

 


YM2151 LFO - Does my interpretation sound right?

Posted: Fri Jul 16, 2021 7:17 pm
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?


YM2151 LFO - Does my interpretation sound right?

Posted: Fri Jul 16, 2021 7:51 pm
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.


YM2151 LFO - Does my interpretation sound right?

Posted: Fri Jul 16, 2021 11:49 pm
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.


YM2151 LFO - Does my interpretation sound right?

Posted: Sat Jul 17, 2021 1:20 am
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.


YM2151 LFO - Does my interpretation sound right?

Posted: Sat Jul 17, 2021 2:20 am
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.


YM2151 LFO - Does my interpretation sound right?

Posted: Sat Jul 17, 2021 3:16 am
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).