Jump to content

YM2151 LFO - Does my interpretation sound right?


Recommended Posts

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?

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Posted (edited)
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.

 

Edited by ZeroByte
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

Posted (edited)

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.

Edited by ZeroByte
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

3 hours ago, Greg King said:

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).

That is a possible interpretation. It  does, however, refer to them as distinct items controlled by distinct circuits, so the two 7bit registers / extra address bit reading fits the language most closely.

So I did a search, and found this in the VOPM Unofficial User Guide:

Quote

LFO

VOPM has a single LFO which can be used to modulate pitch, amplitude, or both.

So it's an extra address bit.

 

Edited by BruceMcF
  • Like 1
Link to comment
Share on other sites

22 hours ago, Elektron72 said:

Do we have a feel for which we should be targeting?

Target whichever one you are more comfortable with. Both are going to be on the X16. The PSG is going to give you something more like the C64 SID (but not quite) while the YM2151 will give you something like the AdLib or Sound Blaster FM synthesis (but not quite). The PSG can be programmed much more easily, but you can use commercial software (namely Deflemask) as a tracker for the YM2151 and get all the register writes and timing that you need to do. I made videos about both so you can see how they work:

PSG:

 

YM2151:

I will also be making a video on how to use the PCM in the future, as well. 

  • Like 1
Link to comment
Share on other sites

I realize that this suggestion is at least two years late, but...

The Microsoft-Fujitsu FM-8/7/77 BASIC, which itself was a fork of Microsoft-Tandy CoCo BASIC, had three major divergences from its basis.  Obviously, the toggleable option for Japanese kanji and kana reserved words, and the BLOCK reserved word (for drawing objects onscreen) wouldn't be particularly useful for the Commander X16.  That leaves the BEAT and NOTE reserved words, which were used for accessing the registers of various Yamaha sound chips.*

Obviously, hand-coding the PCM channel from the BASIC prompt, complete with selective garbage collection and reloading would be painful in the extreme, but those two reserved words should be usable with the YM2151 and VERA PSG.

Or maybe the development team already has its own solution, in which case I'll get out the pudding mix, heavy cream, and Graham cracker pie crust to prepare the perfect pie to shove in my face.  😃

 

*First the YM2149 SSG, then various Yamaha sound chips, ending in the YM2608 OPNA.

Link to comment
Share on other sites

I once suggested that a bank of unused ROM space be loaded up with a bunch of stock YM instruments, and that a BASIC command like FMPATCH voice#,patch# and FMNOTE voice#,keycode  be done. I think those 2 primatives would be quite useful for FM. I also made a suggestion that the kernal's init routine could install some kind of basic default instrument to all 8 YM voices, making it dead simple to poke some dings on the chip.

If the YM were pre-initialized by the boot sequence, this is all it would take to play a concert A note on voice 0:
POKE $9F40,$28 : POKE $9F41,$4A  // put $4A --> YM $28  (concert A into voice 0 freq select)
POKE $9F40,8 // select KeyUP/KeyDN register on YM
POKE $9F41,0 : POKE $9F41,$78  // keyUP voice 0, keyDN voice 0

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

Please review our Terms of Use