I want to emulate the Genesis Sound System.
Moderator: BigEvilCorporation
I want to emulate the Genesis Sound System.
Hi......
I'm implementing my Genesis emulator and now I want to emulate the sound.
I dont have any previous experience, so I dont know where to start.
I got the YM2612 translated manual posted by Nemesis, but without knowledge on this subject this document is mostly useless to me, because I dont know the theory.
So I need some basic documentation about how I could emulate the Genesis sound.
Someone can helpme?
thanks.
I'm implementing my Genesis emulator and now I want to emulate the sound.
I dont have any previous experience, so I dont know where to start.
I got the YM2612 translated manual posted by Nemesis, but without knowledge on this subject this document is mostly useless to me, because I dont know the theory.
So I need some basic documentation about how I could emulate the Genesis sound.
Someone can helpme?
thanks.
http://en.wikipedia.org/wiki/FM_synthesis
http://en.wikipedia.org/wiki/Phase_modulation
Read this and the links, then take a look into other's code - MAME, Gens, etc.
http://en.wikipedia.org/wiki/Phase_modulation
Read this and the links, then take a look into other's code - MAME, Gens, etc.
I was exactly where you are now around 8 months ago. I didn't have a clue about any of the principles that the YM2612 operated on, and it took me a few weeks to get my head around it. The key term you're looking for is "FM Synthesis". The YM2612 is an FM synthesis chip, and uses frequency modulation to generate sounds.
Now you just need to get some solid info on what FM synthesis is. I found Wikipedia quite useless in this instance. Their entire article on FM Synthesis needs to be re-written from scratch. In fact, in my experience, there are very few useful resources on the internet that actually explain FM Synthesis in practical terms. There are lots of abstract mathematical descriptions explaining why FM synthesis works, and there are plenty of tutorials written for musicians giving tips and tricks on how to get certain types of sound out of FM synthesis, but as it turns out, there seems to be a real lack of information explaining in realistic terms how FM synthesis is implemented.
There is one extremely useful guide I can link you to however:
http://insidesynthesis.blogspot.com/200 ... art-1.html
This video is gold. It doesn't explain everything, but it covers a lot, and does it using basic language. Most importantly, the author introduces the same kind of terms you're going to encounter when you look at the YM2608/YM2612 documentation (Carrier, Modulator, Operator, etc), and he relates them back to real terminology. The video is written for musicians, and it does start assuming the viewer has a basic understanding of analog synthesis, neither of which were true in my case, but I still found it extremely useful without this musical background. I strongly suggest you watch this video through many times.
Now, here's the bit that I never saw explained anywhere, and would have really helped me out when I was trying to learn this stuff. FM synthesis is NOT a method of generating sound. FM synthesis is a method of ALTERING sound. Every FM synthesizer starts with a basic waveform, and uses FM synthesis to alter that waveform to generate different sounds. In the case of the YM2612, that basic waveform is a sine wave. Every operator has a sine wave generator. In the absense of any frequency modulation, the YM2612 is just a sine wave generator.
Now I'll try and give you my simple description of how FM synthesis works. In order to understand FM synthesis, consider the case of two operators, or in other words, two sine wave generators. Both sine wave generators run at specified frequencies. One sine wave generator may be running at 440Hz, or in other words, generating a sine wave which oscillates 440 times each second. Let's say the other sine wave generator is running at 1Hz, or in other words, generating a sine wave which oscillates once each second. Individually, these two sine wave generators are simple to understand.
What FM synthesis does is use one waveform to alter a waveform generator. Note the use of the term "waveform generator". It does not use one waveform to alter another waveform. The "modulator", or "modulation input" used in FM synthesis is any arbitrary waveform. This input is then used to alter the way a waveform generator performs its operation. Again, in the case of the YM2612, this waveform generator is a sine wave generator.
In order to generate a sine wave, all you need to know is what frequency to generate it at. The sine wave generator is provided a frequency value, eg, 440Hz, and it generates a sine wave at that frequency. What FM synthesis does, or to use it's full name, Frequency Modulation Synthesis, is to alter the input frequency for a waveform generator, based on an arbitrary input waveform. If we were to "modulate" the input frequency for a sine wave generator, rather than generating a waveform at a constant frequency such as 440Hz, the frequency of the wave that the sine wave generator is creating is going to be constantly changing. In the case of FM synthesis, we use an arbitrary waveform input to determine how the frequency is altered. In the YM2612, that waveform input is the output from another operator.
Let's have a look at the waveform input for frequency modulation, in detail. A waveform is simply a representation in the change of a single number over time. This number is signed, and can be either positive or negative. Let's say that number is a floating point number between 1.0 and -1.0. The sample rate is the number of times we record that value each second. The "waveform" is just what we get when we connect the dots of these sampled values. When we say that frequency modulation uses a waveform input to modulate the frequency of a waveform generator, all we really mean is that frequency modulation uses a number to modulate the frequency of a waveform generator. We expect that number to be constantly changing, and we can think of that input as a waveform if we want, but all it really is is a single number, which may or may not have changed the next time it is used.
Ok, so now we have a sine wave generator. That sine wave has an input telling it to generate a waveform at 440Hz. It also has a modulation input, which can be between 1.0 and -1.0. We're going to use that modulation input to alter the frequency input to the sine wave generator. Let's say we use this formula:
finalFrequency = frequency + (100 * modulation)
In this case, an input value of 1.0 would increase the frequency of the sine wave generator by 100Hz. An input of -1.0 would decrease the frequency by 100Hz. The selection of the maximum deviation value of 100 in this case is totally arbitrary. An implementation of frequency modulation can select any value for this maximum deviation which seems appropriate.
That's basically how FM synthesis works. Now what you should know is that's not actually how the YM2612 works. The YM2612 uses Phase Modulation, which is really just a variation on frequency modulation. The only real difference is when the modulation input is applied. You'll see that the YM2612 has a phase generator that outputs a 10-bit number, which is used as a lookup into a sine table in the operator unit. The YM2612 applies modulation as a 10-bit signed value, which is added to this 10-bit phase value. It's called phase modulation because it's the phase value which is being modulated, not the base frequency which is driving the phase generator. In reality, this is really just an implementation detail. Phase modulation is really just a way of implementing frequency modulation.
One thing which I haven't mentioned in the YM2612 thread yet, which you'll need in order to build a YM2612 core, is how the 10-bit phase modulation value is derived from the 14-bit output from the operator unit. The bits from the 14-bit output from an operator are mapped to the 10-bit modulation input in this form:
IE, the 14-bit value is shifted down by 1, then masked to a 10-bit result. In the case where more than one operator output is being combined to form the 10-bit input, the values are simply added together.
Anyway, I've rambled on for long enough. Hopefully I've said something of use.
Now you just need to get some solid info on what FM synthesis is. I found Wikipedia quite useless in this instance. Their entire article on FM Synthesis needs to be re-written from scratch. In fact, in my experience, there are very few useful resources on the internet that actually explain FM Synthesis in practical terms. There are lots of abstract mathematical descriptions explaining why FM synthesis works, and there are plenty of tutorials written for musicians giving tips and tricks on how to get certain types of sound out of FM synthesis, but as it turns out, there seems to be a real lack of information explaining in realistic terms how FM synthesis is implemented.
There is one extremely useful guide I can link you to however:
http://insidesynthesis.blogspot.com/200 ... art-1.html
This video is gold. It doesn't explain everything, but it covers a lot, and does it using basic language. Most importantly, the author introduces the same kind of terms you're going to encounter when you look at the YM2608/YM2612 documentation (Carrier, Modulator, Operator, etc), and he relates them back to real terminology. The video is written for musicians, and it does start assuming the viewer has a basic understanding of analog synthesis, neither of which were true in my case, but I still found it extremely useful without this musical background. I strongly suggest you watch this video through many times.
Now, here's the bit that I never saw explained anywhere, and would have really helped me out when I was trying to learn this stuff. FM synthesis is NOT a method of generating sound. FM synthesis is a method of ALTERING sound. Every FM synthesizer starts with a basic waveform, and uses FM synthesis to alter that waveform to generate different sounds. In the case of the YM2612, that basic waveform is a sine wave. Every operator has a sine wave generator. In the absense of any frequency modulation, the YM2612 is just a sine wave generator.
Now I'll try and give you my simple description of how FM synthesis works. In order to understand FM synthesis, consider the case of two operators, or in other words, two sine wave generators. Both sine wave generators run at specified frequencies. One sine wave generator may be running at 440Hz, or in other words, generating a sine wave which oscillates 440 times each second. Let's say the other sine wave generator is running at 1Hz, or in other words, generating a sine wave which oscillates once each second. Individually, these two sine wave generators are simple to understand.
What FM synthesis does is use one waveform to alter a waveform generator. Note the use of the term "waveform generator". It does not use one waveform to alter another waveform. The "modulator", or "modulation input" used in FM synthesis is any arbitrary waveform. This input is then used to alter the way a waveform generator performs its operation. Again, in the case of the YM2612, this waveform generator is a sine wave generator.
In order to generate a sine wave, all you need to know is what frequency to generate it at. The sine wave generator is provided a frequency value, eg, 440Hz, and it generates a sine wave at that frequency. What FM synthesis does, or to use it's full name, Frequency Modulation Synthesis, is to alter the input frequency for a waveform generator, based on an arbitrary input waveform. If we were to "modulate" the input frequency for a sine wave generator, rather than generating a waveform at a constant frequency such as 440Hz, the frequency of the wave that the sine wave generator is creating is going to be constantly changing. In the case of FM synthesis, we use an arbitrary waveform input to determine how the frequency is altered. In the YM2612, that waveform input is the output from another operator.
Let's have a look at the waveform input for frequency modulation, in detail. A waveform is simply a representation in the change of a single number over time. This number is signed, and can be either positive or negative. Let's say that number is a floating point number between 1.0 and -1.0. The sample rate is the number of times we record that value each second. The "waveform" is just what we get when we connect the dots of these sampled values. When we say that frequency modulation uses a waveform input to modulate the frequency of a waveform generator, all we really mean is that frequency modulation uses a number to modulate the frequency of a waveform generator. We expect that number to be constantly changing, and we can think of that input as a waveform if we want, but all it really is is a single number, which may or may not have changed the next time it is used.
Ok, so now we have a sine wave generator. That sine wave has an input telling it to generate a waveform at 440Hz. It also has a modulation input, which can be between 1.0 and -1.0. We're going to use that modulation input to alter the frequency input to the sine wave generator. Let's say we use this formula:
finalFrequency = frequency + (100 * modulation)
In this case, an input value of 1.0 would increase the frequency of the sine wave generator by 100Hz. An input of -1.0 would decrease the frequency by 100Hz. The selection of the maximum deviation value of 100 in this case is totally arbitrary. An implementation of frequency modulation can select any value for this maximum deviation which seems appropriate.
That's basically how FM synthesis works. Now what you should know is that's not actually how the YM2612 works. The YM2612 uses Phase Modulation, which is really just a variation on frequency modulation. The only real difference is when the modulation input is applied. You'll see that the YM2612 has a phase generator that outputs a 10-bit number, which is used as a lookup into a sine table in the operator unit. The YM2612 applies modulation as a 10-bit signed value, which is added to this 10-bit phase value. It's called phase modulation because it's the phase value which is being modulated, not the base frequency which is driving the phase generator. In reality, this is really just an implementation detail. Phase modulation is really just a way of implementing frequency modulation.
One thing which I haven't mentioned in the YM2612 thread yet, which you'll need in order to build a YM2612 core, is how the 10-bit phase modulation value is derived from the 14-bit output from the operator unit. The bits from the 14-bit output from an operator are mapped to the 10-bit modulation input in this form:
Code: Select all
// ---------------------------------------------------------
// | Operator Output (14-bit) |
// |-------------------------------------------------------|
// |13 |12 |11 |10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
// ------------=========================================----
// | Modulation Input (10-bit) |
// |---------------------------------------|
// | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
// -----------------------------------------
Anyway, I've rambled on for long enough. Hopefully I've said something of use.
I have tried, many times, to put some useful info on Wikipedia, on this subject and various computer/console pages that are ridiculously inaccurate. But it all just gets deleted because I don't provide any 'citations'. Erm... yes, that's precisely the reason I put that info up there - because it doesn't exist anywhere else. It's a waste of time, and I gave up trying a long time agoNemesis wrote:I found Wikipedia quite useless in this instance. Their entire article on FM Synthesis needs to be re-written from scratch.
You must understand conception of Wikipedia first, and then read some rules. WP is not generates any new information, it's goal to collect information which already exists and which is proved. It's not place for original research and publications. If you can't say where you got your knowledge, it's original research - why anybody must trust that you right? You can publish your research in other places first (respectable ones, which don't publish incorrect information), then you can refer to it. Otherwise, you can cite books, official documentation and other places, where you got your info, so anybody can check your words.Snake wrote:I have tried, many times, to put some useful info on Wikipedia, on this subject and various computer/console pages that are ridiculously inaccurate. But it all just gets deleted because I don't provide any 'citations'. Erm... yes, that's precisely the reason I put that info up there - because it doesn't exist anywhere else. It's a waste of time, and I gave up trying a long time ago ;)
There is problem that there is some wrong information in articles, which passed through all rules somehow. But you can put 'cite' requests on all wrong statements, and you can request for article deletion, if you have solid argumentation for this (no cites, information can be verified, etc).
Hm maybe http://www.reptilia-design.co.uk/ (your site?) should get a megadrive section we could all citeSnake wrote:Yes, but the problem is that there ARE hundreds of sites containing the exact same, and completely wrong, information - and nothing whatsoever with the correct information. So it's impossible to convince anybody it's wrong.