It is currently Mon Sep 24, 2018 10:15 pm

All times are UTC - 7 hours

Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: FM Synthesis information
PostPosted: Wed Apr 06, 2005 12:23 am 
I've been interested in writing emulation code for the VRC7 sound circuitry, and I'm running into a major roadblock: I can't make head or tail of *any* of Yamaha's FM chip documentation.

I have successfully written emulation code for various programmable sound generators including the 2A03 sound subsystem, the GameBoy sound subsystem, and the SN76496. All of these (as well as various other early sound chips like the AY-3-8910 and Pokey) seem to function in a roughly similar manner: the system clock is used to count down (or up) a programmable timer, and when the timer underflows (or overflows), it then clocks a logic circuit like a duty cycle generator or XOR-feedback register that creates the sound waveforms. Of course, some chips like the 2A03 incorporate additional timers that can be used to automatically update certain sound parameters at certain times, but the basic principle is similar for all of these chips. (I'd like to thank Matt Conte for assisting me with the basic principles of digital sound synthesis. Brad Taylor's documentation and Kevin Horton's technical know-how was also most helpful in obtaining a basic understanding of these circuits.)

The Yamaha YM-series FM chips *seem* wildly different. I'm not convinced they truly are. According to Vortexion's sound page: "The chips all operate in the digital domain, using adders, multipliers and look-up tables to achieve the sine wave modulation." So it seems plausible to me that the YM-series chips may simply be more complicated PSGs with more and more varied waveforms, wavetable ROMs, and timers than the old ones.

Unfortunately, the datasheets on these chips are completely incomprehensible to me. They're filled with terms both technical and musical that might as well be Greek to me. Very little documentation is provided as to what these terms mean; the sheets seem to be geared towards someone with a double major in music and advanced calculus. Nth-order Bessel functions? Detune? Key on/off? I don't know what any of this means. Has anyone written a simple explanation of how any of these chips *actually work* on a low hardware level? Something similar to Brad Taylor's NES 2A03 documentation or Kevin Horton's VRCVI info. Can anyone provide me with any help on this subject? I'm completely lost.

- Josh

 Post subject:
PostPosted: Wed Apr 06, 2005 5:51 am 

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20573
Location: NE Indiana, USA (NTSC)
The basic method behind FM synthesis is y = A sin(2πcft + I sin(2πmft)) where, for a musical sound, f controls the fundamental frequency, c and m are small integers that determine the character of the sound, A controls the amplitude, and I controls the intensity of modulation. As for the terms:
  • "Detune" means two oscillators are placed out of small integer ratios. I'd guess that in the context of the YM chips, it means setting c an m to an irrational ratio to produce a non-harmonic result, imparting a metallic or percussive character to the tone.
  • "Key on" and "key off" respectively mean starting and stopping a note.
  • "Bessel functions" are just a way to predict the output bandwidth of an FM signal. The chip doesn't actually use them.
Wikipedia may help more.

 Post subject:
PostPosted: Mon May 30, 2005 11:09 am 
Yamaha's FM chips use phase accumulating oscillators, similar to the Commodore SID chip. This is why they specify frequency in the registers rather than period. (as with divide by n counters)

Some of them use an exponential lookup table to convert between musical intervals ("cents") and actual frequencies; however the cheaper ones such as the YM2413 use direct frequency settings in the registers. There's a mantissa (9 bit in YM2413) and an exponent (3 bit in YM2413) which can be converted into a 16 bit value by multiplying the mantissa by 2^exponent.

YM2413 outputs a new sample for each channel every 72 cycles, so the sample rate for a 3.58MHz clock is 3.58MHz/72.

Each 'operator' consists of an oscillator and a combined envelope generator/amplifier. Both are implemented digitally; the oscillators work by stepping through a sine wave lookup table at a rate determined by the frequency setting (see articles on phase-accumulating oscillators) and the envelope generators/amplifiers work by multiplying the output of the lookup table by an amplitude setting, which is incremented and decremented over time according to attack, decay and release rates.

'FM' synthesis (actually phase modulation in this case) is achieved by adding the output of one operator (i.e. one oscillator and envelope generator combination) to the phase accumulating oscillator of another operator. This means that the rate at which the second phase accumulating oscillator steps through the sine wave lookup table is modified by the output of another sine wave oscillator.

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 7 hours

Who is online

Users browsing this forum: No registered users and 3 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group