New Documentation: An authoritative reference on the YM2612
Moderator: BigEvilCorporation
Wait, I thought Nemesis said only SSG-EG stuff was wrong. If you think some other things are wrong as well, then please state the corrections.No, in fact I was going to suggest that this topic gets renamed once Nemesis is ready to post his new info, because as he has now stated, most of the stuff in here is completely wrong.

All the stuff I've posted about the phase generator and operator unit stands. The latest information I provided about those areas is all correct to the best of my knowledge.
There are some significant errors in the information I posted on the envelope generator, some of which I've already corrected, but a lot of which I have yet to correct. Most of the errors relate to SSG-EG mode. Apart from that, there's one error in my description of the interrupt line for the YM2612, which I'll post along with the envelope generator info, but I'm not aware of any other errors apart from that, so far at least.
Feel free to share any corrections you might have about what's been posted in this thread so far, or any further info you might have about the YM2612. Also let me know if there are things you suspect might be incorrect, and I'll re-test.
There are some significant errors in the information I posted on the envelope generator, some of which I've already corrected, but a lot of which I have yet to correct. Most of the errors relate to SSG-EG mode. Apart from that, there's one error in my description of the interrupt line for the YM2612, which I'll post along with the envelope generator info, but I'm not aware of any other errors apart from that, so far at least.
Feel free to share any corrections you might have about what's been posted in this thread so far, or any further info you might have about the YM2612. Also let me know if there are things you suspect might be incorrect, and I'll re-test.
I probably should have worded that differently 
It could do with cleaning up, but it'd probably be better in a new thread, because the discussion in here has still been interesting.
It really has been way too long since I really looked at this stuff, and I can't think of anything specific off the top of my head. But top of my list of things to try and determine right now, if I had the hardware to do it, would be this distortion stuff. We need to find out what gets fed into the DAC, i.e. the conversion from integer to 'floating point'. I'm fairly certain this is done very cheaply, is bugged, and thats where the error comes from. To me, this is much more important than some stuff already discussed in this thread. It affects all sounds in some way, whereas a lot of the things discussed aren't even used, or in some cases, such as the interrupt lines, can't be used.
Have you looked into this at all?

Yes, I haven't gone back and read over it, but from what I remember that part is all correct. However, this stuff is pretty straight forward, and as far as I'm aware, was already correct in the MAME core. In other words, it wasn't new information.Nemesis wrote:All the stuff I've posted about the phase generator and operator unit stands. The latest information I provided about those areas is all correct to the best of my knowledge.
This is where I feel the problem is with this thread. Yes, I note that you'd made corrections before I'd even read it all, but its fairly difficult to find all the bits and pieces of correct info among the non correct info, which isn't really what the title of the thread statesNemesis wrote:There are some significant errors in the information I posted on the envelope generator

It really has been way too long since I really looked at this stuff, and I can't think of anything specific off the top of my head. But top of my list of things to try and determine right now, if I had the hardware to do it, would be this distortion stuff. We need to find out what gets fed into the DAC, i.e. the conversion from integer to 'floating point'. I'm fairly certain this is done very cheaply, is bugged, and thats where the error comes from. To me, this is much more important than some stuff already discussed in this thread. It affects all sounds in some way, whereas a lot of the things discussed aren't even used, or in some cases, such as the interrupt lines, can't be used.
Have you looked into this at all?
I think what I'll probably do once I'm finished testing stuff on the YM2612 is actually what someone suggested ages back, and compile everything into a "YM2612 Undocumented" article or the like. Once that's done, it can basically replace this thread as a reference for information on the YM2612. For the time being, I think it's better that I just continue to post new information in this thread as I go.This is where I feel the problem is with this thread. Yes, I note that you'd made corrections before I'd even read it all, but its fairly difficult to find all the bits and pieces of correct info among the non correct info, which isn't really what the title of the thread states It could do with cleaning up, but it'd probably be better in a new thread, because the discussion in here has still been interesting.
It's on the to-do list. I'll probably cover the LFO first, then test the DAC. The good news is, I have a studio mastery grade audio card with a 120dB signal to noise ratio, so I can obtain some very accurate samples from the hardware at extremely low volume.It really has been way too long since I really looked at this stuff, and I can't think of anything specific off the top of my head. But top of my list of things to try and determine right now, if I had the hardware to do it, would be this distortion stuff. We need to find out what gets fed into the DAC, i.e. the conversion from integer to 'floating point'. I'm fairly certain this is done very cheaply, is bugged, and thats where the error comes from. To me, this is much more important than some stuff already discussed in this thread. It affects all sounds in some way, whereas a lot of the things discussed aren't even used, or in some cases, such as the interrupt lines, can't be used.
Have you looked into this at all?
I don't think the distortion from the DAC itself is that bad though. I've observed a minor loss in precision, which is either due to the DAC or the accumulator, and of course there's the obvious jump between low volume and off, but I honestly think that by far the biggest factor is the external amplification/mixing circuitry that the YM2612 feeds into.
Oh, it is... (or rather, to be clear, the DAC itself should only have minor inaccuracies - its the data that's fed INTO it thats hideously innacurate.)Nemesis wrote:I don't think the distortion from the DAC itself is that bad though.
Yes. But not only that, 'off' should happen way earlier than it actually does. The difference between what's supposed to happen and what actually happens is HUGE, and as I've just had confirmed, makes the difference between instruments in afterburner being heard very clearly, and not at all...Nemesis wrote:and of course there's the obvious jump between low volume and off
I guess I learn something new every daySnake wrote:Yes, that makes perfect sense. The distortion effect makes the sounds louder as well as making them sound quite different. I think this is probably the culprit here.
Good find, by the way, I can't believe I didn't spot that one myself.
is there an accurate way to emulate that "distortion" and, more generally, any side effects/filtering introduced by the sound output circuitry ?
-
- Very interested
- Posts: 2452
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
What Afterburner BGM are we talking about ? I've got to do a recording...
Mida sa loed ? Nagunii aru ei saa 
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
Man, this After Burner II music goes nuts. I honestly spent 10 minutes thinking I was listening to an entirely different tune.
You know what, I think I know what causes this, and the answer has already been posted in this thread by someone else. HardWareMan discovered awhile back that the output from the YM2612 is multiplexed. Based on experiments I carried out on my emulator with multiplexed output, this DOES cause an audible difference in some sounds, and I don't even want to think about what the audio output circuitry in the Mega Drive would do to that multiplexed signal. It would probably compress everything together a little, amplifying the low volume channels, and softening the high volume channels. The greater the variance, the greater the effect.
It's the same kind of problem as with the PSG when it hits super-high frequencies. Speaking of the PSG, I've noticed previously that After Burner II runs every channel of the PSG at maximum frequency, around half volume constantly. This PSG signal is also getting mixed with the YM2612 output, and it's possible that the PSG is introducing some destructive interference, cancelling out some of the output from the YM2612.
I've just run some tests on this After Burner II track in my emulator using experimental multiplexed output. I generated wave logs for both combined and multiplexed outputs at their native bitrate, and ran them through Adobe Audition (to take advantage of their groovy output resampling), and there's no doubt that the multiplexed output not only sounds very different to the combined output, but it also sounds much closer to the real hardware.
I've got a feeling that the only way to get this "output distortion" to sound right all the time is to generate a true multiplexed output for the YM2612, correctly generate the full high frequency output from the PSG, faithfully emulate the mixing hardware in the Mega Drive to mix and distort the output, and use some sort of killer resampling algorithm to step down from the super high frequency output we've just generated (over 220KHz for the PSG, and over 310KHz for the multiplexed YM2612) to something the average computer can actually output (around 48Khz), without altering the tone. Ouch.
You know what, I think I know what causes this, and the answer has already been posted in this thread by someone else. HardWareMan discovered awhile back that the output from the YM2612 is multiplexed. Based on experiments I carried out on my emulator with multiplexed output, this DOES cause an audible difference in some sounds, and I don't even want to think about what the audio output circuitry in the Mega Drive would do to that multiplexed signal. It would probably compress everything together a little, amplifying the low volume channels, and softening the high volume channels. The greater the variance, the greater the effect.
It's the same kind of problem as with the PSG when it hits super-high frequencies. Speaking of the PSG, I've noticed previously that After Burner II runs every channel of the PSG at maximum frequency, around half volume constantly. This PSG signal is also getting mixed with the YM2612 output, and it's possible that the PSG is introducing some destructive interference, cancelling out some of the output from the YM2612.
I've just run some tests on this After Burner II track in my emulator using experimental multiplexed output. I generated wave logs for both combined and multiplexed outputs at their native bitrate, and ran them through Adobe Audition (to take advantage of their groovy output resampling), and there's no doubt that the multiplexed output not only sounds very different to the combined output, but it also sounds much closer to the real hardware.
I've got a feeling that the only way to get this "output distortion" to sound right all the time is to generate a true multiplexed output for the YM2612, correctly generate the full high frequency output from the PSG, faithfully emulate the mixing hardware in the Mega Drive to mix and distort the output, and use some sort of killer resampling algorithm to step down from the super high frequency output we've just generated (over 220KHz for the PSG, and over 310KHz for the multiplexed YM2612) to something the average computer can actually output (around 48Khz), without altering the tone. Ouch.
-
- Very interested
- Posts: 2452
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
The answer to your problem is in accuracy, current emulators are doing the sound too accurately compared to real HW... the After Burner uses very attenuated FM to get it around same levels to PSG which is used for samples so that FM would not overpower PSG... however, YM2612 is not having too great resolution output, and quiet sounds are quite hard to hear as they're very aliased (especially on real YM2612, MD2 ASIC is a bit more accurate). The sounds you hear in emulators are present on real HW, but they're quite aliased and are hard to notice in the sea of aliasing noise. When you mess with 8-bit WAVs, you always try to record in highest possible volume so you would hear less of the aliasing noise.
Here's the recording (a shitty medley with all tunes) :
http://www.fileden.com/files/2008/4/21/ ... TRBRN2.ogg
And 22KHz WAV sounds better on MD than on anything else
http://www.fileden.com/files/2008/4/21/ ... KOZMOZ.RAR
(to get original WAV, rip it off the BIN, I've clearly marked the point)
Here's the recording (a shitty medley with all tunes) :
http://www.fileden.com/files/2008/4/21/ ... TRBRN2.ogg
And 22KHz WAV sounds better on MD than on anything else

http://www.fileden.com/files/2008/4/21/ ... KOZMOZ.RAR
(to get original WAV, rip it off the BIN, I've clearly marked the point)
Mida sa loed ? Nagunii aru ei saa 
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
Why are you both talking about PSG and that PSG at high volume muffles/damps YM2612 or cancelling some of YM2612's output? I said that in 2nd test I CUT OUT all writings to PSG and tones 1, 2 from VGM file and played this VGM on hardware and you can see that emulator still playing the same as with all tones and PSG.
...Hmmm, I listened to "Super Stripe" from CCAM'ed MD2 and... I don't like it
But, though those instruments play quietly, right as in emulator, they still sound closer to my MD2, not to emulator (you say they are "distorted"). Okay, here's my vgm:
http://shedevr.org.ru/ghost/SS_PSG.7z
Don't pay attention to incorrect loop offset, I'm too lazy to correct it.
Also, in this huge recording of After Burner tunes there are strange clicks in "Final Take Off" tune (seconds 28-40). It's wrong of course.
Though in this topic someone named various chipsets and YM2612 variations, it seems that there's no any etalon
In one cases one console sounds better, in other it sounds worse. It seems, the only way is to allow to choose chipset and other factors in emulator, but user still WILL HAVE to choose the best factors.
TmEE, can you desribe in detail what model did you use? I used Asian PAL MD2 (Chinese clone) MK 1631-07 and European MD1 PAL 1600-05 and they sound identical (MD2 sounds a bit clearer).
upd: to make sure that I provided right playing of tune (with loud "instruments") you can listen to other versions of After Burner (NES, 32X and others) - they are loud there too.
...Hmmm, I listened to "Super Stripe" from CCAM'ed MD2 and... I don't like it

http://shedevr.org.ru/ghost/SS_PSG.7z
Don't pay attention to incorrect loop offset, I'm too lazy to correct it.
Also, in this huge recording of After Burner tunes there are strange clicks in "Final Take Off" tune (seconds 28-40). It's wrong of course.
Though in this topic someone named various chipsets and YM2612 variations, it seems that there's no any etalon

TmEE, can you desribe in detail what model did you use? I used Asian PAL MD2 (Chinese clone) MK 1631-07 and European MD1 PAL 1600-05 and they sound identical (MD2 sounds a bit clearer).
upd: to make sure that I provided right playing of tune (with loud "instruments") you can listen to other versions of After Burner (NES, 32X and others) - they are loud there too.
Yeah, thats one of those things thats completely incorrect. What do you think the accumulator does? I thought you'd covered this already.Nemesis wrote:You know what, I think I know what causes this, and the answer has already been posted in this thread by someone else. HardWareMan discovered awhile back that the output from the YM2612 is multiplexed.
It's the DAC distortion, I'm telling you. This stuff is exactly in the range where the distortion is most noticable. But if that's not convincing, there's nothing else that explains why this does not happen on an MD2.
Well, this is the point. It does - or - it's supposed to. The DAC is designed to lose accuracy at higher volumes and retain it at lower volumes. But I'm convinced there's a bug there that causes it to lose accuracy all the time, under the right conditions. This bug is probably fixed in the later models so all you are left with is the fairly minor distortion caused by the fact it does this at all.TmEE wrote:however, YM2612 is not having too great resolution output
Indeed, I don't think anybody is saying that the tune isn't supposed to sound like the file you posted. It definitely should, and when you pointed this out, I noticed you were correct right away. I listened to this stuff for hours with headphones back when it was releasedGManiac wrote:you can listen to other versions of After Burner (NES, 32X and others) - they are loud there too.

But, It, like most other Genesis/MD music, was created on an MD1. The official MD2 does not have the same level of distortion, so it will sound very different, which you can now hear for yourself. I guess your clone is closer to a real MD1.
No, me neitherGManiac wrote:I don't like it

I wouldn't worry about it. How it sounds on an original MD1 is how its supposed to sound, and this is going to be true for everything. That's the one to focus on.GManiac wrote:In one cases one console sounds better, in other it sounds worse
Sorry, but the output from the YM2612 is definitely multiplexed. The accumulator combines the output from operators, it does not combine the output from channels. The output from the YM2612 is multiplexed. Hook up an oscilloscope to the output and you can see it. I can also see it (although not enough to get a complete sample of each individual channel) when I record at 192KHz.Snake wrote:Yeah, thats one of those things thats completely incorrect. What do you think the accumulator does? I thought you'd covered this already.Nemesis wrote:You know what, I think I know what causes this, and the answer has already been posted in this thread by someone else. HardWareMan discovered awhile back that the output from the YM2612 is multiplexed.
Maybe you're right. I will run tests on the DAC. There are other things I want to test first however. It makes sence to figure out things "higher up the chain" first. The DAC is also crossing into the analog domain, so it's going to be much harder to obtain precise results.It's the DAC distortion, I'm telling you. This stuff is exactly in the range where the distortion is most noticable. But if that's not convincing, there's nothing else that explains why this does not happen on an MD2.