######## POST p6288 | Nemesis | 2008-09-20 | t386-180.html [QUOTE] Also interesting. I remember this game giving me trouble back in the very early days of KGen. One thing it does is spam the living hell out of the YM2612, repeatedly writing registers that haven't changed. I don't remember if it checks the status to see if the chip is busy between writes - but maybe it does, and those writes take a bit longer on the different chip? (or, maybe the newer chip forces a delay if you write to quick?) It's possible it wastes so much time with all this spamming that it misses an interrupt or timer interval. That'd explain why it runs at half speed. [/QUOTE] I've got a way to sample cycle-accurate measurements for the busy flag on the separate YM2612 BTW. I saw on a pinout somewhere that the supposed "unused" pin 10 is really a "TEST" pin. I've confirmed this is correct, and that what this pin actually does is indicate the current "busy" status of the chip. Yamaha could have used this pin to drive their tests on the chip, without having to read the status register to know when they could send each successive write. I'm getting a logic analyzer in the coming months, which will make it easy to measure the number of cycles the chip remains in a busy state. It wouldn't be as easy to test the busy status of the embedded YM2612, but once I've got the exact numbers for the real chip, it shouldn't be too hard to determine whether the embedded chip is different at the very least. ######## POST p6289 | Eke | 2008-09-20 | t386-180.html [QUOTE] Aha. The document you found mentions there is only one operator. Incorrect. There are two, running in parallel. It simplifies the hardware design. This is the reason for the 'odd' operator numbering (1,3,2,4) in the registers. It also means that in most algorithms, an operator may need input from another one that's running parallel with it, and thus not ready yet. And so... it uses the previous output of that operator. This is what all the MEM stuff in Mame is all about, and it's correct. [/QUOTE] aha, thanks for clearing that: another mystery of the MAME implemenation is finally solved [IMG ./images/smilies/icon_wink.gif] [QUOTE] I must say however, the self-feedback implementation still baffles me. MAME adds the last two samples together to build the self-feedback modulation value. This seems to be correct, but I can't figure out why it's correct, or rather, why the guys at Yamaha chose to implement it this way. Of course, there's no rule that says self-feedback has to be implemented in any particular way. Maybe they found this method "sounded better". It does produce a better saw-tooth when FB=5. I should probably stop wasting time on it and look at something else. [/QUOTE] Couldt it be some kind of linear interpolation and a way to solve the equation: y = x + B.sin(y) ? [QUOTE] I'm getting a logic analyzer in the coming months, which will make it easy to measure the number of cycles the chip remains in a busy state. It wouldn't be as easy to test the busy status of the embedded YM2612, but once I've got the exact numbers for the real chip, it shouldn't be too hard to determine whether the embedded chip is different at the very least. [/QUOTE] nice... this is Out Topic but do you plan to analyze the VDP also (or maybe did you already) ? I always wanted to know the exact timings of the different VDP events (interrupts and HV blanking periods) related to the main clocks as well as the exact video signal timings (VSYNC/HSYNC) and pixel clocks, which will give us the exact total number of pixels ######## POST p6290 | Nemesis | 2008-09-20 | t386-180.html [QUOTE] nice... this is Out Topic but do you plan to analyze the VDP also (or maybe did you already) ? I always wanted to know the exact timings of the different VDP events (interrupts and HV blanking periods) related to the main clocks as well as the exact video signal timings (VSYNC/HSYNC) and pixel clocks, which will give us the exact total number of pixels [/QUOTE] That's the first thing on the list. [IMG ./images/smilies/icon_smile.gif] ######## POST p6298 | TmEE co.(TM) | 2008-09-21 | t386-195.html [QUOTE] Snake wrote:Heh, that's interesting [IMG ./images/smilies/icon_smile.gif] I guess the hardware doesn't allow you to switch channels that fast. Admittedly something I never tested, because I didn't expect anybody to ever do that. What happens on the real hardware? Do you have a recording? [/QUOTE] http://www.hot.ee/tmeeco/MD.HTM - You can get the ROM I will use for the recording here... Warning : the site is VERY outdated. [QUOTE] Snake wrote:Also interesting. I remember this game giving me trouble back in the very early days of KGen. One thing it does is spam the living hell out of the YM2612, repeatedly writing registers that haven't changed. I don't remember if it checks the status to see if the chip is busy between writes - but maybe it does, and those writes take a bit longer on the different chip? (or, maybe the newer chip forces a delay if you write to quick?) It's possible it wastes so much time with all this spamming that it misses an interrupt or timer interval. That'd explain why it runs at half speed. [/QUOTE] Only thing I can suspect is the busy flag timings to be different on the two implementations as when I overclocked the Z80 to 4.5MHz the music got a little bit faster, but not as fast as it should. Some things that require longer waits are TL operators and KeyOn/Off. Having too short delays when writing to these registers will have weird sound, possibly because the write got missed or corrupt or notes left playing (Note ONs seem to have no problems). L/R reg seems to require long wait aswell. When TEST signal of YM2612 would have been used for hardware based delays, my sound engine will probably not be what it is now. Time would get wasted in CPU wait while you could have few more instructions executed... I'm raping YM2612, pushing ~50KB of data through it per second [IMG ./images/smilies/icon_razz.gif] EDIT: Recording of "stereo" PCM and the ROM I used : http://www.fileden.com/files/2008/4/21/ ... STEREO.RAR System used for recording http://www.hot.ee/tmeeco/MYSMD2.JPG (all new image now [IMG ./images/smilies/icon_smile.gif] ) ######## POST p6333 | Snake | 2008-09-23 | t386-195.html [QUOTE] Nemesis wrote:I must say however, the self-feedback implementation still baffles me. MAME adds the last two samples together to build the self-feedback modulation value. This seems to be correct, but I can't figure out why it's correct, or rather, why the guys at Yamaha chose to implement it this way. [/QUOTE] Two answers (well, three.) One - it's correct. Two - it's the way Yamaha have always done it (ah, I do miss my old yamaha synths...) Three - because its a very sensible thing to do. If you modulate a wave by itself, with no modification, you can very easily end up with a wave that oscillates from positive to negative every other sample, or other undesirable patterns, none of which are very useful. It's always a good idea to modify something before you feed it back in, in any application, not just audio. [QUOTE] Nemesis wrote:I should probably stop wasting time on it and look at something else. [/QUOTE] Yep, move along, nothing to see here [IMG ./images/smilies/icon_smile.gif] ######## POST p6334 | Snake | 2008-09-23 | t386-195.html [QUOTE] TmEE co.(TM) wrote:Recording of "stereo" PCM and the ROM I used : http://www.fileden.com/files/2008/4/21/ ... STEREO.RAR [/QUOTE] Thanks for that. Shame it doesn't work, but I can see why. [QUOTE] TmEE co.(TM) wrote:System used for recording http://www.hot.ee/tmeeco/MYSMD2.JPG (all new image now [IMG ./images/smilies/icon_smile.gif] ) [/QUOTE] That's... insane. Respect [IMG ./images/smilies/icon_smile.gif] ######## POST p6337 | TmEE co.(TM) | 2008-09-24 | t386-195.html I've tried many ways, writing more than 1 sample and then switching channel... no go, it will still sound poor [IMG ./images/smilies/icon_sad.gif] ######## POST p6339 | Stef | 2008-09-24 | t386-195.html [QUOTE] TmEE co.(TM) wrote:I've tried many ways, writing more than 1 sample and then switching channel... no go, it will still sound poor [IMG ./images/smilies/icon_sad.gif] [/QUOTE] I also wrote a stereo sample player some time ago (i probably kept the source somewhere) but it worked only on Kega Fusion. It acted as simple mono sample player on real hardware and produced some bad noises on Gens... very disapointing. I tried severals ways to get the thing working on hardware but all them failed. I was thinking about playing sample with YM channels by modifying quickly the output slot TL value but that requires more work with the Z80 and i'm not sure it can actually work. That also requires a log conversion on sample with some quality loss... ######## POST p6343 | Snake | 2008-09-24 | t386-195.html Yeah, I don't think you can update those registers fast enough anyway. ######## POST p6448 | AamirM | 2008-10-04 | t386-195.html Hi, Has anyone been able to fix Battletech track 12 problem yet? I have made changes to make phase increment value 17-bit but it doesn't work. stay safe, AamirM ######## POST p6518 | Snake | 2008-10-10 | t386-195.html [QUOTE] Eke wrote:no, it works correctly (at least, your test ROM works) initially it didn't work because setting KEY ON then key OFF without updating the enveloppe attenuation level obviously did not work I fixed that by immediately forcing attenuation level to MAX when Key ON is set and Attack rate is maximum (this was usually done on the next enveloppe update) I should fix the commentary asap [/QUOTE] Yeah, I'm pretty sure this is wrong. It seems too 'hacky'. What probably happens is that the KEY OFF happens immediately after the next envelope update, rather than immediately after the KEY ON. Note that this won't make any difference to the sound, because the previous KEY ON won't have any effect until the update happens anyway. ######## POST p6519 | Eke | 2008-10-10 | t386-195.html [QUOTE] AamirM wrote:Hi, Has anyone been able to fix Battletech track 12 problem yet? I have made changes to make phase increment value 17-bit but it doesn't work. stay safe, AamirM [/QUOTE] how is it supposed to sound like btw ? In kega, even with SuperHQ enabled, I can still hear the noisy & high-frequency cymbal, and in Regen, it sounds more like a "tic tic" ... In my Genesis Plus implementation, I got it differently from both, the sound seems less noticeable... Currently I got best results using 48000hz and SINC_FAST setting as the libsamplerate conversion algorithm (iLINEAR has less quality and it's quite noticeable in that specific track) ALso, regarding MAME implementation, I'm calculating the max value to add when Finc<0 like this: [QUOTE] ym2612.OPN.fn_max = (UINT32)( (double)0x20000 * ym2612.OPN.ST.freqbase * (1<<(FREQ_SH-10)) ); [/QUOTE] [QUOTE] if (finc < 0) finc += ym2612.OPN.fn_max; [/QUOTE] this way, and according to what Nemesis found, we indeed got: -1 = 0x1FFFF ######## POST p6520 | AamirM | 2008-10-11 | t386-195.html Hi, [QUOTE] how is it supposed to sound like btw ? [/QUOTE] It is supposed to sound like this . You will notice that the detune bug doesn't seems to be happening at all. [QUOTE] Currently I got best results using 48000hz and SINC_FAST setting as the libsamplerate conversion algorithm (iLINEAR has less quality and it's quite noticeable in that specific track) [/QUOTE] You are using SRC? Nice [IMG ./images/smilies/icon_smile.gif] . Is it fast enough? [QUOTE] Yeah, I'm pretty sure this is wrong. It seems too 'hacky'. [/QUOTE] Yep it was. I think he has since removed it. stay safe, AamirM ######## POST p6521 | Snake | 2008-10-11 | t386-195.html [QUOTE] AamirM wrote:It is supposed to sound like this [/QUOTE] No it isn't. Where did that come from? ######## POST p6522 | Eke | 2008-10-11 | t386-195.html [QUOTE] You are using SRC? Nice Smile . Is it fast enough? [/QUOTE] anything better than SINC_FAST is too slow but SINC_FAST gives good results at fullspeed on both Wii (729Mhz PPC) & Gamecube (485Mhz PPC) Sadly, to obtain fullspeed with Virtua Racing or NTSC filters enabled, I have to lower the quality (LINEAR) or even disabled HQ mode Never thought I would have to optimize the code someday [IMG ./images/smilies/icon_wink.gif] [QUOTE] Snake wrote: [QUOTE] Eke wrote:no, it works correctly (at least, your test ROM works) initially it didn't work because setting KEY ON then key OFF without updating the enveloppe attenuation level obviously did not work I fixed that by immediately forcing attenuation level to MAX when Key ON is set and Attack rate is maximum (this was usually done on the next enveloppe update) I should fix the commentary asap [/QUOTE] Yeah, I'm pretty sure this is wrong. It seems too 'hacky'. What probably happens is that the KEY OFF happens immediately after the next envelope update, rather than immediately after the KEY ON. Note that this won't make any difference to the sound, because the previous KEY ON won't have any effect until the update happens anyway. [/QUOTE] well, according to Nemesis [QUOTE] That's their way of eliminating the attack phase. When Rate = 62 or 63 during attack, the attack phase is skipped. MAME use this calculation to immediately force the result to TL, but based on the behaviour I've observed with CSM and SSG-EG, I think it far more likely that the YM2612 doesn't even enter the attack phase, and skips straight to decay when the calculated attack rate is greater than 61. I probably should have written that in as a special case. [/QUOTE] but I'm very interested to know how exactly the chip behave is such extreme case, when Key ON/OFF are exactly taken in account (after a new EG cycle or after an enveloppe update ? but what happen in the case of very slow update rates ?) , what happens internally (attenuation level reseted or not ? phase counter reseted ?) [QUOTE] No it isn't. Where did that come from? [/QUOTE] I'm curious also, this definitively sound too weird, no programmers could have leave this that way [IMG ./images/smilies/icon_eek.gif] ######## POST p6523 | AamirM | 2008-10-11 | t386-195.html Hi, [QUOTE] Snake wrote: No it isn't. Where did that come from? [/QUOTE] Thats a recording from the real hardware sent by a user. He also sent some other recordings which have pointed out bugs in my core. Some recording which are related to SSG-EG aren't emulated correctly by any emulator so he couldn't have made this up. So until and unless someone has some other real proof I am going to believe it sounds like that. stay safe, AamirM ######## POST p6524 | Snake | 2008-10-11 | t386-195.html [QUOTE] Eke wrote:Never thought I would have to optimize the code someday [IMG ./images/smilies/icon_wink.gif] [/QUOTE] I'd offer, but I don't much like PPC [IMG ./images/smilies/icon_wink.gif] [QUOTE] Eke wrote:well, according to Nemesis [QUOTE] That's their way of eliminating the attack phase. When Rate = 62 or 63 during attack, the attack phase is skipped. MAME use this calculation to immediately force the result to TL, but based on the behaviour I've observed with CSM and SSG-EG, I think it far more likely that the YM2612 doesn't even enter the attack phase, and skips straight to decay when the calculated attack rate is greater than 61. I probably should have written that in as a special case. [/QUOTE] [/QUOTE] Nah. Only thing that touches the envelope is the envelope generator. And that doesn't update every cycle. [QUOTE] Eke wrote:I'm curious also, this definitively sound too weird, no programmers could have leave this that way [IMG ./images/smilies/icon_eek.gif] [/QUOTE] Well, I've heard this plenty of times, so I know it doesn't sound like that. But yeah, I'm curious as to where this came from. [QUOTE] Aamir wrote:So until and unless someone has some other real proof I am going to believe it sounds like that. [/QUOTE] Ok. But it doesn't [IMG ./images/smilies/icon_wink.gif] ######## POST p6525 | AamirM | 2008-10-11 | t386-195.html Hi, [QUOTE] Snake wrote:I'd offer, but I don't much like PPC Wink [/QUOTE] I always wanted to know how Kega resamples. Are you using linear interpolation? stay safe, AamirM ######## POST p6526 | TmEE co.(TM) | 2008-10-11 | t386-210.html Seems I've got do some hardware recording... Battletech track 12, right ? ######## POST p6527 | AamirM | 2008-10-11 | t386-210.html Yes thats it. ######## POST p6529 | Snake | 2008-10-12 | t386-210.html [QUOTE] TmEE co.(TM) wrote:Seems I've got do some hardware recording... Battletech track 12, right ? [/QUOTE] Well It'd be interesting. Your machine(s) are heavily modified, right? If you can get something that sounds as bad as what Aamir posted, please do tell... I can tell you that it was not meant to sound like that. All GEMS stuff was created on very early model 1 consoles (it required the EXT port on the back) and that track does not sound like that on such consoles. Given that this sound is way out of spec, its possible it sounds completely wrong on some later model console that doesnt use a real YM2612. Doesn't change the fact that it's not supposed to sound like that. I have a sample somewhere, I'm trying to find it. [edit]Here we go. But, yes. There is a lot more to this bug. ######## POST p6531 | Eke | 2008-10-12 | t386-210.html cool, I got it sounding exactly like your sample [IMG ./images/smilies/icon_wink.gif] I don't want to imagine the moment when we would be emulating specific Mega Drive & Genesis revisions [IMG ./images/smilies/icon_rolleyes.gif] ######## POST p6532 | TmEE co.(TM) | 2008-10-12 | t386-210.html http://www.fileden.com/files/2008/4/21/ ... Tech12.ogg My unmodded MD1 sounds same, except it has more noise because of the stonger "ladder effect". Regen sounds way off, Fusion is not quite correct either, and Gens, well it blips [IMG ./images/smilies/icon_razz.gif] Didn't try other emulators... ######## POST p6533 | AamirM | 2008-10-12 | t386-210.html Hi, [QUOTE] TmEE co.(TM) wrote: Regen sounds way off, Fusion is not quite correct either, and Gens, well it blips Razz Didn't try other emulators... [/QUOTE] Hah [IMG ./images/smilies/icon_smile.gif] . Now I can safetly say that it doesn't sound weird to me without me being getting called a wierdo [IMG ./images/smilies/icon_biggrin.gif] . Now I wonder whats causing that. [QUOTE] TmEE co.(TM) wrote: Regen sounds way off, Fusion is not quite correct either, [/QUOTE] Thats because they both are producing the detune bug. At least thats what the real thing should do. Can you also listen to ComixZone track 5 on the same machine and see if it produces this bug there as well because it uses pretty much the same settings on channel 3. Now I 100% know that comixzone shouldn't produce this thing and which will make things more interesting [IMG ./images/smilies/icon_wink.gif] . stay safe, AamirM ######## POST p6536 | Eke | 2008-10-12 | t386-210.html What is interesting is that we got two samples from hardware that sounds VERY differently: could it be that one is running on a PAL Mega Drive and the other one on a NTSC Genesis ? Or could the output circuitry from one or another filters frequency in a different way ? ######## POST p6537 | AamirM | 2008-10-12 | t386-210.html Hi, [QUOTE] What is interesting is that we got two samples from hardware that sounds VERY differently: could it be that one is running on a PAL Mega Drive and the other one on a NTSC Genesis ? Or could the output circuitry from one or another filters frequency in a different way ? [/QUOTE] Yeah, could be it. I think Battletech was only meant to be run on NTSC machines. stay safe, AamirM ######## POST p6538 | TmEE co.(TM) | 2008-10-12 | t386-210.html My MD2 was with NTSC master clock and 50Hz setting, I tried other combinations and there's no difference in sound (except speed). Also my Nomads and Christuserloeser's X'eye and Wondermega sound same (as all are MD2 basically). Unmodified MD2 that's same model as my primary use one sounds same. I'll do a recording of the MD1 aswell... and while at it, I have a SE-95 YM2612 clone chip, I've socketed my MD1s YM2612, and do a recording of that aswell then. I'll make a record of the Comix Zone track 5... I don't recall it well anymore, but if you expect it to do the blip sound, it won't... same goes for Flashback, Bloodshot (nothing more coming to mind). The bug is very specific I think. ######## POST p6539 | Christuserloeser | 2008-10-12 | t386-210.html I think it's the early Yamaha 2612s that do sound correctly with GEMS - like Steve Snake said. The SEGA developed 2612 clones used in later MD1s and all MD2 based hardware will sound similar to what TmEE recorded. [QUOTE] TmEE co.(TM) wrote:I'll do a recording of the MD1 aswell... and while at it, I have a SE-95 YM2612 clone chip, I've socketed my MD1s YM2612, and do a recording of that aswell then. [/QUOTE] Is that the one from the Scorpion/AITO ? I would love to hear some recordings done with this chip! [IMG ./images/smilies/icon_biggrin.gif] ######## POST p6540 | TmEE co.(TM) | 2008-10-12 | t386-210.html My MD1 is the early kind without TMSS, same as what HardWareMan has, except not so modded [IMG ./images/smilies/icon_smile.gif] It has regular Yamaha YM2612 chip in it... And the SE-95 is from the AITO (which seems to have a dead functional part in it.....). SE-95 has higher output levels compared to real YM2612 and its sound seemed cleaner... I'll do some recordings soon. ######## POST p6541 | AamirM | 2008-10-12 | t386-210.html Hi, [QUOTE] I think it's the early Yamaha 2612s that do sound correctly with GEMS - like Steve Snake said. The SEGA developed 2612 clones used in later MD1s and all MD2 based hardware will sound similar to what TmEE recorded. [/QUOTE] No. Its just this game. I had a PAL MD and I know that ComixZone track 5 doesn't sound like that. I also have ran ComixZone on a chinese clone MD (one with the 132-in-1 logo, there seem to be like hundred types of them [IMG ./images/smilies/icon_smile.gif] ) and that sounds correct as well. So I am guessing this game is doing something different. Too bad both systems are busted now [IMG ./images/smilies/icon_sad.gif] (chinese one was expected). stay safe, AamirM ######## POST p6545 | TmEE co.(TM) | 2008-10-12 | t386-210.html http://www.fileden.com/files/2008/4/21/ ... CRDNGS.RAR CCAM MD2, MD1 with YM2612 and MD1 with SE-95 clone chip... seems MD2 YM2612 implementation does sound different with BattleTech... I still prefer MD2 over anything. ######## POST p6546 | AamirM | 2008-10-12 | t386-210.html Hi, [QUOTE] CCAM MD2, MD1 with YM2612 and MD1 with SE-95 clone chip... seems MD2 YM2612 implementation does sound different with BattleTech... I still prefer MD2 over anything. [/QUOTE] Thanks man [IMG ./images/smilies/icon_wink.gif] . I'd say Regen sounds closer to MD1 w/ YM2612. stay safe, AamirM ######## POST p6549 | Eke | 2008-10-12 | t386-210.html So, much probably, those various ym2612 chips have different internal register width good to know, now we need Nemesis to do ALL his tests again [IMG ./images/smilies/icon_wink.gif] ######## POST p6553 | Christuserloeser | 2008-10-12 | t386-225.html [QUOTE] TmEE co.(TM) wrote:http://www.fileden.com/files/2008/4/21/ ... CRDNGS.RAR CCAM MD2, MD1 with YM2612 and MD1 with SE-95 clone chip... seems MD2 YM2612 implementation does sound different with BattleTech... I still prefer MD2 over anything. [/QUOTE] Wow, I am quire impressed by the SE-95! Sounds great! A bit like a mix between MD1 and MD2, but with low volume for the PSG channels. I would love to hear a recording of Bare Knuckle 2's Go Straight Beatmix and Never Return Alive... ######## POST p6554 | Snake | 2008-10-12 | t386-225.html [QUOTE] AamirM wrote:No. Its just this game. [/QUOTE] Well as you can clearly hear from the samples now provided, the later chips are quite different to the original. And as I pointed out, this stuff was all created on the earlier models. Kega has this right, based on a real YM2612, which is, after all, what I'm trying to emulate [IMG ./images/smilies/icon_wink.gif] The only reason it sounds different to the YM2612 sample is because my filter is a bit off. It's *very* hard to get this exact and I haven't spent anywhere near enough time on it. But back to the bug for a second... Why did somebody create sounds that used this? All of them are on channel 3, using special mode, where they could very easily have set the operator to the same high frequency legitimately. Unless doing this does something different... [QUOTE] I don't want to imagine the moment when we would be emulating specific Mega Drive & Genesis revisions [/QUOTE] Pretty much all dev hardware was based on early models, so I would just stick to those, personally. [QUOTE] I'd say Regen sounds closer to MD1 w/ YM2612. [/QUOTE] Regen makes a 'tick' sound instead of a quiet 'beep'. This is because you're outputting way higher than the real chip does. You should filter and downsample. ######## POST p6558 | HardWareMan | 2008-10-13 | t386-225.html I think this is a philosophical question - whats sounds correct? YM2612 - is original. PCS95 - YM2612 hardware clone. Seen under this angle, it seems like inaccurate simulation. So the main question is: Whats sounds correct? Original YM2612 or its clone PCS95? ######## POST p6559 | Snake | 2008-10-13 | t386-225.html As I said, these sounds will have been created on an original NTSC Genesis 1. Therefore however it sounds on one of those is how it was intended to sound. This particular story gets even more interesting. I had someone test it on an NTSC Genesis 2. Guess what? It sounds pretty much exactly the same as an NTSC Genesis 1. So it would seem its got something to do with PAL consoles, but what, I'm not exactly sure. It doesn't seem to be a timing issue, it's something else. Maybe this is why the game didn't get released outside the US - they couldn't figure out what the hell was going on [IMG ./images/smilies/icon_smile.gif] ######## POST p6562 | Eke | 2008-10-13 | t386-225.html What is funny is that we were looking for months how to get ride of this "blip-blip" awful sound and now we try to figure how to make it reappear [IMG ./images/smilies/icon_lol.gif] Anyway, I agree and, for the time being, I will restrict my definition of "accurate" to "how it was designed to sound" [QUOTE] Regen makes a 'tick' sound instead of a quiet 'beep'. This is because you're outputting way higher than the real chip does. You should filter and downsample. [/QUOTE] downsample to how much ? in my case, I'm stuck to 32khz or 48Khz and which kind of filter to we exactlly need ? I'm currently using a very simple low-pass filter but that does not "muffle" the sound so much [QUOTE] The only reason it sounds different to the YM2612 sample is because my filter is a bit off. It's *very* hard to get this exact and I haven't spent anywhere near enough time on it. [/QUOTE] Could it be possible to implement a filter based on the exact values of the RC composants from a real machine ? or would it be a completely wrong approach ? ######## POST p6563 | TmEE co.(TM) | 2008-10-13 | t386-225.html Have a filter which gets rid on anything above 10KHz or so would be what's in MD2, plus a great deal of distortion... for MD1, you can omit the distortion... downsample the output to 22KHz and you get what real HW does after its crappy mixer circuits... not my idea of good sound... Its odd that NTSC MD2 would sound like MD1... I have some Nomads and Christuserloeser's X'eye and Wondermega, which are all true NTSC systems with variations of main components used in all MDs.... this is getting interesting here. X'eye and my MD2 uses 315-5660 chipset, Nomad uses 315-5700, Wondermega uses the earliest 315-4xxx chipset... These are the 3 I've encountered, and I don't think there's more of the same kind. One thing about MD2 is the REALLY shitty mixer, just listen the before and after : http://www.sega-16.com/forum/showpost.p ... stcount=60 I think if I'd record the BattleTech tune from original MD2, it would sound so different its sounds like what's coming from MD1... I'm gonna do more recordings... more games please [IMG ./images/smilies/icon_smile.gif] ######## POST p6564 | HardWareMan | 2008-10-13 | t386-225.html OffTop: [QUOTE] TmEE co.(TM) wrote:http://www.sega-16.com/forum/showpost.p ... stcount=60 [/QUOTE] I can tell you how to get PAL color even in 60Hz mode (PAL60) without RGB cable. You need this: 1 20..40 pF capacitor and PAL quartz 4.43MHz. You have to cut off color subcarrier frequency from VDP and PAL/NTSC mode pin. Then solder quartz series with a capacitor to PAL encoders and set PAL/NTSC pin always to PAL mode. ######## POST p6565 | AamirM | 2008-10-13 | t386-225.html Hi, [QUOTE] Snake wrote: Regen makes a 'tick' sound instead of a quiet 'beep'. This is because you're outputting way higher than the real chip does. You should filter and downsample. [/QUOTE] Yeah, I am not doing any sort of filtering. I will probably write a new resampler/filter when I get the time which will resample using filtering with more better quality. But as Eke asked already, downsample to how much? Its my experience that MD's output is bassed quite a bit meaning one will need more heavy lowpass filtering. stay safe, AamirM ######## POST p6567 | TmEE co.(TM) | 2008-10-13 | t386-225.html [QUOTE] HardWareMan wrote:I can tell you how to get PAL color even in 60Hz mode (PAL60) without RGB cable. You need this: 1 20..40 pF capacitor and PAL quartz 4.43MHz. You have to cut off color subcarrier frequency from VDP and PAL/NTSC mode pin. Then solder quartz series with a capacitor to PAL encoders and set PAL/NTSC pin always to PAL mode. [/QUOTE] I know that already, its that I don't use Composhit at all and don't bother with it. Its RGB all the way at my place [IMG ./images/smilies/icon_smile.gif] I don't have original RGB cables for MD2 or any adaptors (9-pin mini DINs are hard to find) so I had to use composhit for example... ######## POST p6570 | SmartOne | 2008-10-13 | t386-225.html AamirM, I like the idea of "sound plugins" for various types of filtering and sampling options. [QUOTE] TmEE co.(TM) wrote:Composhit [/QUOTE] I really wish RGB was used in the US. [IMG ./images/smilies/icon_sad.gif] ######## POST p6574 | Lord Nightmare | 2008-10-13 | t386-225.html We're trying to document the YM2612 here, correct? Wouldn't it be a better idea then to simply document the real YM2612 when run in a pal or ntsc machine, and also consequently document the two sega-made ym2612 clones when run at ntsc and pal clock rates, and just ignore the output mixing for the time being, as that is a somewhat unrelated topic? It would be interesting to document the mixer cutoffs/lowpass/downsampling etc for all the different sega (and 3rd party clone) chipsets, but thats a job for another thread, IMHO. Just my $.02 LN ######## POST p6575 | Eke | 2008-10-13 | t386-225.html at the time being, only a few people have the knowledge/ability to test and document their findings, what we are doing are only discussion and asking technical questions Well, that is also what I like about this board: you never know about what a thread will end talking about [IMG ./images/smilies/icon_biggrin.gif] ######## POST p6576 | Lord Nightmare | 2008-10-13 | t386-225.html Eke: this is true, but here comes a problem: Unless we document each chip separately from all the others, we're going to have errors in the documentation caused by 'it sounds correct' cases where due to the fact that a real ym2612 and an old type sega ic, or a real ym2151 and a middle type sega ic, or a clone ym2612 and an old type ic or... etc interact in a way that either hides some chip output that IS present or has output which is really not from the ym2612 at all. This is why I think for all ym2612 tests on real hardware, data should be captured as soon as it exits the dac on the ym2612 chip, as opposed to capturing it at the megadrive/genesis audio output pins, post-mixing. This way, instead of having to juggle a whole lot of variables (ym2612 type (real or one of the two clones), ym2612 clock rate, MD/genesis cpu clock rate, MD/genesis cpu chipset/mixer type, MD/genesis console revision (since the output filters after the mixer may change), we're down to only three: ym2612 type, ym2612 clock rate (pal vs ntsc), and MD/genesis cpu clock rate (pal vs ntsc), and we can ignore the rest of the mixer stuff. Once the three ym2612-and-clones chips are documented, then we can go back and do sine wave sweeps, etc on the mixer and different hardware revisions and messing with the VDP/sn76494 sound, to properly characterize different hardware revisions. The ym2612 is separate. Again, this is just my opinion, based on other stuff I've worked on. LN ######## POST p6577 | Eke | 2008-10-13 | t386-225.html [IMG ./images/smilies/icon_lol.gif] As I said, we were only discussing way to improve the accuracy of emulator outputs and this end up discussing hardware filtering and mixing, nothing more Don't worry, I'm sure Nemesis (or other technical people willing to do the same thing) knows well what they need to test and how exactly they have to test it [IMG ./images/smilies/icon_wink.gif] ######## POST p6578 | Arbee | 2008-10-13 | t386-225.html LN: well, this board is about the Genesis/MD, so the filters on the back end do matter. (If schematics exist, they'd probably be fairly easy to hook up in MAME with the discrete audio subsystem). I can't think of any cases where the filter would somehow give Nemesis false results anyway. I do agree 100% with Snake regarding 2612 knockoffs: the real 2612 and other bits of a model 1 Genesis/MD should always be the default setting. It's of course fun to discover and emulate how the clones and ASICs differ, but they're not what the composers intended the games to sound like. ######## POST p6579 | Lord Nightmare | 2008-10-13 | t386-240.html Arbee: Indeed they do matter, but I was wondering whether it would be better to discuss them in a separate thread or not. I defer to the people already in the discussion though, since everyone else here knows a lot more about this stuff than I do. However the discussion has piqued my interest in trying to do an fpga implementation of the ym2612... LN ######## POST p6580 | King Of Chaos | 2008-10-13 | t386-240.html I agree with Snake too. By default it should sound like the model 1 Genesis/MD since that's what the games were developed on. Now, that doesn't mean there can't be several modes where you can sound like the other ASICs or knock off YM2612s. [IMG ./images/smilies/icon_smile.gif] ######## POST p6581 | TmEE co.(TM) | 2008-10-13 | t386-240.html Emulators sound like MD2 mostly, with the nice and clean sound. Real YM2612 has quite bit of the "ladder effect" noise in the sound, where as MD2 ASIC YM2612 does have it much less. Also, real YM2612 has its sine a bit shifted on half periods... one half its 1 step up, other half not... I have a sample somewhere on this forum. Slight tonal change happens because of it. MD2 ASIC has perfect sine to say so. I don't know about the clone chip SE-95... I presume its a slightly modified YM2612 (a decapped one...) [QUOTE] http://www.epicgaming.us/tiido/MD_Sine.rar Kindly done by Epicenter [IMG ./images/smilies/icon_smile.gif] [IMG http://www.epicgaming.us/tiido/waveform_analysis.png] I hope this sheds some light on YM2612's internals Each WAV has 5 or 6 samples in it, First with Total Level at 00h, and each following has it incremented. 0, 1, 2... notice how the wave gets better with lower TLs... and they should be 27.5Hz... [/QUOTE] ######## POST p6582 | Snake | 2008-10-13 | t386-240.html [QUOTE] Lord Nightmare wrote:This is why I think for all ym2612 tests on real hardware, data should be captured as soon as it exits the dac on the ym2612 chip [/QUOTE] Indeed. But most YM chips output digitally to an external DAC. The YM2612 has the DAC and other things internally. There is some filtering that goes on BEFORE the signal exits the chip, and that's what I was really talking about. ######## POST p6583 | SmartOne | 2008-10-13 | t386-240.html What is it called again where you crack open an integrated circuit and >>dye<< the bits to obtain a 100% accurate representation of what goes on? Expensive, but intriguing? ######## POST p6584 | Snake | 2008-10-13 | t386-240.html [QUOTE] SmartOne wrote:What is it called again where you crack open an integrated circuit and die the bits to obtain a 100% accurate representation of what goes on? Expensive, but intriguing? [/QUOTE] Murder. [IMG ./images/smilies/icon_biggrin.gif] ######## POST p6585 | SmartOne | 2008-10-14 | t386-240.html Awww, *expletive.* I knew I was spelling that wrong! DYE. ######## POST p6588 | HardWareMan | 2008-10-14 | t386-240.html [QUOTE] Snake wrote: [QUOTE] SmartOne wrote:What is it called again where you crack open an integrated circuit and die the bits to obtain a 100% accurate representation of what goes on? Expensive, but intriguing? [/QUOTE] Murder. [IMG ./images/smilies/icon_biggrin.gif] [/QUOTE] Not quite. The Chinese often do. When the chip must be protected in reading, they whittle away the shell and read under a microscope. [IMG ./images/smilies/icon_wink.gif] And there are real benefits of this technique. So the method is technically and feasible. And the Chinese are 100% did so. But who would do so now for us? ######## POST p6590 | ElBarto | 2008-10-14 | t386-240.html That's the goal of the "Decapping Project" for MAME. ######## POST p6592 | Shiru | 2008-10-14 | t386-240.html [QUOTE] ElBarto wrote:That's the goal of the "Decapping Project" for MAME. [/QUOTE] Isn't goal of this project is to only 'dump' masked ROMs which is undumpable otherwise? Reading masked ROM data from scanned chip surface is much simpler than reconstructing chip logic from same source (if it possible at all). ######## POST p6593 | Nemesis | 2008-10-14 | t386-240.html [QUOTE] Not quite. The Chinese often do. When the chip must be protected in reading, they whittle away the shell and read under a microscope. And there are real benefits of this technique. So the method is technically and feasible. And the Chinese are 100% did so. But who would do so now for us? [/QUOTE] It wouldn't be too hard to do decapping at home, but it is a little dangerous. I had a good look at it awhile back. In order to do it properly, you need to use concentrated fuming nitric acid, which is nasty stuff. The method is simple though, it's just the acid that's dangerous. You'd want a proper fume cabinet to use, but it's the kind of thing you could easily do with the equipment you'd find in a highschool science lab. I had a go at decapping a chip just using a hand-held dremel recently, and the results were surprisingly good on the chips I tried, but you need a really steady hand, and you always end up damaging some parts of the die. Decapping is mainly useful for reading embedded ROM data though. I'm not sure how much the untrained eye could figure out in terms of how an IC actually performs various operations from pictures of the die. Never know until you try though I guess. Anyway, I've been away on holidays and then working on other areas of my emulator, so I haven't done much on the YM2612 in the last few weeks. Some SSG-EG issues came up in the Regen thread which I need to do some tests for, and I'm definitely going to have to get to the bottom of this track 12 issue in BattleTech. I was hoping that there weren't any YM2612 differences between the various mainstream Mega Drive systems. Looks like we're not quite so lucky. I agree with Snake that the focus should be on emulating the "real" YM2612, but I will do tests on the other models now to figure out what's responsible for this difference at least. I own just about every Mega Drive model, variant, and spinoff ever made, so I can run tests on all the different PAL and NTSC models with what I have on hand. ######## POST p6594 | Eke | 2008-10-14 | t386-240.html Still the question is, about the Model2 chip: why the "blip blip" sound is clearly more audible in battetech track 12 but sounds not so different from a Model 1 chip in Comix ZOne track 05 ? Both use the exact same instrument settings, the only difference being the incriminated operator RR & TL values(0x00 in Battletech, 0x0e in Comix Zone) I did not succeed in emulating both accurately by simply increasing the former 17-bits register width, this must be something else going on [QUOTE] Indeed. But most YM chips output digitally to an external DAC. The YM2612 has the DAC and other things internally. There is some filtering that goes on BEFORE the signal exits the chip, and that's what I was really talking about [/QUOTE] . I would love to know more about that and no, I'm not tired of asking [IMG ./images/smilies/icon_lol.gif] One example I think could result from bad filtering is the Konami Logo jingle in some games that sound crackly on emulators but perfectly clear in Kega ######## POST p6595 | TmEE co.(TM) | 2008-10-14 | t386-240.html http://www.fileden.com/files/2008/4/21/ ... GMPLAY.ogg Here's Konami logo along with some other things from my MD2. Mike-Stamp's VGMplay is used. ######## POST p6596 | zack | 2008-10-14 | t386-240.html http://d.hatena.ne.jp/video/niconico/sm3495564 This is the only one video i know which compare sound of jp md1 and md2. I will say md1 better than md2 in this video. u could easily hear noise in md2's sound. ######## POST p6601 | SmartOne | 2008-10-14 | t386-240.html Are you sure that's the correct Konami logo in the recording? The only one I know that has the crackling issue is the one from Zombies Ate My Neighbors. Castlevania Bloodlines BGM 26 distorts similarly. ######## POST p6602 | Snake | 2008-10-14 | t386-255.html [QUOTE] HardWareMan wrote:Not quite. The Chinese often do. [/QUOTE] Yeah, I know. I just love these chips and the thought of even one being destroyed, for any reason... *shudder* [QUOTE] Eke wrote:this must be something else going on [/QUOTE] Yep. Doesn't make any sense at all, does it? I'd like to hear this particular sound from a known completely unmodified PAL MD2 before I think about it too much, though [IMG ./images/smilies/icon_wink.gif] I have no idea on what the sample Aamir provided came from but the sound is even louder than TmEE's CCAM MD2. I really think that must have been modified in some way. Or is just broken [IMG ./images/smilies/icon_wink.gif] ######## POST p6603 | YM2612fan | 2008-10-15 | t386-255.html [QUOTE] TmEE co.(TM) wrote:I'm gonna do more recordings... more games please [IMG ./images/smilies/icon_smile.gif] [/QUOTE] Can you post recordings from your modified MD2 of these tracks...I'd really like to hear them using your audio mod. Blaster Master - TUNE 3 Heavy Nova - BGM 10 Hellfire - BGM 07 Subterrania - ENEMY MINES (LEVEL IV) Combat Cars - BGM 03 ######## POST p6604 | HardWareMan | 2008-10-15 | t386-255.html [QUOTE] Snake wrote: [QUOTE] HardWareMan wrote:Not quite. The Chinese often do. [/QUOTE] Yeah, I know. I just love these chips and the thought of even one being destroyed, for any reason... *shudder* [/QUOTE] Oh yeah? So you need just do brute force attack with all combinations all parameters and record the result. And see what happend. If somebody starts do this, say, in 2000, it will be already done, I think. ######## POST p6606 | Snake | 2008-10-15 | t386-255.html That's what I've been doing since 1997 [IMG ./images/smilies/icon_smile.gif] Little bugger still has secrets. ######## POST p6607 | TmEE co.(TM) | 2008-10-15 | t386-255.html [QUOTE] YM2612fan wrote: [QUOTE] TmEE co.(TM) wrote:I'm gonna do more recordings... more games please [IMG ./images/smilies/icon_smile.gif] [/QUOTE] Can you post recordings from your modified MD2 of these tracks...I'd really like to hear them using your audio mod. Blaster Master - TUNE 3 Heavy Nova - BGM 10 Hellfire - BGM 07 Subterrania - ENEMY MINES (LEVEL IV) Combat Cars - BGM 03 [/QUOTE] One thing with Hellfire, the music will be 2x slower... that is so on all MD2 based systems... mr. Snake can tell more about it I think... Heavy Nova is much likely to suffer from heavy clipping (on many tunes) as MD2 YM2612 seems to start clipping at lower amplitudes that real YM2612. And Wondermega sounds exactly like MD2, despite having the earliest MD2 ASIC in it. ######## POST p6609 | AamirM | 2008-10-16 | t386-255.html Hi, [QUOTE] I'm gonna do more recordings... more games please [/QUOTE] Busy at the moment but I was just reading this and wanted to request a recodring of Spiderman Separation Anxiety intro music. stay safe, AamirM ######## POST p6610 | TmEE co.(TM) | 2008-10-16 | t386-255.html Recordings are done, and slowly being uploaded... my connection sucks today :/ ######## POST p6611 | Eke | 2008-10-16 | t386-255.html sorry, I forget to ask: could you do a recording of Ecco: the Tide of Time 's splash sound (first level, do some jump out of the water, Gens is reproducing the sound more realistic than other emulators though I don't know if realistic=reality) thanks again ######## POST p6612 | TmEE co.(TM) | 2008-10-17 | t386-255.html http://www.fileden.com/files/2008/4/21/ ... vyNova.ogg http://www.fileden.com/files/2008/4/21/ ... D2CCAM.ogg http://www.fileden.com/files/2008/4/21/ ... ermega.ogg http://www.fileden.com/files/2008/4/21/ ... rrania.ogg http://www.fileden.com/files/2008/4/21/ ... derMan.ogg http://www.fileden.com/files/2008/4/21/ ... llfire.ogg These are the first recordings, other ones come soon. All except Hellfire come from Mike-Stamp's magnificent VGM player. ######## POST p6613 | Lord Nightmare | 2008-10-17 | t386-255.html I have a question (this is a big one too): what asics are used in all the versions of the MD/genesis, and what is the label of each YM2612 or 2612-clone chip in each one? And how do wondermega and the Amstrad mega-pc and mega-pc plus fit in to all this? Also, what is the chronological order of the system revision releases? (This data is needed to clean up the MD/genesis driver in MESS) LN ######## POST p6614 | HardWareMan | 2008-10-17 | t386-255.html [QUOTE] TmEE co.(TM) wrote:http://www.fileden.com/files/2008/4/21/ ... rrania.ogg [/QUOTE] My turn. Same track (MD1, YM2612), but not VGM - true PD ROM (for more details see this page ). [IMG ./images/smilies/icon_wink.gif] ######## POST p6615 | TmEE co.(TM) | 2008-10-17 | t386-255.html [QUOTE] HardWareMan wrote:My turn. Same track (MD1, YM2612), but not VGM - true PD ROM (for more details see this page). [/QUOTE] Someone have been busy [IMG ./images/smilies/icon_smile.gif] Mike-Stamp made one impressive ripping work too. EDIT: How is your track recorded, is there any post processing done ? Now for ASICs, I've come accross 3 compatible variants, 315-5487 (used in MD1 VA7, Wondermega, MD2 VA0), 315-5660 (MD2 VA1 and VA3, X'eye) and 513-7000 (Nomad). All have same pinout and seem to be working same (though I have no idea how same, no good equipment to do detail testing...). And Hellfire plays at correct speed in VGM ######## POST p6616 | Snake | 2008-10-17 | t386-255.html [QUOTE] Eke wrote:sorry, I forget to ask: could you do a recording of Ecco: the Tide of Time 's splash sound (first level, do some jump out of the water, Gens is reproducing the sound more realistic than other emulators though I don't know if realistic=reality) thanks again [/QUOTE] Kega has this game 100% correct. In fact, there are two different sounds, and it seems like Gens is only playing one of them. ######## POST p6617 | Eke | 2008-10-17 | t386-255.html [QUOTE] [QUOTE] sorry, I forget to ask: could you do a recording of Ecco: the Tide of Time 's splash sound (first level, do some jump out of the water, Gens is reproducing the sound more realistic than other emulators though I don't know if realistic=reality) thanks again [/QUOTE] Kega has this game 100% correct. In fact, there are two different sounds, and it seems like Gens is only playing one of them. [/QUOTE] exactly what I noticed the second sound seemed weird into my hear but if you can confirm it happens on real hw also, that's fine ######## POST p6621 | Snake | 2008-10-17 | t386-255.html [QUOTE] Eke wrote:exactly what I noticed the second sound seemed weird into my hear but if you can confirm it happens on real hw also, that's fine [/QUOTE] Yeah. It seems you're meant to hear a 'splash' when you are out of the water, and that other slightly odd sound when you're under it. ######## POST p6623 | AamirM | 2008-10-18 | t386-270.html Hi, @ TmEE Thanks a bunch for posting that recording. Now.... @ Snake In that Spiderman recording, notice that a intrument is played using channel 3 (alternating between left and right channels) has quite low level compared to all other emulators (except Kega) and I would like to know how do you do that? stay safe, AamirM ######## POST p6630 | Lord Nightmare | 2008-10-19 | t386-270.html In response to ym2612 versions, there appear to be 7 variants of the MD system *in terms of ym2612 and VDP*: MD1 VA0 thru VA6: use a real yamaha ym2612 and a real 315-5313 VDP (note that va0 and va4 (and likely the intervening models, but please correct me) have 3 asics, while at least va5 and va6 have only two, one of which is the vdp) MD1 VA7 thru MD2 VA1, plus MD2 VA3: use a FC1004 ASIC with ym2612 and VDP functionality integrated. The amstrad mega-pc also uses this same ASIC. MD2 VA2: need more info on this MD2 VA4/MD3 VA1: uses 315-5960 asic, need more info on where the ym2612 is hiding MD3 VA0: need more info on this MD3 VA2: uses 315-6123 "FQ8007" asic, need more info Nomad(and megajet?): uses a 315(or is this 513?)-7000(or is it 5700?) ASIC with ym2612 and VDP integrated (as well as the z80?) So for sound analysis, we need to consider all of these 7 (and there are likely more) as separate. Most emulators probably should try to emulate the original MD1 config with the separate ym2612, alternately choosing the FC1004 asic which has a 'cleaner' ym2612. Edited 10/20/2008, thanks to Tmee for corrections LN ######## POST p6631 | SmartOne | 2008-10-19 | t386-270.html Wow, but do those four really sound that different? ######## POST p6632 | TmEE co.(TM) | 2008-10-19 | t386-270.html Real YM2612 sounds one way (poorer), and ASIC variants all sound same. I have systems with all 3 in them, and no difference whatsoever. My VA1 MD2 ( http://www.hot.ee/tmeeco/MYSMD2.JPG ) has 315-5660, the VA1.x plays no role to what's in the machine, 5487 is old, 5660 is newer, and 5700 is newest from these types of ASICs. MD2 VA2 uses discrete YM2612, and different ASIC, MD2 VA4 uses same setup as one of the 2 known Genny3 setups. I know nothing about MD2 VA4 nor Genny3s. The last Genny3 setup, or maybe the one also used in MD2 VA4, has some things altered in them which causes incompatibilities with few games, and around around 10% US SMS games have some glitches (so I've been told). ######## POST p6633 | Snake | 2008-10-19 | t386-270.html [QUOTE] TmEE co.(TM) wrote:Real YM2612 sounds one way (poorer) [/QUOTE] Blasphemy! [IMG ./images/smilies/icon_wink.gif] Certainly, with your audio mod, an MD2 sounds better - but without it - ugh. But with a similar audio mod I think you'd find a real YM2612 doesn't sound much different, if it all. ######## POST p6635 | TmEE co.(TM) | 2008-10-19 | t386-270.html It makes things nice and clear, but the sheer amount of the "ladder effect" noise which is otherwise filtered out ruins all experience for me... it sounds like a damn 6-bit WAV (not as bad, but you get the idea...). ######## POST p6636 | HardWareMan | 2008-10-19 | t386-270.html [QUOTE] TmEE co.(TM) wrote:It makes things nice and clear, but the sheer amount of the "ladder effect" noise which is otherwise filtered out ruins all experience for me... it sounds like a damn 6-bit WAV (not as bad, but you get the idea...). [/QUOTE] Indeed. YM2612 "ladder" effect was clearly hear at very low volume on every FM channel (did not tested it for DAC). But I had MD2 with integrated YM2612+Z80+M68000+Arbiter+IOPort in one big chip. It did not produce this "ladder" effect but it did mute some very low volume sounds! Very noticeable cut off some weak sounds. ######## POST p6637 | TmEE co.(TM) | 2008-10-19 | t386-270.html Some cutting happens, but at these volumes, its hard to make out what you're listening anyway... My MD2 has 68K, Z80 and all RAMs separate... also, PSG carries VDP activity noise [IMG ./images/smilies/icon_razz.gif] ######## POST p6638 | Lord Nightmare | 2008-10-20 | t386-270.html I've updated the post above with the systems list with tmee's corrections, and to include late MD2 and MD3. Please add comments. Also, which MD2 has the z80 inside the giant asic? VA4? Thanks to tmee's correction, I know all the va1.x ssytems are really 'VA1' systems regardless of the second number, but I'm still missing a couple of md2 systems: FC1004 ASIC chips: (208 pins) 315-5487, 315-5487-01, 315-5487-10, 315-5660, 315-5660-02, 315-5700, all are supposedly interchangable MD2 VA0: FC1004, separate? z80 MD2 VA1(.x) (and x'eye and multimega): FC1004, separate zilog z80 or 315-5676/315-5619 which seems to be a z80 MD2 VA2: NEED INFO on this system, preferably a pcb picture. tmee says it has a separate ym2612, a non-yamaha version? MD2 VA3: FC1004, ? z80 MD2 VA4: 315-5960 asic (160 pins), may have z80 on it? do these systems have separate yamaha chips or is that inside an asic? MD3 VA0: NEED INFO on this system, preferably a pcb picture MD3 VA1: 315-5960 asic (160 pins), may have z80 on it? do these systems have separate yamaha chips or is that inside an asic? MD3 VA2: 315-6123 FQ8007 (208 pins, not compatible with FC1004, contains z80?) LN ######## POST p6639 | TmEE co.(TM) | 2008-10-20 | t386-270.html 315-5487, -5660, -5700 all are VDP+I/O+YM2612+PSG. 68K, Z80 and RAMs are separate on these systems. 5660 and 5700 are definitely pin compatible, 5487 uses same VRAM chips as what are in MD1 and I have no idea if they're compatible with the single VRAM chip used in later designs. All should be considered same. MD1 VA0...VA4, all have no TMSS, all have 2 part I/O controller, everything is with discrete chips. VA3 has one small extra digital chip in it, which function is unknown to me, possibly related to clock signals... earlier models possibly too. MD1 VA5 and VA6 are same as previous models, but have single chip I/O controller and also have TMSS. VA2 MD2 has discrete YM2612, which is made by Yamaha. Goes under MD1 category. 315-5950 has everything but VRAM and 68K RAM integrated in it. http://www.sega-16.com/forum/showthread.php?t=5079 All newer designs should be like that chip, with everything integrated... ######## POST p6641 | YM2612_fan | 2008-10-21 | t386-270.html [QUOTE] TmEE co.(TM) wrote:315-5487, -5660, -5700 all are VDP+I/O+YM2612+PSG. 68K, Z80 and RAMs are separate on these systems. [/QUOTE] What about the 315-5708 ASIC? I don't see a separate Z80 on my board (MD2 - VA1,) unless the KM428C64J-10 is a clone. ######## POST p6643 | TmEE co.(TM) | 2008-10-21 | t386-270.html VA1 boards have to have Z80 (I've only seen clone chips on all units I've had access to), 68K and RAMs... The Z80 is a small square chip near reset switch. I think it had 40 or 44 pins. 5708 is a 5660 and 5700 compatible then... how many variants Sega has !? ######## POST p6644 | Eke | 2008-10-22 | t386-270.html I've fallen accross this picture recently and made me think about this topic: http://img523.imageshack.us/img523/4518 ... ordhf9.jpg apparently, the Amstrad MegaPC had a YM3812 inside (instead of YM2612 ?) and 315-5487 (bus arbitrer + VDP/PSG ?) ######## POST p6645 | Shiru | 2008-10-22 | t386-270.html [QUOTE] Eke wrote:Amstrad MegaPC had a YM3812 inside (instead of YM2612 ?) [/QUOTE] YM3812 is OPL2, it's not compatible with YM2612. ######## POST p6646 | TmEE co.(TM) | 2008-10-22 | t386-270.html 315-5487 is the first VDP+I/O+PSG+YM2612. The OPL2 was in the MegaPC for Adlib compatibility. ######## POST p6647 | Eke | 2008-10-22 | t386-285.html thanks for clarifying, that seemed odd indeed ######## POST p6648 | Lord Nightmare | 2008-10-23 | t386-285.html ouch. whoever owned that megapc snapped capacitor c113 off of the MD isa card. SOMETHING is gonna work completely wrong until that is replaced. EDIT: nope, once again I'm wrong. C113 is NOT SUPPOSED to be populated. see a later megapc plus card here: http://aycu14.webshots.com/image/27693/ ... 198_rs.jpg It may have only been populated on some early cards. LN ######## POST p6649 | kode54 | 2008-10-25 | t386-285.html Commenting this line in the MAME fm.c source: [CODE BLOCK WITHHELD: 66 chars] seems to fix dropped or cut notes in the following VGM tracks, at least: Dynamite Headdy - Geisha Robot Bubba 'n' Stix - The Spaceport Maybe something needs further testing? ######## POST p6651 | Eke | 2008-10-26 | t386-285.html yeah, I was wrong with this one (broke some other sound effects too) and reverted it some time ago in my implementation .... unfortunately, MAME used an older version as reference and there is still some mistakes (also probably in the new one) and Steve Snake confimed the Ecco 2's sound "bug" was not a bug so... ######## POST p6659 | Arbee | 2008-10-27 | t386-285.html MAME 0.128u2 will be up to date with r157 of GenPlus-GX, including removing that "fix". Any ideas on the Battletech thing? ######## POST p6660 | Eke | 2008-10-27 | t386-285.html for me, battletech track 12 sounds like Model 1 recording, probably not exactly (kega sound a little more accurate) because it requires better filtering but close enough to me at the moment or were you talking of something else ? ######## POST p6666 | Arbee | 2008-10-27 | t386-285.html That's fine. I wasn't clear if it was a problem in the MAME code or not. ######## POST p6668 | AamirM | 2008-10-27 | t386-285.html Hi, [QUOTE] Eke wrote:for me, battletech track 12 sounds like Model 1 recording, probably not exactly (kega sound a little more accurate) because it requires better filtering but close enough to me at the moment or were you talking of something else ? [/QUOTE] Did you tried changing fn_max to something more suitable for 48000/44100 or whatever you run at? Although I am not an expert on MAME but it seems MAME will resample everything to 44100...even if you set sample rate to something higher (like 48000). stay safe, AamirM ######## POST p6669 | Eke | 2008-10-27 | t386-285.html what do you mean by "more suitable" ? I emulate the chip at his original frequency internally so I dont think I need to change the max value this should be the job of the resampler/filter (and indeed, the gc/wii output samplerate is 48Khz) ######## POST p6674 | Arbee | 2008-10-27 | t386-285.html [QUOTE] MAME will resample everything to 44100...even if you set sample rate to something higher (like 48000). [/QUOTE] No, it resamples to whatever rate you set it to. I run MAME at 48 kHz (since that's the native rate of my Audigy 2) and it works fine. ######## POST p6679 | AamirM | 2008-10-28 | t386-285.html Hi, [QUOTE] Eke wrote: what do you mean by "more suitable" ? I emulate the chip at his original frequency internally so I dont think I need to change the max value this should be the job of the resampler/filter (and indeed, the gc/wii output samplerate is 48Khz) [/QUOTE] Sorry, I forgot you used a resampler now [IMG ./images/smilies/icon_redface.gif] . [QUOTE] Arbee wrote: No, it resamples to whatever rate you set it to. I run MAME at 48 kHz (since that's the native rate of my Audigy 2) and it works fine. [/QUOTE] Thanks for clarifying that up. stay safe, AamirM ######## POST p6725 | Shiru | 2008-11-01 | t386-285.html About decapping and FM chips emulation: http://docs.google.com/View?docid=dd8kqn9f_13cqjkf4gp (OPL2 and OPL3). ######## POST p6726 | HardWareMan | 2008-11-01 | t386-285.html [QUOTE] Shiru wrote:About decapping and FM chips emulation: http://docs.google.com/View?docid=dd8kqn9f_13cqjkf4gp (OPL2 and OPL3). [/QUOTE] I wonder what they used for dissolve chip shell? I've heard, there is an liquid wich dissolve only plastic shell and did not touch the chip crystal. I would like to look at chip under a microscope... ######## POST p6727 | Shiru | 2008-11-01 | t386-285.html [QUOTE] HardWareMan wrote:they used for dissolve chip shell? [/QUOTE] They used MEFAS service . You can find list of equipment of that company on their page. Part of this list: [QUOTE] Package Decapsulation Nisene D cap system B&G 250 system [/QUOTE] I think, you can ask Matthew or Olli about hi-res photos. ######## POST p6729 | HardWareMan | 2008-11-01 | t386-285.html [QUOTE] Shiru wrote:I think, you can ask Matthew or Olli about hi-res photos. [/QUOTE] I mean I want to look at YM2612 crystal not YM3812. ######## POST p6730 | Shiru | 2008-11-01 | t386-300.html [QUOTE] HardWareMan wrote:I mean I want to look at YM2612 crystal not YM3812. [/QUOTE] Well, then you already know how much it will cost (~$90 decap without postage). I don't think it's possible to get near quality of photos at home, if you don't have good equipment and you never did it before. ######## POST p6731 | Jorge Nuno | 2008-11-01 | t386-300.html I think it is the fumic nitric acid you are looking for... (The "normal" nitric acid won't do). It's super corrosive and it's vapours can change the the skin color to yellow [IMG ./images/smilies/icon_eek.gif] ######## POST p6741 | Nemesis | 2008-11-03 | t386-300.html [QUOTE] Shiru wrote:About decapping and FM chips emulation: http://docs.google.com/View?docid=dd8kqn9f_13cqjkf4gp (OPL2 and OPL3). [/QUOTE] Thanks for posting that, I hadn't come across that info. Those tables they provided confirm a lot about how I believed the operator unit worked internally. Both the sin and pow tables have 256 entries, and the sin table is a perfect match for the data my algorithm generates. The power table is a little different however. Since the entries in the power table effectively run from 0x7FA-0x400, they didn't need to include bit 10, since it's always fixed to 1, so the entries in the real physical table run from 0x3FA-0x0. It's also interesting that they listed the entries in their power table in reverse, from 0x0-0x3FA. Did they read the table backwards, or does the index get inverted before a lookup to the power table for some reason? The result will be equivalent, but once again, it's interesting to see exactly how the real YM2612 performed its operations internally. [QUOTE] Well, then you already know how much it will cost (~$90 decap without postage). [/QUOTE] $90? Is that all a professional decap costs? Hmm, for $90 I might pay to get the YM2612 decapped myself. In fact, I think I will. I'll need to pick myself up a good digitial microscope to take my own pics. Anyone got any suggestions on a particular model? What kind of magnification do you think I'd need to get a good shot of the die? 1000x? The microscope will also need to have its own lighting built in obviously. I think I could afford to spend a reasonable sum on a decent scope. It'll make a valuble addition to my collection of equipment. I'll have to do some research. As soon as I've got a microscope picked out, I'll send away a chip to be decapped. I've got a few chips sitting around here already desoldered and ready to go. I'm not really sure how much immediately useful info a decap will give us, but it'll be fun. ######## POST p6742 | Shiru | 2008-11-03 | t386-300.html [QUOTE] Nemesis wrote:$90? Is that all a professional decap costs? [/QUOTE] That said in the article. [QUOTE] Nemesis wrote:What kind of magnification do you think I'd need to get a good shot of the die? 1000x? [/QUOTE] This (copy-paste this link, does not work otherwise) is 100x, so probably 1000x will be overkill. ######## POST p6743 | Oliver_A | 2008-11-04 | t386-300.html [QUOTE] Nemesis wrote: I'm not really sure how much immediately useful info a decap will give us, but it'll be fun. [/QUOTE] The first component I would examine is the DAC. ######## POST p6757 | Lord Nightmare | 2008-11-06 | t386-300.html I got the high-res opl2 pics from Olli (he goes by 'yehar' on ircnet), and unfortunately, not all the chip is imaged at high res. There is also at least one smaller rom on it (roughly 16x7 bits), which could be key-shift or other LUT tables which are not imaged at a high enough resolution yet to be fully visible and decodable. I'll see if I can prod Olli to join the conversation here. LN ######## POST p6758 | Nemesis | 2008-11-06 | t386-300.html I'd be interested in taking a look at those images. Any chance of putting the archive up on a file dumping site? (if Olli is ok with that of course) I'd also be interested in hearing what kind of equipment was used to take the pictures. Did MEFAS take the pics, or did they use their own equipment, and if so, what equipment did they use? ######## POST p6767 | yehar | 2008-11-06 | t386-300.html Hi, it's Olli writing... [QUOTE] Nemesis wrote:I'd be interested in taking a look at those images. Any chance of putting the archive up on a file dumping site? (if Olli is ok with that of course) [/QUOTE] Here's one "dump": http://yehar.com/adlib [QUOTE] Nemesis wrote:I'd also be interested in hearing what kind of equipment was used to take the pictures. Did MEFAS take the pics, or did they use their own equipment, and if so, what equipment did they use? [/QUOTE] We only paid MEFAS to do the decapsulation. They were willing to do more, but presumably at a much higher cost. I went to the material technology lab (or something to that effect) at Oulu university here in Finland, and they were kind enough to let me use their microscope that was used there to inspect materials. It had its own built-in color digital camera, which however didn't have enough resolution for reading the bits from the memory. The microscopy system was from mid-90's probably, I cannot remember details like magnification. I got better results by using my pocket digicam through the eyepiece, but it was quite cumbersome, so I didn't shoot the whole die. If someone has access to a better microscope with a built-in camera and is willing to take pictures of the whole die of YM3812 (OPL2) and YMF262 (OPL3), I will gladly mail the decapsulated chips to them (drop me an e-mail at o@iki.fi ). You will need an optical microscope that has a lighting system available that does not try to beam light through the sample (typically on a glass slide), but illuminates it from above. Older chips are easier to photograph because the line width is broader. The circuit on YMF262 was already significantly more dense than on YM3812, and I don't think we would have succeeded in reading the ROM's from it alone. Nemesis, I got the impression that the sine table was sign-inverted, and that the exp table was as expected, the opposite of your analysis. :-) ######## POST p6775 | bobthebuilder | 2008-11-08 | t386-300.html How many pictures would that be and at what magnification? ######## POST p6779 | yehar | 2008-11-09 | t386-300.html [QUOTE] bobthebuilder wrote:How many pictures would that be and at what magnification? [/QUOTE] Hmm maybe 300 pictures per die and 100X magnification. ######## POST p6784 | Lord Nightmare | 2008-11-10 | t386-300.html opl2 rom3: This decoding is based on http://yehar.com/adlib/ym3812_rom3_1.jpg Legend: 0 = dark/absent gate, 1 = light/present gate C = clear/correct for this address, C? = probably correct. X = a pullup or perhaps pulldown between every 2nd rom line, only present on bits which need it. This was useful for checking to be sure if the bits present are sane or not, as such: The X will only appear if one of the bit gates immediately above or below it is present. Note that all bits may be inverted, and the bit order may be backwards as compared to the usual MSB-at-left notation. [CODE BLOCK WITHHELD: 262 chars] Thats what I BELIEVE the contents of ROM3 on the opl2 are. I'm not sure what it is used for yet. 4 bits address in, 7 bits data out. LN ######## POST p6785 | Nemesis | 2008-11-11 | t386-300.html I've purchased some gear which should do the job of capturing images of the die. I'll give it a test run once it all arrives. I'm happy to take full die snaps of the YM3812 and YMF262 once I've got a process in place. I'm planning to take full coverage snaps of the entire die in a grid, at a suitable zoom level. Once I've got all the pics, I'll stitch them together into one large psd image or the like, so you'll be able to download a full die shot of the device, and zoom in on the parts you want to examine. If nothing else, it'll make a good poster. [IMG ./images/smilies/icon_biggrin.gif] I've also contacted MEFAS and got the ball rolling with getting the YM2612 decapped. ######## POST p6787 | yehar | 2008-11-11 | t386-300.html Nemesis, Nice! :-) I also just ordered a microscope, so I will delay sending you the chips until I have tried taking the pictures myself, before end of this month I hope. I bought this Aigo GE-5: http://cgi.ebay.de/ws/eBayISAPI.dll?Vie ... AQ:DE:1123 Manual: http://www.analogtechnologies.com/Aidep ... ual_EN.pdf I'll let you know if it's any good. The 1/2 " size 1280 x 1024 pixel sensor and 60X, 180X and 540X all optical magnification should give a resolution of something like 90 nm, 30 nm and 10 nm per pixel. The price of the microscope was 350 EUR including postage. ######## POST p6788 | yehar | 2008-11-11 | t386-300.html Lord Nightmare, I get exactly the same decoding. If you look at a pullup, the stuff just above and below the dark dot, that will already tell you to which ROM line the pullup is connected. ######## POST p6849 | yehar | 2008-11-20 | t386-300.html [QUOTE] yehar wrote:I also just ordered a microscope, so I will delay sending you the chips until I have tried taking the pictures myself, before end of this month I hope. I bought this Aigo GE-5 [/QUOTE] OK, having played with it an hour, it is not as good as I hoped. The 540x zoom will only give a resolution of 500 nm / pixel. The magnification ratio is probably calculated for a typical computer screen, and is NOT the ratio of enlargement to the sensor as I had thought. Currently it is not possible to read bits from memory with this setup, or even to follow the traces on the die. Now I have to use a lamp from the sides and that gives nasty highlights and not a smooth lighting. Perhaps a modification would help. The sample could be illuminated from above through a beamsplitter. Dunno. ######## POST p6854 | Lord Nightmare | 2008-11-21 | t386-315.html I did top-illumination using a 1940's binocular scope (my mom used it in medical school in the 1970s) by taking one eyepiece lens out and sticking a flashlight in the hole (being sure it didn't fall in and scratch something). It DOES work, but only so-so; you get a lot of light from the second eye directly back up the remaining one without hitting the die at all. I don't know what the maximum magnification possible is, but it is probably somewhere around 400x-500x, or maybe more with oil immersion. LN ######## POST p7393 | Jorge Nuno | 2009-01-27 | t386-315.html bump! [IMG ./images/smilies/icon_biggrin.gif] I'm quite interested to know what pin #10 on the 2612 is..., It says in wikipedia that it's a not connected pin, the genesis1 VA0 schematics don't mention it, but! It has internal resistance to both +V e Gnd (around 90kOhm, depends slightly on the measure polarity when it's powered off). Powered on and playing stuff gives 4.85V (not sure if it's steady, or if has some AC on top) ######## POST p7398 | TmEE co.(TM) | 2009-01-27 | t386-315.html IIRC, this pin is tied to the ReadyBit of chip, useful for hardware based timings (which I would not like, as I can do something useful while I wait for the chip to become ready). ######## POST p7402 | Jorge Nuno | 2009-01-27 | t386-315.html Humm? Maybe you are talking about the IRQ pin. That is #13. Pin #10 is nowhere mentioned about. It could be apparently the not-so-important /Test pin, like the one in the 2608 translated pdf, (It says it has an internal pullup). ######## POST p7409 | Nemesis | 2009-01-28 | t386-315.html I've seen some references which do in fact refer to pin 10 as the "Test" pin. I think I mentioned it in passing somewhere in this thread. TmEE is right about its function. What it does is return the real-time state of the "busy" flag from the status register. It's an output line which is asserted when the YM2612 is busy, and negated when the YM2612 is ready to receive a write. You could use it in a circuit to detect when the YM2612 is ready to receive the next write, without having to read and decode the status register. ######## POST p7410 | Nemesis | 2009-01-28 | t386-315.html Oh, and seeing as I was going to bump this thread myself soon, I might as well mention that I've got another round of info coming up, including a lot of fixes for the envelope generator. I'm very close to completing some extremely comprehensive testing which I'm using to build a binary-accurate envelope generator. When I carried out my original tests on the envelope generator, I didn't know enough about the rest of the chip to digitally sample the output from the envelope generator, but the process of fully breaking down the operator unit and the phase generator, as well as more experimentation with the test register, now allow me to perform tests where I can determine the exact digital output from the envelope generator easily. As a result, I've started from scratch with the envelope generator and re-tested everything, plus gone much further and tested a lot of stuff I wasn't able to test before. I've spent the last few weeks running an extremely comprehensive tests designed to determine exactly how, where, and when the envelope generator carries out all of its operations, and as a result, I'm very close to building a perfect YM2612 envelope generator. By that, I mean an envelope generator which perfectly emulates the YM2612 envelope generator output under every operating condition, including when any register change occurs at any point, and when those register changes are combined with all the 1001 strange cases that can occur in SSG-EG mode, including when an attack phase is used. And yeah, the MAME core will require a lot of fixes to incorporate these changes. I had to rewrite my own envelope generator from scratch to accomodate them. Virtually everything about my SSG-EG implementation was wrong, and the way a lot of it is implemented is surprising. The payoff is worth it though. I know enough about the envelope generator now to contruct some truly evil tests, and I know how to make them all pass. You won't have to worry about any games having envelope-related issues after this. In fact, when I release my core, I dare anyone to find any case in which my YM2612 doesn't produce a binary accurate output. [IMG ./images/smilies/icon_biggrin.gif] ######## POST p7418 | Eke | 2009-01-28 | t386-315.html [QUOTE] Nemesis wrote: And yeah, the MAME core will require a lot of fixes to incorporate these changes. [/QUOTE] can't wait for it [IMG ./images/smilies/icon_wink.gif] everything seems very promising, huge thanks for your effort Nemesis ######## POST p7419 | Christuserloeser | 2009-01-28 | t386-315.html I would like to thank you as well, your work means a lot to me. ######## POST p7427 | dr. apocalipsis | 2009-01-28 | t386-315.html Can't wait to see it fully implemented in current emus ^^ ######## POST p7429 | Snake | 2009-01-29 | t386-315.html [QUOTE] Nemesis wrote:Virtually everything about my SSG-EG implementation was wrong, and the way a lot of it is implemented is surprising. [/QUOTE] It's definitely the strangest part of the chip, and as I said before, doesn't do what you'd expect in a lot of situations. You've nailed all cases now though? That's pretty cool. I ended up testing just the ones I knew were used because the only way I had of testing was (convert rom to SMD, copy to floppy, load floppy in SMD device) and it was taking me DAYS to get through all this stuff [IMG ./images/smilies/icon_sad.gif] But I don't even have that anymore so I'm looking forward to your findings. AFAIK it's the last bit of the chip that I don't have 100%. Well, ignoring the DAC distortion. ######## POST p7430 | GManiac | 2009-01-29 | t386-315.html Hi all. I hope next information will be useful. Many years ago I noticed that music of After Burner sounds poorly in emulators. I didn't know about this great research on YM2612. It seems that the latest versions of Fusion or Regen are made with a glance of new info from this research, but it didn't affect sound in After Burner. There is some instrument(s) that doesn't play in emulators. Simply listen to song "Super Stripe" on real hardware and you'll feel the difference. ######## POST p7434 | Snake | 2009-01-29 | t386-315.html [QUOTE] GManiac wrote:It seems that the latest versions of Fusion or Regen are made with a glance of new info from this research [/QUOTE] 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. [QUOTE] GManiac wrote:There is some instrument(s) that doesn't play in emulators. Simply listen to song "Super Stripe" on real hardware and you'll feel the difference. [/QUOTE] If true this is very odd. ######## POST p7435 | GManiac | 2009-01-29 | t386-315.html Here is the recording from my chinese MD2 clone (for some reason it sounds better than even MD1 HD). http://shedevr.org.ru/ghost/After_Burner_II_-_SS.ogg ######## POST p7437 | Snake | 2009-01-29 | t386-315.html Thanks - I know this tune very well (second cart I bought [IMG ./images/smilies/icon_smile.gif]) and briefly listened to it in Fusion last night. The sounds are all there, but yes, one or two of them are barely audible. The music in this game is mixed at a very low volume so that the PSG samples can be heard at a decent volume. At first glance it looks like some of these sounds are louder on the real thing simply because of the distortion that occurs in the real chip. That really does need to be figured out... ######## POST p7439 | GManiac | 2009-01-29 | t386-315.html I noticed that those "instruments" are very quiet too, and I listened to only them, turning off other channels in Winamp plugin. But when I listened to hardware, its sound was more wealthy, that's why I thought that something is not playing in emulators. Although all channels are present in emulators and some of them are quiet, the main reason of poorness is not in their loudness. At this time I cut PSG (drums) and channels 1, 2 from VGM file and recorded its playback. Here's the files: http://shedevr.org.ru/ghost/After_Burner_SS_Cut.zip Seconds from 2 to 16 in Kega's playback were amplified by 3 to normalize loudness. As you see, these seconds differ sufficiently from hardware playback. Even if this all is tricks of incorrect loudnesses [IMG ./images/smilies/icon_lol.gif] (of course, no, sounds are too different) it should be corrected. ######## POST p7440 | Snake | 2009-01-30 | t386-330.html 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. ######## POST p7441 | AamirM | 2009-01-30 | t386-330.html [QUOTE] 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. [/QUOTE] 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. [IMG ./images/smilies/icon_biggrin.gif] ######## POST p7443 | Nemesis | 2009-01-30 | t386-330.html 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. ######## POST p7445 | Snake | 2009-01-30 | t386-330.html I probably should have worded that differently [IMG ./images/smilies/icon_smile.gif] [QUOTE] 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. [/QUOTE] 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. [QUOTE] Nemesis wrote:There are some significant errors in the information I posted on the envelope generator [/QUOTE] 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 [IMG ./images/smilies/icon_wink.gif] 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? ######## POST p7446 | Snake | 2009-01-30 | t386-330.html Sorry to quote myself but: [QUOTE] Snake 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. [/QUOTE] CONFIRMED: on a Genesis 2, it sounds just like Kega. ######## POST p7448 | Nemesis | 2009-01-30 | t386-330.html [QUOTE] 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. [/QUOTE] 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. [QUOTE] 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? [/QUOTE] 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. 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. ######## POST p7449 | Snake | 2009-01-30 | t386-330.html [QUOTE] Nemesis wrote:I don't think the distortion from the DAC itself is that bad though. [/QUOTE] 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.) [QUOTE] Nemesis wrote:and of course there's the obvious jump between low volume and off [/QUOTE] 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... ######## POST p7451 | Eke | 2009-01-30 | t386-330.html [QUOTE] Snake 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. [/QUOTE] I guess I learn something new every day is there an accurate way to emulate that "distortion" and, more generally, any side effects/filtering introduced by the sound output circuitry ? ######## POST p7452 | TmEE co.(TM) | 2009-01-30 | t386-330.html What Afterburner BGM are we talking about ? I've got to do a recording... ######## POST p7455 | Snake | 2009-01-30 | t386-330.html [QUOTE] Eke wrote:is there an accurate way to emulate that "distortion" [/QUOTE] There will be, yeah, but first we need to know exactly what happens. That's what I'm trying to convince Mr. Nemesis to test next [IMG ./images/smilies/icon_wink.gif] TmEE - the track is 'super stripe'. I was hoping you'd turn up to provide a CCAM version [IMG ./images/smilies/icon_smile.gif] ######## POST p7460 | Nemesis | 2009-01-30 | t386-330.html 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. ######## POST p7463 | TmEE co.(TM) | 2009-01-30 | t386-330.html 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 [IMG ./images/smilies/icon_razz.gif] 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) ######## POST p7467 | GManiac | 2009-01-30 | t386-330.html 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 [IMG ./images/smilies/icon_sad.gif] 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 [IMG ./images/smilies/icon_sad.gif] 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. ######## POST p7470 | Snake | 2009-01-30 | t386-330.html [QUOTE] 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. [/QUOTE] Yeah, thats one of those things thats completely incorrect. What do you think the accumulator does? I thought you'd covered this already. 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. [QUOTE] TmEE wrote:however, YM2612 is not having too great resolution output [/QUOTE] 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. [QUOTE] GManiac wrote:you can listen to other versions of After Burner (NES, 32X and others) - they are loud there too. [/QUOTE] 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 released [IMG ./images/smilies/icon_smile.gif] 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. [QUOTE] GManiac wrote:I don't like it [/QUOTE] No, me neither [IMG ./images/smilies/icon_wink.gif] [QUOTE] GManiac wrote:In one cases one console sounds better, in other it sounds worse [/QUOTE] 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. ######## POST p7480 | Nemesis | 2009-01-31 | t386-330.html [QUOTE] Snake wrote: [QUOTE] 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. [/QUOTE] Yeah, thats one of those things thats completely incorrect. What do you think the accumulator does? I thought you'd covered this already. [/QUOTE] 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. [QUOTE] 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. [/QUOTE] 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. ######## POST p7484 | AamirM | 2009-01-31 | t386-345.html Another thing to test would be the Spiderman intro sound I've been bugging everyone about for a while [IMG ./images/smilies/icon_smile.gif] . I don't know if its a problem with the envelope generator or whether Genesis does something special when output reaches a certain level. I found a fix for it using a hack by messing with the TL writes (if I add a certain fixed value, 0xF, to TL of the operators). It makes it sound like the recording by TmEE/Kega. Steve, would you take a look? plz plz plz ######## POST p7486 | Huge | 2009-01-31 | t386-345.html [QUOTE] AamirM wrote:Another thing to test would be the Spiderman intro sound I've been bugging everyone about for a while [IMG ./images/smilies/icon_smile.gif] . I don't know if its a problem with the envelope generator or whether Genesis does something special when output reaches a certain level. I found a fix for it using a hack by messing with the TL writes (if I add a certain fixed value, 0xF, to TL of the operators). It makes it sound like the recording by TmEE/Kega. Steve, would you take a look? plz plz plz [/QUOTE] Which Spiderman, the Animated Series one? I thought it just uses the channel 3 glitch, like Comix Zone. ######## POST p7487 | AamirM | 2009-01-31 | t386-345.html Spiderman Separation Anxiety. There is a problem in the intro, on channel 3 and 6. ######## POST p7489 | HardWareMan | 2009-01-31 | t386-345.html [QUOTE] GManiac wrote:...Hmmm, I listened to "Super Stripe" from CCAM'ed MD2 and... I don't like it [IMG ./images/smilies/icon_sad.gif] [/QUOTE] Me too. But we can not compare the taste? My turn to share some records. http://rapidshare.com/files/192035241/AftBrn2.rar.html http://rapidshare.com/files/192021501/WavPlay.rar.html Record takes from unmodded MD1 (YM2612+SEGA 315-5313, board IC BD M5 PAL VA4) in 60Hz mode. [IMG http://img216.imageshack.us/img216/1151/dscn2670bk6.th.jpg] As the saying goes - feel the difference. ######## POST p7490 | Nemesis | 2009-01-31 | t386-345.html [QUOTE] AamirM wrote:Spiderman Separation Anxiety. There is a problem in the intro, on channel 3 and 6. [/QUOTE] Ahh yes, I think I know the instruments you're talking about. I looked into that a bit. Little known fact: Even when the LFO is disabled, amplitude (and frequency?) modulation are still applied, but the LFO waveform itself is locked. In the problem track on Spiderman, the instruments on channels 3 and 6 have AM sensitivity set to max, with amplitude modulation enabled on all operators. Whatever value the LFO is frozen at, it applies a large amount of attenuation to the instrument, making it much softer. Phase modulation may also be affecting the pitch. I haven't done full tests on this behaviour, as I haven't started work on the LFO yet. ######## POST p7492 | Nemesis | 2009-01-31 | t386-345.html [QUOTE] Record takes from unmodded MD1 (YM2612+SEGA 315-5313, board IC BD M5 PAL VA4) in 60Hz mode. [/QUOTE] Ahh, that's more like it. [IMG ./images/smilies/icon_smile.gif] That's the exact model I do most of my testing on. ######## POST p7493 | HardWareMan | 2009-01-31 | t386-345.html [QUOTE] Nemesis wrote: [QUOTE] Record takes from unmodded MD1 (YM2612+SEGA 315-5313, board IC BD M5 PAL VA4) in 60Hz mode. [/QUOTE] Ahh, that's more like it. [IMG ./images/smilies/icon_smile.gif] That's the exact model I do most of my testing on. [/QUOTE] Cool! That mean we have same result in audio because we have same analog part. I can do more audio tests if anybody need this. [IMG ./images/smilies/icon_wink.gif] After Burner 2 used PSG as DAC sets highest possible frequency and controls it amplitude (16 levels). And this frequency can be heared in headphones. But, when I try to record it by soundcart this high frequency seems to cut-off by filter in soundcart. Or something like that. That frequency very close to channel change frequency (that was I showed at oscillograph screen). And YM2612 output mixes with PSG output before preamp, which do filtering of high frequences. So that to high frequences can affect to each other and produce many harmonic frequences, wich make sound much complex, then we can imagine. ######## POST p7494 | TmEE co.(TM) | 2009-01-31 | t386-345.html [QUOTE] GManiac wrote: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. [/QUOTE] PSG is not causing any distortions, its that PSG is used to play samples, and the result is failrly silent... now FM has to be made silent aswell so you could actually hear the samples from PSG... BUT not having too high accuracy, things become quite aliased at lower volume levels. I can disable PSG from my MD2 (by disconneting PSG input from the audio mod) and things will be exactly like they are, just without samples... [QUOTE] 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). [/QUOTE] Its an European MD2 model MK-1631-50 with IC BD VA1 PAL board, and 315-5660-02 system ASIC. http://www.fileden.com/files/2008/4/21/1876835/5E6A.jpg http://www.hot.ee/tmeeco/MYSMD2.JPG [QUOTE] HardWareMan wrote:Me too. But we can not compare the taste? My turn to share some records. http://rapidshare.com/files/192035241/AftBrn2.rar.html http://rapidshare.com/files/192021501/WavPlay.rar.html Record takes from unmodded MD1 (YM2612+SEGA 315-5313, board IC BD M5 PAL VA4) in 60Hz mode. As the saying goes - feel the difference. [/QUOTE] I also have exact same model MD1 that HardWareMan has, but without some of the mods he has in his MD1 [IMG ./images/smilies/icon_wink.gif] Your recordings sound quite bright, my anything from my MD1 sounds much darker (more filtered)... Maybe my very long cables have something to do with it (6 meter shielded cable...) ######## POST p7496 | HardWareMan | 2009-01-31 | t386-345.html [QUOTE] TmEE co.(TM) wrote:I also have exact same model MD1 that HardWareMan has, but without some of the mods he has in his MD1 [IMG ./images/smilies/icon_wink.gif] [/QUOTE] Wich mods you mean? Adding region selector, PAL/NTSC selector and hardware pause? Nothing was change with analog audio part. [IMG ./images/smilies/icon_wink.gif] [QUOTE] TmEE co.(TM) wrote:Your recordings sound quite bright, my anything from my MD1 sounds much darker (more filtered)... [/QUOTE] Very interesting. Why so? [QUOTE] TmEE co.(TM) wrote:Maybe my very long cables have something to do with it (6 meter shielded cable...) [/QUOTE] I think capacitance of 6m qualitative cable can't spoil quality of sound. I used 10m of such cable and have no problems even in video quality. Or you used some cheap of one? ######## POST p7497 | GManiac | 2009-01-31 | t386-345.html [QUOTE] HardWareMan wrote:As the saying goes - feel the difference. [/QUOTE] [QUOTE] HardWareMan wrote:Cool! That mean we have same result in audio because we have same analog part. I can do more audio tests if anybody need this. [IMG ./images/smilies/icon_wink.gif] [/QUOTE] It's strange because I have the same MD1 as you, its date is 05 May 92 (but Chinese assembly), and yours - 20 May. But your one sounds clearer [IMG ./images/smilies/icon_eek.gif] Probably you know about this link http://arcade.ym2149.com/megadrive/index.html His MD1 is dated on 04 June 92. I recorded "Datarum" on my MD1 and it sounded just like his recording. Also someone provided recording BGM 02 from SoR2 and the result was the same. Here are comparisons: http://shedevr.org.ru/ghost/Datarum_Super_Stripe.rar HardWareMan, can you provide the whole recording or only these seconds from Datarum recording: part 1: from nearly 19.58 to 29.36 (length = 9.78) part 2: from nearly 4:38.67 to 4:41.13 (length = 2.46) Differences between models are most noticeable on this sections. [QUOTE] TmEE co.(TM) wrote:I can disable PSG from my MD2 (by disconneting PSG input from the audio mod) and things will be exactly like they are, just without samples... [/QUOTE] Do you mean those things will sound loudly or not? I think there's no necessity to disable PSG, you could playback my VGM on console (link is in previous post). [QUOTE] TmEE co.(TM) wrote:Your recordings sound quite bright, my anything from my MD1 sounds much darker (more filtered)... [/QUOTE] I said the same [IMG ./images/smilies/icon_razz.gif] and problem is not in cable. Maybe he is concealing something? [IMG ./images/smilies/icon_wink.gif] ######## POST p7498 | HardWareMan | 2009-01-31 | t386-345.html [QUOTE] GManiac wrote: [QUOTE] HardWareMan wrote:As the saying goes - feel the difference. [/QUOTE] [QUOTE] HardWareMan wrote:Cool! That mean we have same result in audio because we have same analog part. I can do more audio tests if anybody need this. [IMG ./images/smilies/icon_wink.gif] [/QUOTE] It's strange because I have the same MD1 as you, its date is 05 May 92 (but Chinese assembly), and yours - 20 May. But your one sounds clearer [IMG ./images/smilies/icon_eek.gif] Probably you know about this link http://arcade.ym2149.com/megadrive/index.html His MD1 is dated on 04 June 92. I recorded "Datarum" on my MD1 and it sounded just like his recording. Also someone provided recording BGM 02 from SoR2 and the result was the same. Here are comparisons: http://shedevr.org.ru/ghost/Datarum_Super_Stripe.rar HardWareMan, can you provide the whole recording or only these seconds from Datarum recording: part 1: from nearly 19.58 to 29.36 (length = 9.78) part 2: from nearly 4:38.67 to 4:41.13 (length = 2.46) Differences between models are most noticeable on this sections. [/QUOTE] Done. There no problem do it with my "Super 3in1 Trax" PD ROM . [IMG ./images/smilies/icon_wink.gif] http://rapidshare.com/files/192104633/Datarum.rar While recording Datarum noticed an interesting feature: record sounds different from the direct signal. Such a scheme: MD1 is connected to the line input, and listening to headphones with pre-amplifier connected to the output of a sound card. Sound card is Creative Audigy model SB0090. I try to record at 44kHz and at 48kHz - no difference, but still different than direct signal. And matter is not in the frequency range, the upper of which cut-off at ADC sampling. There is something else... The truth is out there (C) Cris Carter [IMG ./images/smilies/icon_wink.gif] ######## POST p7499 | TmEE co.(TM) | 2009-01-31 | t386-345.html My MD1 is 08 May 1992... I'll do some recordings and provide a pic or two... ######## POST p7500 | GManiac | 2009-01-31 | t386-345.html [QUOTE] HardWareMan wrote: Done. There no problem do it with my "Super 3in1 Trax" PD ROM . [IMG ./images/smilies/icon_wink.gif] http://rapidshare.com/files/192104633/Datarum.rar [/QUOTE] It's awesome! [IMG ./images/smilies/icon_eek.gif] Your playback is the best, it's better than CCAMed MD2's and still doesn't sound too sharply or poignantly. Maybe I have bad specimen of MD1? I intend to purchase first Japanese model and I hope it'll be as good as yours. [QUOTE] HardWareMan wrote:Sound card is Creative Audigy model SB0090. I try to record at 44kHz and at 48kHz - no difference, but still different than direct signal. [/QUOTE] As Nemesis said, he notices something on oscillogram at 192 kHz rate. It seems the best option is to use sound card with 384 kHz ADC, but it's very high grade of sound cards. Also when I recorded James Bond tracks at 96 kHz, I noticed some strange lines on spectrogram. Later I'll show them. ######## POST p7501 | TmEE co.(TM) | 2009-01-31 | t386-345.html My Yamaha YMF71x type card could do 500KHz 16bit stereo (or perhaps 1MHz 16bit mono) sampling according to datasheet where its said that the DAC and ADC can handle 2MBytes of data per second... Windows(95) drivers don't allow me to use rates above 64KHz... And the Datarum recording of HWM does not sound as bright as the recordings of the AfterBurner songs.... ######## POST p7502 | HardWareMan | 2009-01-31 | t386-345.html [QUOTE] GManiac wrote: [QUOTE] HardWareMan wrote: Done. There no problem do it with my "Super 3in1 Trax" PD ROM . [IMG ./images/smilies/icon_wink.gif] http://rapidshare.com/files/192104633/Datarum.rar [/QUOTE] It's awesome! [IMG ./images/smilies/icon_eek.gif] Your playback is the best, it's better than CCAMed MD2's and still doesn't sound too sharply or poignantly. Maybe I have bad specimen of MD1? I intend to purchase first Japanese model and I hope it'll be as good as yours. [/QUOTE] Everything can be corrected. If your MD have same sound chips, then there can be preamp filtering error. Some of passive elements may have allowed more than +-20%. And for amplifier frequency loopback it is enough to cut-off something more, than need. [QUOTE] GManiac wrote: [QUOTE] HardWareMan wrote:Sound card is Creative Audigy model SB0090. I try to record at 44kHz and at 48kHz - no difference, but still different than direct signal. [/QUOTE] As Nemesis said, he notices something on oscillogram at 192 kHz rate. It seems the best option is to use sound card with 384 kHz ADC, but it's very high grade of sound cards. Also when I recorded James Bond tracks at 96 kHz, I noticed some strange lines on spectrogram. Later I'll show them. [/QUOTE] Well, I always said that. Even at that dead russian forum "emu-russia", remember that? ######## POST p7503 | TmEE co.(TM) | 2009-01-31 | t386-360.html http://www.fileden.com/files/2008/4/21/1876835/MD11.jpg http://www.fileden.com/files/2008/4/21/1876835/MD12.jpg My MD1... socketed YM2612 and 2 jumpers for region are all what's done... ######## POST p7504 | HardWareMan | 2009-01-31 | t386-360.html [QUOTE] TmEE co.(TM) wrote:http://www.fileden.com/files/2008/4/21/1876835/MD11.jpg http://www.fileden.com/files/2008/4/21/1876835/MD12.jpg My MD1... socketed YM2612 and 2 jumpers for region are all what's done... [/QUOTE] LED wire hinders see wich "VA" your board. Is it "VA4" as mine? ######## POST p7505 | TmEE co.(TM) | 2009-01-31 | t386-360.html Yes, VA4, just like yours. ######## POST p7506 | Snake | 2009-01-31 | t386-360.html [QUOTE] Nemesis wrote:The accumulator combines the output from operators, it does not combine the output from channels. [/QUOTE] That doesn't even make sense. ######## POST p7509 | Chilly Willy | 2009-01-31 | t386-360.html [QUOTE] Snake wrote: [QUOTE] Nemesis wrote:The accumulator combines the output from operators, it does not combine the output from channels. [/QUOTE] That doesn't even make sense. [/QUOTE] If I remember the discussion right, there are six channels with four operators each. Instead of summing all twenty four operators and outputting the result as one value, instead the four operators for each channel are summed and output as one value during one of eight time slots - one time slot for each channel plus one slot for DAC and one for ? didn't catch the last one. Putting out six distinct analog values at different times is NOT going to sound the same as adding six values together and presenting it once. ######## POST p7511 | Snake | 2009-02-01 | t386-360.html [QUOTE] Chilly Willy wrote: [QUOTE] Snake wrote: [QUOTE] Nemesis wrote:The accumulator combines the output from operators, it does not combine the output from channels. [/QUOTE] That doesn't even make sense. [/QUOTE] If I remember the discussion right, there are six channels with four operators each. Instead of summing all twenty four operators and outputting the result as one value, instead the four operators for each channel are summed and output as one value during one of eight time slots - one time slot for each channel plus one slot for DAC and one for ? didn't catch the last one. Putting out six distinct analog values at different times is NOT going to sound the same as adding six values together and presenting it once. [/QUOTE] For gods sake. No. Operators have inputs. They take care of this stuff. If they didn't, there would BE no 'FM'. It. Does. Not. Make. Sense. The 6 outputs go to the accumulator and then to the DAC. Other chips in the YM range don't have an internal DAC. The data that goes out to the DAC has been intercepted and interpreted by others many times. This is already well documented and I can't believe I'm even wasting my time discussing it. In fact, I'm going to stop now. ######## POST p7512 | Nemesis | 2009-02-01 | t386-360.html [QUOTE] Snake wrote: [QUOTE] Nemesis wrote:The accumulator combines the output from operators, it does not combine the output from channels. [/QUOTE] That doesn't even make sense. [/QUOTE] [IMG http://nemesis.hacking-cult.org/MegaDrive/Documentation/operators.png] Algorithms 0, 1, 2, and 3 have 1 carrier. Algorithm 4 has 2. Algorithms 5 and 6 have 3. Algorithm 7 has 4. The accumulator sums the output from all these carriers within a channel, and presents each channel as a single output to the DAC. It also handles the DAC signal for channel 6, and the left/right channel outputs. The accumulator has the job of taking a possible 24 carrier outputs from the operator unit (when each channel is running in algorithm 7), and presenting it to the DAC as 12 distinct output streams, 6 going to the left speaker, and 6 going to the right speaker. Both speaker outputs use multiplexing to interleave the 6 operator output streams directed at that speaker. Sure, the accumulator could have summed each channel and presented it to the DAC as two combined output streams, one to the left speaker, and one to the right speaker. Why didn't they? Maybe they figured they get a better effective output bitrate this way. The audible output sounds pretty much the same, and they didn't have to lose precision by combining the 6 channels into 1 while the output was still in digital form, which would have cut the effective bitrate of each channel. Maybe this was just easier. Hell, I don't know. All I can tell you is, it's obvious the output stream is multiplexed when you hook up any equipment which can sample fast enough to notice it. Anything that's sampling at around 96KHz or less is just going to be combining all those outputs into one during the capture process, so it'll just look like a continuous, combined signal. Your ears are doing the same. My oscilloscope isn't lying though. It's digital, I can post some screenshots if you'd like. ######## POST p7514 | Snake | 2009-02-01 | t386-360.html Ok, one last time. [QUOTE] Nemesis wrote:The accumulator has the job of taking a possible 24 carrier outputs from the operator unit (when each channel is running in algorithm 7), and presenting it to the DAC as 12 distinct output streams, 6 going to the left speaker, and 6 going to the right speaker. [/QUOTE] This isn't the job of the accumulator. Do you have any idea what speed the DAC would have to operate at if if was receiving 12 seperate streams? Remember this thing is SERIAL. Doing things this way makes zero sense at all when an adder is one of the simplest things to implement. [QUOTE] Nemesis wrote:All I can tell you is, it's obvious the output stream is multiplexed when you hook up any equipment which can sample fast enough to notice it. [/QUOTE] Why, because you can see gaps between samples? Yeah, that's how a DAC works. You're looking at multiple samples, not multiple channels. The MAME team discovered, and documented, a very long time ago, that a YM2610 divides the output by two after adding all channels together, because the addition of the extra ADPCM channels would have caused clipping otherwise. They did this by examining the output to the DAC, not by just sampling the output. ######## POST p7515 | Nemesis | 2009-02-01 | t386-360.html *facepalm* http://nemesis.hacking-cult.org/MegaDri ... lexing.asm http://nemesis.hacking-cult.org/MegaDri ... lexing.bin [IMG http://nemesis.hacking-cult.org/MegaDrive/Documentation/multiplexing.png] Do the test yourself. I'm not going to argue this point any longer. ######## POST p7516 | Nemesis | 2009-02-01 | t386-360.html Ehh, for posterity, I'm going to elaborate anyway. The test I just posted uses a single operator from each channel. The phase generator is frozen, with the phase generator outputting a maximum positive value each cycle. The envelope generator for the selected operator in each channel is locked in an infinite decay phase, at an effective internal attenuation value of 0. A different TL value is used for the selected operator in each channel. The overall effect of this is that each channel has a constant output. The attenuation level that each channel sits at is controlled by TL. The screenshot I posted shows the output from the YM2612, sampled directly from the chip with an oscilloscope. If all the channels were summed, and the gaps were gaps between successive samples, every sample would be the same value. As you can see, the levels between each successive sample differ, with each sample clearly representing a different channel with a different attenuation value, as set by TL. Here's another screenshot I've just taken: [IMG http://nemesis.hacking-cult.org/MegaDrive/Documentation/multiplexing2.png] This one shows both the left and right channels, and this time, I've used unique values for TL in each channel, moving from 0x0 to 0xA with a step of 2 from channel 1 to channel 6. Channel 1 is the one mostly visible on the lefthand side. You can see how the channels are actually output out of order. The apparent output order is 1,5,3,2,6,4. Also, according to this, the left and right output streams are actually output at the same time, which I find a little surprising. In terms of the frequency the DAC would have to run at, if we assume the YM2612 does use an embedded YM3016, if it was only doing a single channel, the YM3016 would need to be running at a minimum clock rate of around 5.07MHz, which is above its reported maximum clock input of 5MHz. This does suggest the YM2612 may be using a different DAC. It's also possible it uses two DAC's, one for the left channel, and one for the right channel, and controls them both in parallel. At any rate, it does appear that the YM2612 does its DAC conversion quite differently than the known OPN chips that have an external DAC, like the YM2608. ######## POST p7518 | HardWareMan | 2009-02-01 | t386-360.html Whoa... Channel order is not "123456"? As for multiplexing output, I had already say: 6 timeslots per one channel (left and right). That's is why DAC function replace one of channel (number 6). Nemesis, please make measurement of time (frequency) between start of every timeslot and time of width of one timeslot. ######## POST p7519 | Snake | 2009-02-01 | t386-360.html ARGH pictures too big, lots of scrolling... Ok, your pictures are interesting. I did do similar tests many years ago, using equipment owned by a guy I worked with. I didn't see the same results. Maybe his equipment wasn't good enough. Maybe this was changed in later chips. I don't know now. Still... The operators/channels take care of themselves. The function of the accumulator is, absolutely, to sum the channels. If it's not doing that it actually suggests they REMOVED the accumulator. They did exactly this (and it's documented) in some simpler chips, but the YM2612 sounds much cleaner. [QUOTE] Nemesis wrote:the left and right output streams are actually output at the same time, which I find a little surprising. [/QUOTE] They will be, it's a stereo DAC. [QUOTE] Nemesis wrote:In terms of the frequency the DAC would have to run at, if we assume the YM2612 does use an embedded YM3016, if it was only doing a single channel, the YM3016 would need to be running at a minimum clock rate of around 5.07MHz [/QUOTE] I make it 5.11MHz (and twice that if, as you originally suggested, it did 12 passes) - but it's probably more than that because the chip requires some time to do the actual conversion and settle. [QUOTE] Nemesis wrote:This does suggest the YM2612 may be using a different DAC. [/QUOTE] Yes, I mentioned this before. I knew it was a different DAC, but it seems very odd that they would put a faster DAC in there instead of an accumulator. In any case, I still say this isn't the reason for the distortion we are hearing. Just as well, because any way you try to downsample that it's just going to sound pretty much the same as if they were mixed. Only playing it at the same frequency is going to sound the same. ######## POST p7520 | Nemesis | 2009-02-01 | t386-360.html [QUOTE] Whoa... Channel order is not "123456"? As for multiplexing output, I had already say: 6 timeslots per one channel (left and right). That's is why DAC function replace one of channel (number 6). Nemesis, please make measurement of time (frequency) between start of every timeslot and time of width of one timeslot. [/QUOTE] I can go one better than that: [IMG http://nemesis.hacking-cult.org/MegaDrive/Documentation/multiplexing3.png] This is the analog output from the YM2612 next to the master clock (7.61MHz or there abouts). As you can see, there are 24 master clock cycles between each timeslot. The silence gap is most likely at the start of the timeslot, and represents the period in which the accumulator is sending the serial data stream to the DAC. Looking at the bus communication diagram in the YM3016 datasheet, with 16 bits of data to stream, that's 16 cycles used for the data transfer, plus an extra 2 cycles, one before the start of the stream, and one after the end of the stream, for the data latch input, plus an extra 1 cycle before the final latch input, where the SMP1/2 lines are negated. That gives 19 cycles for the serial communication, which is the observed gap of silence between each output, leaving only 5 cycles for the output to remain asserted across a full clock cycle, which is exactly what we see on the image above. Tying this back into the clock rates used in the YM2612, the DAC has one timeslot per channel, or 7610000/6/4=317083, where 6 is the fm prescaler, and 4 is the number of operators per channel. The actual DAC runs at the full input clock rate. Oh, and based on the datasheet for the YM3016, it looks like both channels can be programmed at once on that device (IE, the DAC can latch a single output stream and send it to both channels), and seeing as the communication between the accumulator and the DAC seems to match the communication pattern of the YM3016, it seems the embedded DAC is most likely a YM3016 derivitive. Since this embedded DAC is obviously running at 7.61MHz however, it must support a higher clock input. The YM3016 was only rated for a max of 6MHz (not 5MHz like I said earlier, that was the YM3015. Perhaps this would make the DAC model a YM3018?). EDIT: Some googling seems to confirm that the YM3018 does exist, but there seems to be absolutely no information on it. ######## POST p7521 | Snake | 2009-02-01 | t386-360.html [QUOTE] Nemesis wrote:it seems the embedded DAC is most likely a YM3016 derivitive. [/QUOTE] Well, as I mentioned before, I read somewhere (fucking wish I could remember where) that it's only 9 bit. That would seem to make more sense now, wouldn't it? No point in putting a full 16-bit capable DAC in there if it's not going to get used. That channel order is fucking strange, though. ######## POST p7522 | HardWareMan | 2009-02-01 | t386-360.html Whoa! This is a very accurate data. So, one timeslot takes 24 of VCLK. So, all 6 channel takes VCLK/24/6. In case of VCLK=7.61MHz it will be 7600KHz/24/6=52kHz... Mmmm... That is more than twice faster, than I thought... ######## POST p7523 | Nemesis | 2009-02-01 | t386-375.html [QUOTE] Well, as I mentioned before, I read somewhere (fucking wish I could remember where) that it's only 9 bit. That would seem to make more sense now, wouldn't it? No point in putting anything better in there if it's not going to get used. [/QUOTE] Anything's possible. I must admit, I thought the YM2612 wasn't doing too much differently in terms of the DAC, despite the fact this one is embedded. Guess I was wrong. Different precision on the input is certainly possible. The circuitry of the DAC itself could also be very different, and there could well be errors in it as you suspect, or they might have taken some shortcuts to reduce complexity or power requirements. It's a fair bet this DAC was built, or at the very least customized, for the YM2612. [QUOTE] That channel order is fucking strange, though. [/QUOTE] Yeah, I don't get that either. ######## POST p7524 | Snake | 2009-02-01 | t386-375.html It might be interesting to try this on an MD2 and see if theres any differences. Not that it probably makes much difference in emulation, but still... ######## POST p7525 | Nemesis | 2009-02-01 | t386-375.html I haven't modded a MD2 to sample direct from the YM2612 output. Let me grab one off the stack and see what I can rig up. ######## POST p7526 | Snake | 2009-02-01 | t386-375.html Oh, and incase it's of interest - the YM2413 is the chip that has no accumulator... and also an embedded 9 bit DAC. Isn't that interesting. [QUOTE] Nemesis wrote:Let me grab one off the stack [/QUOTE] Heh, how many have you got? ######## POST p7527 | Nemesis | 2009-02-01 | t386-375.html [QUOTE] Snake wrote:Oh, and incase it's of interest - the YM2413 is the chip that has no accumulator... and also an embedded 9 bit DAC. Isn't that interesting. [/QUOTE] Hmm, maybe I can get my hands on one a run some tests on that. Comparing the two might help answer some questions. Hell, maybe I can put one in the Mega Drive in place of the YM2612. [QUOTE] Snake wrote: [QUOTE] Nemesis wrote:Let me grab one off the stack [/QUOTE] Heh, how many have you got? [/QUOTE] I honestly don't know. It seems like every time I move something or look in a box I haven't opened in awhile, I find another one hiding. O_o I bought too much Mega Drive stuff on ebay. ######## POST p7528 | Snake | 2009-02-01 | t386-375.html [QUOTE] Nemesis wrote:Hmm, maybe I can get my hands on one a run some tests on that. Comparing the two might help answer some questions. Hell, maybe I can put one in the Mega Drive in place of the YM2612. [/QUOTE] Doubtful, the chip is very different. But it's the chip used in the Japanese SMS. Go on, now tell me you've already got one [IMG ./images/smilies/icon_wink.gif] Just done some googling and found: [QUOTE] - OPLL: Budget version of the OPL2. It's quite cut down, and can only have 1 fm patch at the same time - the other sounds must come from a ROM that has 15 different FM sounds. Also lacks an accumulator (channels are summed together with an analog filter instead). [/QUOTE] from http://www.soundshock.se/phpBB2/viewtop ... f8d5c#2280 OPLL=YM2413. ######## POST p7529 | TmEE co.(TM) | 2009-02-01 | t386-375.html YM2413 will not start working in place of YM2612 unless you make code exactly for the YM2413... the pinout is very different aswell. I'm looking forward to seeing some more info about MD2 sound [IMG ./images/smilies/icon_smile.gif] And by judging from aliasing noise, things do sound like the DAC is 9 or 10 bits... ######## POST p7530 | Snake | 2009-02-01 | t386-375.html While we're waiting for Nemesis to do the tests, thought I'd post my thoughts on the distortion. If you've ever looked at the waves produced, it seems as though one side performs exactly as it should, and hits silence when it should. But the other side doesn't, producing a non-sinewave. it takes much longer to get to zero, and it distorts on the way there. It's been a long time since I've done any tests on this at all (5 years probably), but I've been thinking about it a fair bit recently. I *think* it's the negative side that has the problem (I'm sure somebody here can confirm), and if so, it would seem to indicate the chip handles negative samples incorrectly, OR that the values are scaled before hitting the DAC, and there is a problem with scaling negative values. The standard yamaha DACs, as far as I remember, don't use 2s compliment, but I'm pretty sure the operators do, so theres another possible conversion that could go wrong. It's also possible it's just a problem with the DAC itself, but that doesn't seem as likely, because the error is actually quite a large one. With a decent scope and a bit of time, it should be possible to figure out exactly what's going on here. I have neither anymore, nor the capacity to run test code anymore, or I'd have done it already [IMG ./images/smilies/icon_wink.gif] ######## POST p7531 | HardWareMan | 2009-02-01 | t386-375.html Snake, you talking about "ladder" effect? Wich present in every channel separatly. ######## POST p7532 | Snake | 2009-02-01 | t386-375.html Yes, indeed, the effect you refer to as the "ladder effect". It's more than that, though, if you look at samples. ######## POST p7537 | Nemesis | 2009-02-01 | t386-375.html Ok, now that the final between Federer and Nadal is over (dammit!), here's some readings from an MD2, board PC BD MD2 VA1.8 PAL, with an embedded YM2612 in the 315-5660: [IMG http://nemesis.hacking-cult.org/MegaDrive/Documentation/multiplexingmd2-1.png] [IMG http://nemesis.hacking-cult.org/MegaDrive/Documentation/multiplexingmd2-2.png] Very different to the MD1 with the "real" YM2612. The output is still multiplexed, and the strange channel order from the output is the same, but that's about it. Clearly this is a totally different DAC. ######## POST p7538 | HardWareMan | 2009-02-01 | t386-375.html Whoa... For complete picture, you should post recording from YM2612 clones: TA-07 and PCS-95. Mmm... Square waveform consist from many harmonic frequences. To infinite high frequences. So, result output can be more complex, specially at high frequences. But saw waveform consist much less of high frequences, than square frequences. So, result output can be much clearer from harmonic frequences. ######## POST p7541 | AamirM | 2009-02-01 | t386-375.html [QUOTE] Nemesis wrote: [QUOTE] AamirM wrote:Spiderman Separation Anxiety. There is a problem in the intro, on channel 3 and 6. [/QUOTE] Ahh yes, I think I know the instruments you're talking about. I looked into that a bit. Little known fact: Even when the LFO is disabled, amplitude (and frequency?) modulation are still applied, but the LFO waveform itself is locked. In the problem track on Spiderman, the instruments on channels 3 and 6 have AM sensitivity set to max, with amplitude modulation enabled on all operators. Whatever value the LFO is frozen at, it applies a large amount of attenuation to the instrument, making it much softer. Phase modulation may also be affecting the pitch. I haven't done full tests on this behaviour, as I haven't started work on the LFO yet. [/QUOTE] Yeah, that seems to be it. Shame on me for not noticing it myself. [IMG ./images/smilies/icon_redface.gif] Btw, I would like to thank you again for all your work. [IMG ./images/smilies/icon_wink.gif] ######## POST p7548 | Snake | 2009-02-01 | t386-375.html I had a feeling this would look very different. From the pics it seems the MD2 DAC takes a lot longer to do the conversion, but isn't serial, which allows it the time it needs. The original YM2612 probably uses the exact same DAC as the YM2413. Thinking about this some more, the much simpler straight 9 bit DAC and no accumulator will be much cheaper, because you can get away with a mono DAC. The left/right output will always be identical, so you can simply route the mono output to left/right or both. ######## POST p7551 | Shiru | 2009-02-02 | t386-375.html One interesting thing about YM2413: it has not single mono output, but two separate outputs for melodic and drum channels. ######## POST p7553 | Snake | 2009-02-02 | t386-390.html [QUOTE] Shiru wrote:One interesting thing about YM2413: it has not single mono output, but two separate outputs for melodic and drum channels. [/QUOTE] Indeed. There's no logical reason for that, though, the 'drum' channels, if enabled, take over some of the other channels. I think they just did this so you can choose to mix them at different volumes. What I find even stranger is that some chips have an internal DAC for their PSG-type waves, but not for the FM stuff. You'd think it would have been easier to just mix the PSG stuff with the FM stuff. ######## POST p7554 | Shiru | 2009-02-02 | t386-390.html You must learn how those built-in PSG works (AY-3-8910/YM2149), it's much harder to mix than use as-is. ######## POST p7555 | Snake | 2009-02-02 | t386-390.html [QUOTE] Shiru wrote:You must learn how those built-in PSG works (AY-3-8910/YM2149), it's much harder to mix than use as-is. [/QUOTE] Well, what I meant was, digital signal comes out of PSG, goes through DAC, and to output pin. Why not send that digital signal out the same way as the other output? Or why not use a DAC that can handle both outputs? Of course the answer is probably 'its cheaper', but then if you've got to use an external DAC anyway... ######## POST p7556 | Shiru | 2009-02-02 | t386-390.html PSG uses three separate 4-bit DAC's (5-bit in Yamaha's version), one per channel. They are apply volume or envelope to the output. To get digital output which can be mixed with FM output you'll need adders instead of those DAC's. ######## POST p7558 | Snake | 2009-02-02 | t386-390.html Well, yes, but an adder that could handle exactly that is already there. Then again, volume levelling would be an issue again. I guess it was just easier to basically throw a full YM2149 in there. [QUOTE] Shiru wrote:4-bit DAC's (5-bit in Yamaha's version) [/QUOTE] Going way off topic here, but do you have info to back that up? As far as I remember, they're both 4 bit, except the Yamaha version is actually accurate, and the AY version very much isn't [IMG ./images/smilies/icon_smile.gif] In either case I've emulated both of these and compared the outputs with original chips. [QUOTE] HardWareMan wrote:Mmm... Square waveform consist from many harmonic frequences. To infinite high frequences. So, result output can be more complex, specially at high frequences. But saw waveform consist much less of high frequences, than square frequences. So, result output can be much clearer from harmonic frequences. [/QUOTE] Well, the filtering effectively downsamples the whole thing to around 40KHz, so it *shouldn't* sound any different (the MD2 may sound a bit louder, though). The filters are far from perfect, though. ######## POST p7566 | Shiru | 2009-02-02 | t386-390.html [QUOTE] Snake wrote:Going way off topic here, but do you have info to back that up? As far as I remember, they're both 4 bit, except the Yamaha version is actually accurate, and the AY version very much isn't :) In either case I've emulated both of these and compared the outputs with original chips. [/QUOTE] Well, try to read at least first page of the YM2149F datasheet. This is officially documented fact, and is confirmed long ago by few independent enthusiasts who did measurements of the real chips, and implemented in many emulators. ######## POST p7567 | TmEE co.(TM) | 2009-02-02 | t386-390.html http://www.epicgaming.us/tiido/MD_Sine.rar Can this be any help ? There's recordings of the sine of single operator of MD2 and MD1, going from TL0 to higher values. MD1 has a shift in each half period...... ######## POST p7575 | Snake | 2009-02-02 | t386-390.html [QUOTE] Shiru wrote:Well, try to read at least first page of the YM2149F datasheet. [/QUOTE] Ah, ok, I'm probably just misremembering, then. [edit] - doh - yeah - without even looking I remember now it IS twice the resolution. I'm probably thinking of some other chips. Done way too much of this stuff [IMG ./images/smilies/icon_wink.gif] [QUOTE] TmEE co.(TM) wrote:MD1 has a shift in each half period...... [/QUOTE] That's probably relevant, yeah. What's odd is that I have some recordings from an MD1 - they were taken at final output (I was trying to measure the filter effects at the time) and they don't show this at all. Which is both odd and annoying. ######## POST p7578 | Stef | 2009-02-02 | t386-390.html [QUOTE] TmEE co.(TM) wrote:http://www.epicgaming.us/tiido/MD_Sine.rar Can this be any help ? There's recordings of the sine of single operator of MD2 and MD1, going from TL0 to higher values. MD1 has a shift in each half period...... [/QUOTE] The MD2 sin curve is really... weird ! Looks like a bad approximation of real one, the MD1 does a lot better here. ######## POST p7579 | TmEE co.(TM) | 2009-02-02 | t386-390.html it looks weird because of the low TL value... higher values show good sine... ######## POST p7581 | HardWareMan | 2009-02-03 | t386-390.html [QUOTE] TmEE co.(TM) wrote:it looks weird because of the low TL value... higher values show good sine... [/QUOTE] I don't see a good sine there. ######## POST p7582 | Jorge Nuno | 2009-02-03 | t386-390.html A FFT would show the harmonic distortion better [IMG ./images/smilies/icon_cool.gif] ######## POST p7583 | Snake | 2009-02-03 | t386-390.html One thing I did notice about the MD2 many years ago, is that when it goes from playing silence, to playing a loud tone, it seems to be overdriven for a brief period. But that may have more to do with the mixer, or may even have just been my console. But yes, I always thought the sinewave was a bit off too. ######## POST p7585 | Richter X | 2009-02-03 | t386-390.html There's something that's still bothering me. I keep playing "Good Job, Headdy" from Dynamite Headdy using TmEE's recording of it, The OST's recording of it, and foo_gep with the newest 2612 core. In foo_gep the pitch of the orchestra hit at the end has a higher pitch than it should sound. Anyone care to look into it? ######## POST p7590 | TmEE co.(TM) | 2009-02-03 | t386-390.html Fusion had a small bug which caused PCM to be played faster, and this affects all VGMs... the VGM recording I did of that tune SHOULD sound like Fusion does... I should do another recording using real game... ######## POST p7605 | AamirM | 2009-02-03 | t386-405.html Before I forget, another "test case" for your SSG-EG implementation would be the Water Diving practice mode in Barcelona Olympics. When you dive into the water, the splash sound isn't emulated correctly by any emulator. And yeah, it uses SSG-EG there. Nemesis, I think that your suspicion that SSG-EG switches between 4x and 6x multiplication is true. That would be one thing to test for sure. ######## POST p7623 | Snake | 2009-02-04 | t386-405.html [QUOTE] AamirM wrote:Nemesis, I think that your suspicion that SSG-EG switches between 4x and 6x multiplication is true. That would be one thing to test for sure. [/QUOTE] Hmm, that sounds completely illogical, unless it does so because of a bug. It's more likely it's down to one of the weird cases that Nemesis has since discovered, so he probably has the answer already. I'm surprised so many games use this at all given the complete lack of documentation on it at the time. ######## POST p7650 | AamirM | 2009-02-04 | t386-405.html [QUOTE] Hmm, that sounds completely illogical, unless it does so because of a bug. [/QUOTE] Since you said yourself that SSG-EG is strangest part of YM2612, I wouldn't be really surprised if it really switched between 4x and 6x. EDIT: I forgot to mention, when I was testing this in Regen last time, I remember that splash sound got fixed if multiplication factor was set to 4. Go figure. [QUOTE] I'm surprised so many games use this at all given the complete lack of documentation on it at the time. [/QUOTE] Me too. ######## POST p7654 | Shiru | 2009-02-04 | t386-405.html [QUOTE] Snake wrote:I'm surprised so many games use this at all given the complete lack of documentation on it at the time. [/QUOTE] Documentation isn't needed at all to make weird patches. All that needed is very simple program which allows user to change all the parameters of the patch and test it on real chip (console). So patch designer simply edit the parameters until he get interesting sound, and he is not need to understand how this actually works. ######## POST p7672 | Nemesis | 2009-02-04 | t386-405.html [QUOTE] [QUOTE] Hmm, maybe I can get my hands on one a run some tests on that. Comparing the two might help answer some questions. Hell, maybe I can put one in the Mega Drive in place of the YM2612. [/QUOTE] Doubtful, the chip is very different. But it's the chip used in the Japanese SMS. Go on, now tell me you've already got one [IMG ./images/smilies/icon_wink.gif] [/QUOTE] Not that one I'm afraid. I might try and pick one up. [QUOTE] Whoa... For complete picture, you should post recording from YM2612 clones: TA-07 and PCS-95. [/QUOTE] Hmm, I don't actually know that I have any Mega Drive systems that use a clone chip. I haven't opened all my model 1 units however. I'll hunt around and see if I can locate one. What kind of systems did they appear in? Did they appear in normal European Mega Drive units, or should I be looking at the asian systems? [QUOTE] Before I forget, another "test case" for your SSG-EG implementation would be the Water Diving practice mode in Barcelona Olympics. When you dive into the water, the splash sound isn't emulated correctly by any emulator. And yeah, it uses SSG-EG there. [/QUOTE] Yep, this sound relies heavily on SSG-EG with an attack phase. Actually, the only real tricky case that needs to be emulated here is pattern 0xF with attack. I'll be posting all the info necessary to emulate this. This sound does play correctly in my emulator. [QUOTE] Nemesis, I think that your suspicion that SSG-EG switches between 4x and 6x multiplication is true. That would be one thing to test for sure. [/QUOTE] Well the 6x figure I gave is completely wrong anyway, but what I said was, I suspect that toggling SSG-EG on or off during the release phase would immediately switch between the normal decay sequence, and the accelerated SSG-EG decay sequence, IE, the SSG-EG enable bit is checked each update cycle to determine whether the attenuation increment value is multiplied. This'll all be covered when I post my updated info. ######## POST p7673 | Nemesis | 2009-02-04 | t386-405.html I might share a little quirk I discovered a few days ago, while I was working through a list of random tests unrelated to the envelope generator. I was running a test to check whether parts 1 and 2 had a separate address register, IE, whether you could write one address to $A00000 and another to $A00002, then write to each data port, and have the two writes go to two different register addresses in each part. What I found was that not only do parts 1 and 2 not have a separate address register, they don't even have a separate data port. It turns out that writing to an address register stores both the written address, and the part number of the address register you wrote to. You can then write to either the data port at $A00001, or the data port at $A00003, and the write will go to the register number you wrote, within the part of the address register you wrote to. This means you can, for example, write an address to $A00000, then write the data to $A00003, and the data will in fact be written to the part 1 register block, not the part 2 register block. The simpler implementation would seem to be only storing the 8-bit address data that was written, and use the data port that received the write to determine which part to write to, but it isn't implemented this way. Writing to the address register stores 9 bits of data, indicating both the target register address, and the part number. I don't think any emulator does this correctly right now. ######## POST p7674 | TmEE co.(TM) | 2009-02-04 | t386-405.html This gives me some ideas [IMG ./images/smilies/icon_biggrin.gif] Great find [IMG ./images/smilies/icon_biggrin.gif] ######## POST p7680 | notaz | 2009-02-05 | t386-405.html Nice find, time to do some quick patching [IMG ./images/smilies/icon_smile.gif] ######## POST p7696 | Snake | 2009-02-06 | t386-405.html [QUOTE] Nemesis wrote:Well the 6x figure I gave is completely wrong anyway, but what I said was, I suspect that toggling SSG-EG on or off during the release phase would immediately switch between the normal decay sequence, and the accelerated SSG-EG decay sequence, IE, the SSG-EG enable bit is checked each update cycle to determine whether the attenuation increment value is multiplied. This'll all be covered when I post my updated info. [/QUOTE] Ah, that makes more sense. It's been a while but if I remember correctly, most SSG-EG register writes while keyed on completely break things. I fully intended to do more tests here, but life sucks. [QUOTE] Nemesis wrote:What I found was that not only do parts 1 and 2 not have a separate address register, they don't even have a separate data port [/QUOTE] Heh. I knew the address register thing, but I never tried the data port thing. Did you test this on MD1 and MD2? ######## POST p7704 | HardWareMan | 2009-02-07 | t386-405.html You saying about YM2612 registers (address/data potrs)? Is it should be $A04000..$A04003? ######## POST p7719 | Snake | 2009-02-08 | t386-405.html [QUOTE] HardWareMan wrote:You saying about YM2612 registers (address/data potrs)? Is it should be $A04000..$A04003? [/QUOTE] Yes, that's what he's talking about. [QUOTE] TmEE wrote:This gives me some ideas [/QUOTE] You're evil [IMG ./images/smilies/icon_twisted.gif] Seriously, though, I'm not seeing any benefits of making use of this, and I'd suggest you don't. As is probably well known, reading any of the ports will give you the YM status - but there was a 32X bulletin that warned you not to do that because it causes weird bus timing problems. In short, don't do naughty things [IMG ./images/smilies/icon_wink.gif] ######## POST p7733 | Nemesis | 2009-02-09 | t386-405.html [QUOTE] Snake wrote: [QUOTE] Nemesis wrote:What I found was that not only do parts 1 and 2 not have a separate address register, they don't even have a separate data port [/QUOTE] Heh. I knew the address register thing, but I never tried the data port thing. Did you test this on MD1 and MD2? [/QUOTE] I have now. The behaviour is the same on both. ######## POST p7967 | Nemesis | 2009-02-22 | t386-405.html Ok, here's another batch of info. When I conducted my previous tests on the envelope generator, I had to extrapolate the output from the envelope generator based on the analog output from the chip. This severely limited the accuracy and precision of the tests I could perform. Increased understanding of the phase generator, operator unit, and the test register, now allows me to obtain pure, digital samples of the output data from the envelope generator. With this new information, I decided a complete re-test of the envelope generator was required, as several clear errors had been identified, and there was a lot more testing I still wanted to carry out which I was unable to perform with sufficient accuracy before. I've now done a thorough re-test of the envelope generator as a whole, and as a result, I've got a lot of corrections for the information I provided before, as well as bunch of new information to share. This post is going to cover details of the envelope generator, but unlike the information I posted previously, this is mainly going to be a list of corrections and additions to previous information I have provided. I am going to break it into points arbitrarily arranged and numbered, and it is going to primarily focus on what is different to my previous description of the envelope generator. Unless I specifically amend or correct a piece of information I provided in my previous description, the previous information still stands. The previous description I gave of the envelope generator is at the following location: viewtopic.php?p=5716#5716 General info: 1. Envelope Generator update clock rate I've posted this correction previously, but I'm going to mention it again briefly here. I previously stated that the envelope generator was updated according to the following clock rate: "EG Clock = External Clock / 351" Or that "The ratio of the frequency output to the envelope generator clock is 1:2.4375". This information was incorrect. In fact, the envelope generator is updated once every 3 fm update cycles, which was the existing behaviour in the MAME core. Refer to the following post for the information I previously gave on this correction: viewtopic.php?p=6224#6224 2. Envelope generator output inversion I previously stated that the envelope generator had an output inversion flag which was used by both SSG-EG mode and the attack phase. This is incorrect. SSG-EG has an output inversion flag, but it is not shared by the attack phase. The attack phase does not use output inversion, nor does any function of the envelope generator outside of SSG-EG mode. 3. Calculating the attack curve The previously given information for calculating the attack curve stated that while the attack phase was active, the output inversion bit was set, and the following formula was used to advance the attack curve: [CODE] operator.attenuation += attenuationIncrement * (((1024 - operator.attenuation) / 16) + 1) [/CODE] This is incorrect on both points. The attack phase does not use output inversion, and the provided update calculation is incorrect. The correct update formula is as follows: [CODE] newAttenuation += (~newAttenuation * attenuationIncrement) >> 4 [/CODE] This is the same as the existing update calculation used in the MAME core. 4. Restart of phase generator on key-on I forgot to mention in my original post that when key-on occurs, the internal phase counter in the phase generator is reset to 0. This of course also includes key-on events triggered by CSM mode. The phase counter is also reset in SSG-EG mode at the beginning of each repetition of the waveform in cases where both the HLD and ALT bits are unset, but the implementation is a little different than you might expect. The SSG-EG section will cover this fully. 5. When register changes are applied I didn't provide much information on this before, because I hadn't performed many tests on it before. I did state previously that the rate value for the current phase of the envelope generator was calculated and stored when entering each phase of the envelope, and that updates within each envelope phase were based on this stored value. This is incorrect. The rate value is calculated each update cycle of the envelope generator. As such, changes to the various rate parameters for an operator, as well as changes to the rate key-scale value, can cause an immediate change in the effective rate for the current phase of the ADSR envelope. Regarding other register values, changes to all other parameters for an operator or channel, including TL, Detune, Multiple, Key Scale, AMS, PMS, Left/Right, Block, Fnum, etc, also all take effect immediately. One important note however relates to SL, the sustain level. Changes to SL do take effect immediately, including during the decay phase, but note that once the decay phase of the envelope reaches SL, the transition from decay to sustain is a one-way operation. If the ADSR envelope was in the decay phase, and the attenuation level reached SL, the ADSR envelope would switch to the sustain phase. If you were to then modify SL to move it past the current attenuation level (eg, so the operator was now in the sustain phase above SL), the operator does NOT re-enter the decay phase. All emulators probably do this correctly anyway, but it was possible that the decision of whether the operator was in the decay phase or the sustain phase was made each update cycle based on the relative position of the current attenuation value to the sustain level. This is not the case. Once the transition is made from the decay phase to the sustain phase, changes to SL will not have any effect. Note that changes to the SSG-EG register also take effect immediately, but there's a lot to cover about this behaviour, which will be addressed separately in the SSG-EG section. 6. Clamping of attenuation values when changing states I posted a comment somewhere around here about the possibility of the current attenuation level being "clamped" to SL when moving from the decay phase to the sustain phase. I suspected that if, for example, SL was 0x200, and the decay phase was to cause the current attenuation value to jump from, say, 0x1FC to 0x204, the attenuation value would be clamped to 0x200, preventing the attenuation level from moving past SL during the decay phase. This is incorrect, and the premise itself is also incorrect. The sustain level can only be set in 16 increments of 0x20, from 0x0 to 0x1E0, with the special case that when it is set to max, it is forced to the maximum attenuation level (0x3FF). The decay phase always begins from an attenuation value of 0, since the attack phase does not terminate until this value is reached. Without SSG-EG mode active, the largest increment value which can be applied to the attenuation value in a single update cycle is 8. Since all the levels SL can reach are multiples of 8, without making changes to the effective rate of the decay phase during the decay sequence, the attenuation level would always finish perfectly on SL anyway, without SSG-EG active. With SSG-EG, the increment value is multiplied, however the 6x figure I gave previously is incorrect, as will be elaborated on below. The correct multiplier is 4x. With a 4x multiplier, the maximum increment value for a single step in the decay phase is 8*4=0x20, which is the same interval as the minimum step we can specify with SL, so again, unless changes are made to the effective rate of the decay phase during decay, we will always finish perfectly on SL, so no clamping is required. When we do change the decay rate during the decay phase, we have confirmed that the decay phase can be forced to "skip over" SL in both normal and SSG-EG modes. In the case where the decay phase moves past SL, the sustain phase begins on the next cycle, but the attenuation value is not clamped to SL. 7. When key on/off events are applied In my implementation, I thought changes to the key-on state were applied according to the envelope generator update cycle, so only once every 3 fm update cycles would a key-on state change take effect. This is incorrect. In fact, key-on changes are processed every fm update cycle. This becomes important when CSM mode is in use, since timer A overflows every fm update cycle. 8. Attack phase with rate values 62 and 63 I was vague on this point before. I've got a bit more info to add now. When an attack phase has a rate value greater than or equal to 62 (0x3E or 0x3F), it is treated differently. With no special case handling, rate values of 62 and 63 would be the same as rate values 60 and 61, namely, there would be an 8x increment value applied to the attack curve update process, and from a starting attenuation level of 0x3FF, it would take 10 update steps to achieve minimum attenuation. In fact, for the attack phase, there is special case handling to force the attenuation level directly to 0 when the attack phase is entered, if the calculated rate value is 62 or 63. Note that this happens immediately when the key-on event is processed, so it doesn't even have to wait for the next full envelope generator update cycle. This behaviour also occurs when the SSG-EG envelope loops, so it isn't just actual key-on events which trigger this behaviour. Since this special case handling appears to be triggered when the attack phase is entered, there's an interesting quirk that occurs when you change the attack rate during the attack phase. If you begin an attack phase with a slow rate value (to give you enough time to change it again before it finishes), then change the attack rate settings to switch to an effective rate value of 62 or 63 during the attack phase, the attack phase will NOT finish in the next update cycle. In fact, it won't advance at all. Switching to an effective rate value of 62 or 63 after the attack phase has already begun causes the attack phase to stall. The attenuation value will be locked at its current value, and will no longer advance until the attack rate is modified again to something less than 62, at which time, it will resume advancing from its current position, or until key-off occurs. I don't think MAME emulates this currently. I haven't found a neat way to emulate all this behaviour. I currently calculate the effective attack rate immediately when switching to the attack phase, and if the rate is greater than or equal to 62, I force the attenuation level directly to 0. I also have an exclusion in the normal envelope generator update cycle when updating the attack curve. If the attack rate is greater than or equal to 62, I don't advance the attack curve. This emulates the behaviour of the YM2612, but it probably isn't emulating the exact way this special case behaviour is implemented. I'm open to any suggestions about a neater way to emulate this. SSG-EG corrections: The information I gave previously about SSG-EG mode is mostly correct, but there are a lot of critical implementation details which I didn't have at the time. These details are vital in order to emulate the multitude of quirks which can arise with SSG-EG mode when using an attack rate less than 0x1F, or when making changes to various register values, in particular the SSG-EG mode flags, during output. I'm going to cover corrections for clear errors in my previous description of SSG-EG in this section, and cover new information regarding SSG-EG in the following section. 1. SSG-EG decay phase update formula I previously stated that during SSG-EG mode, for the decay, sustain, and release phases, the envelope generator attenuation value was updated as follows: [CODE] operator.attenuation += 6 * attenuationIncrement [/CODE] This is incorrect. The increment value is in fact only multiplied by a factor of 4 during SSG-EG mode, making the correct update formula the following: [CODE] operator.attenuation += 4 * attenuationIncrement [/CODE] This was the existing update behaviour in MAME, with the exception that MAME did not apply any multiplication factor in the release phase under SSG-EG mode. While MAME had the multiplication factor correct, this 4x multiplication factor should indeed be applied during the release phase under SSG-EG mode, as per the information I gave previously. 2. Attenuation limits under sustain, decay, and release When I wrote my previous information, I believed that the decay, sustain, and release phases under SSG-EG decayed the entire way to the maximum attenuation level of 0x3FF. In particular, I believed that an SSG-EG pattern without the hold bit set would loop only when the attenuation level had progressed the entire length from 0x0 to 0x3FF. This is actually not the case. When the internal attenuation level reaches 0x200 under SSG-EG mode, a variety of special operations are performed, which will be elaborated on later. 3. Output inversion I mentioned previously that SSG-EG "inverts" the attenuation output, but I really didn't provide any information on exactly how the non-inverted data was converted to the inverted data, because I wasn't able to sample the digital output. The attenuation data is inverted on the output from the envelope generator through the following operation: [CODE] attenuation = 0x200 - attenuation; attenuation &= 0x3FF; [/CODE] Basically, it's a full, proper two's compliment inversion. The inversion is actually "centered" at 0x200. MAME does the output inversion by performing a simple XOR operation with 0x1FF, which is incorrect. This produces an output which is off by 1. The result needs to be adjusted for normal two's compliment math. 0x001 should invert to 0x1FF, 0x110 should invert to 0xF0, 0x250 should invert to 0x3B0, etc. SSG-EG new info: SSG-EG is dangerous to emulate. It's dangerous because many of its functions could be implemented in a dozen different ways to achieve the intended result. Consider the implementation of output inversion. Based on the information I previously gave describing how the inverted output works, if you were to think about emulating it, you would probably create a boolean flag, to indicate whether the output is currently inverted or not. In the case of the attack bit, you would probably use the attack bit to determine the initial state of this inversion flag, so when key-on occurs, you would load the value of the attack bit into the inversion flag. It seems simple and logical, it's what I did at first, and it's what MAME currently does. It's also wrong. Similar pitfalls exist with things like hold mode and the alternate bit. Initially it may appear it doesn't matter how the YM2612 hardware performs a particular task compared with how it is emulated, as long as the two implementations produce an identical result. This is true, but unfortunately, there are a lot of ways to abuse SSG-EG mode. When you start changing things on the fly, and pushing SSG-EG into corners it's not supposed to deal with, you can expose lots of little quirks. These aren't bugs, simply areas of undefined behaviour where the result is not specified, because "you're not supposed to do that". These quirks betray information about how SSG-EG is really implemented. If your implementation differs from the YM2612 implementation, your SSG-EG implementation will not function correctly when pushing into these undefined areas. Unfortunately, simply using an attack rate less than 0x1F runs into a multitude of quirks, and we now know of several games which do in fact make use of this (Beavis & Butthead chainsaw sound effect, Barcelona Olympics water diving splash sound), so it's now important to emulate all these quirks, not just as an academic exercise, but in order to get correct sound in retail games. The good news is, after a solid month of testing involving hundreds of tests on dozens of strange pieces of aberrant behaviour, I have managed to derive an accurate implementation of SSG-EG which fully implements all the quirks of the real hardware. This isn't a hackaround, it makes perfect sense, and the implementation is fairly straightforward in the end, but it is almost completely different to what I started with. MAME will also require its SSG-EG implementation to be rewritten from scratch, and significant modifications to the envelope generator implementation in general, in order to incorporate these changes, so it should keep someone busy. [IMG ./images/smilies/icon_smile.gif] 1. Where SSG-EG is updated: Envelope generator output cycle vs envelope generator update cycle As previously mentioned, the envelope generator is updated once for every 3 times the phase generator is updated, and once for every 3 times the output of each operator is calculated. While the envelope generator may only update once every 3 FM output cycles however, its output is used every cycle. This means that internally, the envelope generator has a separate output process which runs at the same clock rate as the operator unit, to feed the current output for each operator to the operator unit as it is required. As it turns out, this output cycle is not an idle process. In fact, this output cycle is where virtually all the SSG-EG processing steps are implemented. Accurate emulation of SSG-EG mode requires that there be a series of active steps performed each time the output of the envelope generator is fed into the operator unit. More than this, there is an order to the way the SSG-EG update steps during this output cycle interact with the normal envelope generator update cycle. For one of every three output samples, the envelope generator update cycle will occur along with the envelope generator update cycle. When that happens, the operations are performed in the following order: 1. The SSG-EG output cycle update steps are performed 2. The envelope generator update cycle runs 3. The output from the envelope generator is calculated So, first the SSG-EG update steps occur, followed by the envelope generator update cycle, followed by the output calculation from the envelope generator, which includes applying SSG-EG output inversion if it is active. Where an envelope generator update cycle doesn't occur on the current output cycle, only steps 1 and 3 occur. This order of operations is a relatively minor point, but it does have a measurable effect. In the case where the attenuation level reaches 0x200 in SSG-EG mode, a single output sample is generated at this attenuation level before the envelope loops back to the attack phase. 2. How SSG-EG is updated I've already explained the basic theory and principles of SSG-EG, and they pretty well cover what SSG-EG mode does, but what they don't cover is exactly how the YM2612 implements them. I think the only way I can adequately explain the implementation of SSG-EG is by providing some sourcecode. This is taken directly from my core, so it's going to have some extra fluff which is specific to my emulator, but it's commented to the point of excess, so it should be easy enough to follow. I've taken great care to try and explain why each step of the SSG-EG update process is implemented the way it is, and what test cases on the hardware validate each step. This is an example of the steps that need to be carried out for SSG-EG on each envelope generator output cycle, IE, each time the output from the envelope generator is used by the operator unit: [CODE] //If SSG-EG is enabled, and the current internal attenuation level of the //envelope generator is greater than or equal to 0x200, we need to run some //special SSG-EG update steps. Note that hardware tests have proven that //these operations occur each time the output of the envelope generator is //calculated (IE, each sample), not just each time the envelope generator //is updated. The output inversion and phase counter reset steps in particular //are easily measurable, and have been shown to occur each sample. Note that //hardware tests have also shown that this update process occurs before the //normal envelope generator update steps in the case where both run on the //same cycle. This can allow a single sample to be output at an attenuation //level of 0x200 before these update steps are applied. OperatorData* state = &operatorData[channelNo][operatorNo]; if(GetSSGEnabled(channelNo, operatorNo, accessTarget) //SSG-EG mode is enabled && (state->attenuation >= 0x200)) //The internal attenuation value has reached the magic 0x200 threshold { if(GetSSGAlternate(channelNo, operatorNo, accessTarget) //SSG-EG is set to an alternating pattern && (!GetSSGHold(channelNo, operatorNo, accessTarget) || !state->ssgOutputInverted)) //Hold mode is disabled, or the current inversion state matches the initial inversion state at key-on { //Toggle the current inversion state of the envelope generator //output. Note that extensive hardware tests have been performed //on SSG-EG output inversion. This implementation has been shown //to always produce the correct output, even under unusual //circumstances such as when an attack phase is present, and/or //changes are made to the SSG-EG mode at critical points. state->ssgOutputInverted = !state->ssgOutputInverted; //Note that if the hold bit is set, the inversion state is //only toggled if the current inversion state matches the //initial inversion state. Under normal circumstances, this //prevents the inversion state from being toggled more than //once when the hold bit is set. This matches the confirmed //behaviour of the real chip. This behaviour is vital, as the //internal attenuation value finishes on 0x200 after each //decay phase. Without this test, once hold mode begins, the //inversion state would be toggled each sample. Note that the //envelope generator does not maintain a separate flag which //tracks whether the output has been inverted since key-on, //as changes to the SSG-EG mode after key-on can cause the //output to be inverted more than once under hold mode. } if(!GetSSGAlternate(channelNo, operatorNo, accessTarget) && !GetSSGHold(channelNo, operatorNo, accessTarget)) { //Hardware tests have shown that the phase counter is held at 0 //in cases where SSG-EG is enabled, both the hold bit and //alternate bit are unset, and the internal envelope generator //attenuation value is greater than or equal to 0x200. Once any //of these conditions change, the phase counter will resume //counting up from 0. This causes the phase of the output wave //to restart on each repetition of patterns 08 and 0C, which //occurs on the real hardware. Note that the phase counter //really is held at 0, not simply set to 0 at a particular point //in time. This can create silence gaps between repetitions of //the SSG-EG envelope where an attack phase exists. state->phaseCounter = 0; } if(state->phase != OperatorData::ADSR_ATTACK) { if((state->phase != OperatorData::ADSR_RELEASE) && !GetSSGHold(channelNo, operatorNo, accessTarget)) { //If SSG-EG is enabled, we're in either the decay or sustain phase, //and the hold bit is not set, now that we've reached an attenuation //level of 0x200, we need to loop back to the attack phase and begin //the ADSR envelope again. //Switch back to the attack phase SetADSRPhase(channelNo, operatorNo, OperatorData::ADSR_ATTACK); //Note that we've confirmed that the attenuation is not clamped //to 0x200 in SSG-EG mode when the ADSR envelope loops. By //toggling DR during the decay phase, we've proven that the final //attenuation value is allowed to move past 0x200 before looping. //If an attack curve follows, it begins its decay from this final //attenuation value. Don't uncomment the line below, it is //incorrect. It is only provided as an example of what NOT to do. //state->attenuation = 0x200; } else if((state->phase == OperatorData::ADSR_RELEASE) || !(state->ssgOutputInverted ^ GetSSGAttack(channelNo, operatorNo, accessTarget))) //If the output is not currently inverted { //If the output is not currently inverted, and we've reached an //internal attenuation level of 0x200 in one of the decay phases //(either the decay, sustain, or release phase), but the envelope //is not looping back to the attack phase, we need to force the //internal attenuation value to 0x3FF. This emulates the behaviour //of the YM2612 when entering a low-hold state in SSG-EG mode, and //when the release phase reaches 0x200. In both cases, the internal //attenuation value is forced directly to 0x3FF. This has been //confirmed through hardware tests. Note that this step occurs after //the inversion state has been toggled. Performing these steps the //wrong way around would break SSG-EG pattern 0xB, where both the //hold and alternate bits are set, and the attack bit is clear. //Force the internal attenuation value to 0x3FF state->attenuation = 0x3FF; //Note that this behaviour can be observed when switching from an //inverted hold pattern to a low-hold pattern, then back again after //the hold sequence has begun. When the inverted hold pattern resumes, //the digital output will be 0x001F instead of 0x1FE8, as the internal //attenuation value has been forced from 0x200 to 0x3FF, which becomes //0x201 when it is inverted, outputting a value of 0x001F. This effect //can also be observed when reading the decay sequence under the //release phase when SSG-EG mode is active. With an increment value of //1, the digital output from the operator unit can be observed to jump //directly from 0x0021 to 0, indicating the output attenuation value //from the envelope generator skipped from a known value of 0x1FC from //the decay sequence, to a value greater than 0x33F. } } } [/CODE] And this is an example of the steps you need to carry out when actually calculating the output from the envelope generator: [CODE] //If SSG-EG is enabled and the output is inverted, invert the output data. Note that //extensive testing has been performed on the hardware to build this implementation. //This test is performed exactly as shown each time the attenuation value is used. //Note the way the attack bit is combined with the inversion state. This is known //to be correct, and is essential in order to deal with cases where the SSG-EG state //is changed after key-on. A change in the state of the attack bit will result in an //immediate inversion of the output. Also note the calculation performed to derive //the "inverted" data. This calculation has been proven to be binary-accurate. if(GetSSGEnabled(channelNo, operatorNo, accessTarget) && (state->phase != OperatorData::ADSR_RELEASE) && (state->ssgOutputInverted ^ GetSSGAttack(channelNo, operatorNo, accessTarget))) { attenuation = 0x200 - attenuation; attenuation &= 0x3FF; } [/CODE] Note that this code snippet is being performed on a copy of the attenuation value, not the internal attenuation value itself. IE, this code isn't actually modifying the real attenuation value, just the value which is being output. This inversion of the output also occurs before TL is added to the output attenuation, and before amplitude modulation is applied. This is an example of the update calculation for the attenuation value in the decay, sustain, and release phase: [CODE] //Advance the linear decay for the decay, sustain, or release phase. Note //that if SSG-EG is enabled for this operator, the decay phase runs at 4x //the normal speed. if(GetSSGEnabled(channelNo, operatorNo, accessTarget)) { //If the current internal attenuation value is below 0x200, advance the //decay phase. In most cases when the attenuation level reaches 0x200, //the envelope will move back to the attack phase, or the attenuation //level will be forced to 0x3FF anyway. One case where neither of these //changes occur, and we need this check here to ensure the attenuation //level isn't permitted to advance any further, is when we enter an //inverted hold phase. Hardware tests have conclusively shown that in //these cases, if the internal attenuation level is greater than or equal //to 0x200, the attenuation level remains unchanged. This is true even in //cases where the internal attenuation level has been offset from a //multiple of 4, and the precise value of 0x200 is skipped over by an //SSG-EG increment. if(newAttenuation < 0x200) { newAttenuation += (int)(4 * attenuationIncrement); } } else { newAttenuation += (int)attenuationIncrement; } [/CODE] This is what you need to do when a key-off event occurs: [CODE] //If SSG-EG is enabled and the output is currently inverted, convert the //current attenuation value into an equivalent non-inverted value. This //emulates the release mode behaviour when SSG-EG is active. Note that we do //not alter the output inversion flag here. Output inversion is ignored //during the release phase. The output inversion flag is cleared when key-on //occurs. if(GetSSGEnabled(channelNo, operatorNo, accessTarget) && (state->ssgOutputInverted ^ GetSSGAttack(channelNo, operatorNo, accessTarget))) { state->attenuation = Data(attenuationBitCount, 0x200) - state->attenuation; } [/CODE] And finally, this little command needs to be run each time a key-on event occurs: [CODE] //Reset the SSG-EG output inversion flag state->ssgOutputInverted = false; [/CODE] That's my entire SSG-EG implementation. Note that existing emulators, including MAME and Kega, get a lot of the above implementation wrong. In fact, I'm pretty sure every aspect of the SSG-EG implementation in MAME is incorrect, including the calculation to invert the output, so the SSG-EG implementation in MAME really does need to be redone from scratch. 3. SSG-EG test rom With all this extra information about SSG-EG mode, I think I should post another SSG-EG test ROM to check the behaviour of SSG-EG under some of these undefined circumstances. Here's a test ROM which runs through each of the SSG-EG patterns with an attack phase: http://nemesis.hacking-cult.org/MegaDri ... elease.bin Here's the source: http://nemesis.hacking-cult.org/MegaDri ... elease.asm Here's the output you get on a PAL MD1600 (WARNING, huge file): http://nemesis.hacking-cult.org/MegaDri ... elease.rar And here's the output I currently get from my emulator using the SSG-EG implementation I detailed above: http://nemesis.hacking-cult.org/MegaDri ... elease.rar Note that patterns 0x0A and 0x0E alter each time they run. The inversion state may toggle between repetitions of the wave. In the "noise spike" between each repetition, the inversion state is actually being toggled each sample, since the internal attenuation level during the slow attack phase remains above 0x200 for an extended period of time, and the output inversion state is toggled each sample where the alternate bit is set, and the hold bit is unset. The exact sample on which the attenuation level drops below 0x200 determines what the inversion state is set to for the remainder of that repetition. Interrupt line corrections: I've got one correction to make regarding the info I posted ages back about the operation of the INT line on the YM2612. I had previously stated this: "Although not mentioned in the documentation, the reset flag directly affects interrupt generation. When a timer overflows, the YM2612 checks the current state of the timer overflow bit for that timer in the status register. The YM2612 will only generate an interrupt for that timer if the overflow bit is currently unset. If the overflow bit is unset, and the enable flag is set in the timer control register, the INT line will be asserted. The INT line will remain asserted, until the reset bit for that timer is set to 1 in the timer control register, or until the timer overflows again. If the reset bit for the timer is cleared at any time, the interrupt line will immediately be negated. If the timer overflows while INT is still asserted, that is, without reset being written to, the interrupt line will immediately be negated. From this point on, no interrupts will be generated for that timer until the reset bit is set. Once the reset bit has been set when an interrupt has been missed, the INT line will not immediately be asserted. The INT line will remain negated until the timer overflows again." Everything about the interrupt line not being asserted while the overflow bit is set, or the INT line being negated if the overflow bit hasn't been cleared, is incorrect. There was an error in my testing procedures which caused bad readings. The INT line is asserted whenever a timer overflows, and will remain asserted until the reset bit is flagged for the timer. This makes more sense, and is consistent with how other interrupt devices operate. The INT line is generated in real-time by a logical OR operation between the overflow bits of the two timers. CSM corrections: The information I gave previously about CSM mode is basically correct, but there are some points which require clarification. I didn't feel I did enough testing on the interaction between CSM key on/off and manual key on/off events, so I went back and did some more testing. These tests revealed some important details about how CSM mode is implemented in the YM2612. 1. When CSM key-on and key-off occur I stated previously that CSM key-on and key-off events occurred "at the same time". Obviously this isn't exactly correct, since the key-on event needs to be processed first. Originally, I believed that CSM key-on and key-off occurred during a single envelope generator update cycle, however while implementing CSM support in my core, I came to doubt the accuracy of this. I did some more testing in an attempt to verify whether CSM key-on and key-off occurred on the same update cycle, or whether CSM key-on occurred on one cycle with key-off occurring at the start of the next cycle. What I found is that not only does CSM key-off occur on a separate cycle to key-on, it is possible for a CSM key-on event to be lengthened to any number of update cycles, allowing the note to proceed through the attack, decay, and sustain phases, with CSM key-off not occurring until a register change is made. The way CSM key on/off events are triggered is simple. First of all, there is a dedicated internal flag which indicates the current "CSM key-on" state. When timer A overflows, if CSM mode is enabled, this "CSM key-on" flag is set. This flag remains set until the next phase generator update cycle, when key-on events are again evaluated. Note that this does occur based on the phase generator update cycle, not the envelope generator update cycle, as elaborated on above regarding when key on/off events are processed. After the key-on state of the operator has been evaluated during the next update cycle, the CSM key-on flag is cleared. If timer A does not overflow again before the next update, the CSM key-on flag will appear negated, which would key-off the operator on the next update cycle after it had been keyed on by CSM mode. If timer A overflows before every update cycle however, the CSM key-on flag appears to be permanently set, since it is always being re-asserted before it is sampled again. The effect of this is that CSM key-off does not occur, and the key-on event generated by CSM mode allows the operator to proceed through the normal ADSR envelope. Since timer A runs at the same rate as the phase generator update cycle, setting the timer A period to the shortest possible value (0x3FF) will cause this behaviour. Note that if the channel 3 mode doesn't equal 10 (upper bits of register 0x27 set to 10), the CSM key-on is masked, and the CSM key-on state is forced to 0. This causes a CSM key-off event to occur if CSM mode is disabled while CSM key-on is currently being held on. Note that as I stated in my previous description of CSM mode, CSM mode is only active when the channel 3 mode status bits are set to 10, not when they are set to 11. 2. How CSM key-on is tracked vs manual key-on There are two separate key-on flags. There is a normal key-on flag, which is updated by sending manual key on/off writes to register $28. There is also a separate CSM key-on flag, which is constantly and automatically updated when CSM mode is enabled, even when an operator has been manually keyed on. The way these two separate key-on flags interact is really simple. They are OR'd together. An operator is in a state of key-on if either of these flags is asserted. An operator is in a state of key-off if both these flags are cleared. With this implementation, if an operator is manually keyed on, the CSM key-on event is effectively "masked". Since the lines are OR'd together, if the manual key-on line is asserted, it will hold the operator in a keyed on state, regardless of the state of the CSM key-on flag. Once the manual key-on event is cleared, the CSM key-on state is able to have an effect, and change the effective key-on state of the operator. The YM2612 itself only considers that a key on/off event has occurred if the combined OR state of these two flags is different at the beginning of an update cycle than it was at the beginning of the last update cycle. You should be aware that some unusual combinations of manual key on/off events and CSM mode do require the above details to be implemented correctly. It is possible, for example, to "hand over" a key-on event between CSM mode and manual key on/off events. Eg, you can key on an operator manually, trigger a CSM key-on event in a "held" state (timer A at max rate), key-off the operator manually, and find that the operator does not actually key-off, since the CSM key-on state keeps the operator keyed on. The same rule applies in reverse. And I think that's all the corrections I'm aware of for the info I've previously posted. The next info I post will be on the LFO. The current LFO implementation in MAME is mostly correct, but there is an error in the phase modulation implementation which I'll detail. I've also figured out the cause of the different sound in Battletech track 12, which was discussed awhile back in this thread. I'll post a detailed description on what causes the difference in sound, but it's actually a fairly complex explanation, so it'll be quite a long post. Apart from that, I've got some more testing to perform on the operator unit relating to the way algorithms are implemented, the DAC needs some attention, and I'm going to publish my own notes on the YM2612 test register, but after that, I'll be pretty much done with the YM2612. Then I can turn my attention entirely to the VDP. ######## POST p7969 | TmEE co.(TM) | 2009-02-22 | t386-405.html Awesome work [IMG ./images/smilies/icon_biggrin.gif] And some relevant stuff, I messed with DAC a little... Seems that YM2612 misses DAC writes or does not output them when the sample rate is too high... it is odd that when you wait for the chip to be ready, things will not sound too good.... 32KHz sounds bad (and its around the rate you get when you wait for the chip). 26KHz (~half the YM2612 sample rate) sounds great though [IMG ./images/smilies/icon_smile.gif] http://www.fileden.com/files/2008/4/21/ ... CTESTS.RAR ######## POST p7995 | Eke | 2009-02-23 | t386-405.html Thanks for the corrections Nemesis, the CSM mode is now more clear (and appears to be a vey useful feature for programmers) and the SSG-EG support indeed requires some additional work [IMG ./images/smilies/icon_wink.gif] Though, there is still something about EG that is not clear to me: when does EG phase change occurs ? at the start of a new enveloppe cycle by checking the current attenuation level or at the end, after the attenuation level has been updated. This also determine the behaviour of the next enveloppe update in the 2 following case: 1/ attack rate is set to 62 or 63: you say that the attenuation level is set to 0 but is the next enveloppe update done with Attack or Decay parameters ? 2/ SL is set to 0: does EG enter the susbtain phase once or does it directly jump to release ? 3/ what happen when both conditions are met: AR = 62/63 and SL = 0 ? Some other questions: how is attenuation level generally handled when Key ON occurs , for example, if the "volume" has not reached 0 yet ? what are default values (internals and registers ) on chip reset ? ######## POST p7998 | Snake | 2009-02-23 | t386-420.html Wow, huge post [IMG ./images/smilies/icon_smile.gif] Kind of odd that you would post this right now. I have a ton of SSG-EG samples I did years ago, but I lost the test ROMs that created them, so I didn't know what I was looking at. This weekend I found them and spent most of it looking into this again. I'll read your post properly later and see if it matches what I came up with, a brief look says that some of it does, but there's stuff I didn't get around to yet that you've probably covered. So, all in all, I probably just wasted a weekend [IMG ./images/smilies/icon_smile.gif] All the other stuff seems to be correct, at first glance anyway. [edit] ok, so the bits I hadn't gotten to yet seem to be the bits that make the least sense. "Surprising" isn't the word. Given what the thing is supposed to do, you'd have to be on crack to implement it this way. I don't doubt that what you posted does indeed match the output of the real chip - it does seem to explain exactly what I'm seeing (all except one case which I won't be able to confirm without testing). But I do wonder if there is another way of getting the same results from some of this, just because - well - it's pretty insane [IMG ./images/smilies/icon_smile.gif] I'd be interested to hear more about how you came to some of these conclusions and the tests you did to verify. [QUOTE] Nemesis wrote:These aren't bugs, simply areas of undefined behaviour where the result is not specified, because "you're not supposed to do that". [/QUOTE] Not that it's important, but I would agree with you that writing to registers while the envelope generator is running is really something you're not supposed to do, and the odd things that can happen when you do this can't really be considered 'bugs'. But I disagree on the oddness that happens when AR!=0x1F. The fact that the documentation tells you to do that just strikes me as a "oops, we didn't test this" from Yamaha. Any sensible implementation of SSG-EG wouldn't have this problem, there should be no reason it's needed, and there's plenty of places where they could have, should have, and probably would have (if they'd thought of it) just forced the attenuation to zero - IF that was how it was originally intended to work. "You must use 0x1F" is a workaround, definitely a bug imo. [QUOTE] Nemesis wrote:Note that existing emulators, including MAME and Kega, get a lot of the above implementation wrong. [/QUOTE] Yeah, I thought I'd covered every case that was actually used, and planned to go further later, but then lost the ability to do so. Didn't know about that damn olympics game... [QUOTE] Nemesis wrote:In fact, the envelope generator is updated once every 3 fm update cycles, which was the existing behaviour in the MAME core. [/QUOTE] There's something that you could test. Fairly unimportant, but I believe the reason why it's 3 cycles is that the YM2203 updates the envelopes for channel 1 on the first cycle, channel 2 on the second cycle... The YM2612 probably does one channel from each 'half' every cycle. [edit again] I missed this... [QUOTE] Nemesis wrote:I've also figured out the cause of the different sound in Battletech track 12 [/QUOTE] I think there are a number of things that cause the difference, but this is I believe the main one. [IMG http://www.reptilia-design.co.uk/gen1-gen2.png] This is a sample I produced long ago while investigating the detune bug, and the filters. Top is a Genesis model 1, bottom is a Genesis model 2. Throughout the entire test, everything is played at max volume. The large bars you see are a normal note which is in a range which does not get filtered at all, showing you what the actual output volume is supposed to be. Everything else is a note played utilising the detune bug. All of the frequencies produced are the same on both consoles. But the filter in the Genesis 2 has a fair amount of ripple, whereas the Genesis 1 filter flattens out nicely. As you can see, most of the time the Genesis 2 filters out more than the Genesis 1. But the 4th, 5th and 9th note in this picture show the Genesis 2 letting through significantly more than the Genesis 1 does. The 5th note played is, I believe, the one used by Battletech. The Genesis 1 cuts out most of the high frequency created by using this note as a modulator, the Genesis 2 lets a lot of it through. As a side note, this would be much softer than it actually is on a Genesis 1 if it wasn't for the distortion created at this low volume. ######## POST p7999 | Snake | 2009-02-23 | t386-420.html [QUOTE] Eke wrote:1/ attack rate is set to 62 or 63: you say that the attenuation level is set to 0 but is the next enveloppe update done with Attack or Decay parameters ? [/QUOTE] Decay. Attack is skipped immediately in this case. [QUOTE] Eke wrote:2/ SL is set to 0: does EG enter the susbtain phase once or does it directly jump to release ? [/QUOTE] I believe you mean 'decay' and 'sustain' here... Again, one phase (decay) is skipped and it goes immediately to sustain. [QUOTE] Eke wrote:3/ what happen when both conditions are met: AR = 62/63 and SL = 0 ? [/QUOTE] level set to zero, followed by sustain. [QUOTE] Eke wrote:how is attenuation level generally handled when Key ON occurs , for example, if the "volume" has not reached 0 yet ? [/QUOTE] Nothing happens, the level continues from where it was. This is true of all 'real' synth chips, including the good old SID chip. It's closer to how a real instrument works - softly tap a key on a piano and it will get louder each time. [QUOTE] Eke wrote:what are default values (internals and registers ) on chip reset ? [/QUOTE] I did a bit of testing on that many, many years ago. I don't recall fully, but I believe they are mostly undefined (if you reset the chip while it's playing, I believe the note continues unaffected), with the exception of the registers that control stereo, which seem to be set to allow left and right output for all channels, at least at power on. It's a good question, though... ######## POST p8004 | Eke | 2009-02-24 | t386-420.html again, thanks for the clarifications this helps a lot ######## POST p8007 | HardWareMan | 2009-02-24 | t386-420.html I made a record Battletech Track 12 from my Model 1 for compare. Here is it . I keep it in original WAV, so you get lossless. That high frequences is very interesting. [IMG http://img7.imageshack.us/img7/5615/hifreq1.th.gif] [IMG http://img7.imageshack.us/img7/5498/hifreq2.th.gif] The amplitude can be distort becouse very small difference with sampling frequency (wich is 48kHz) and frequency of signal. But this signal still interesting. Next, we have seen good old "ladder" effect on bass: [IMG http://img7.imageshack.us/img7/5692/ladder.th.gif] ######## POST p8008 | Snake | 2009-02-24 | t386-420.html That's a really good capture of the effect, better than I've seen so far. How did you capture that? ######## POST p8009 | HardWareMan | 2009-02-24 | t386-420.html [QUOTE] Snake wrote:That's a really good capture of the effect, better than I've seen so far. How did you capture that? [/QUOTE] Easy. Just connect earphone jack on MD1 to line in of my Audigy. Then set maximum volume on MD1 (to get maximal signal-to-noise ratio) and attenuate it on Audigy mixer. BTW, volume of this track not so loud, so I set all to maximum. ######## POST p8010 | Eke | 2009-02-24 | t386-420.html some more bits [QUOTE] I haven't found a neat way to emulate all this behaviour. I currently calculate the effective attack rate immediately when switching to the attack phase, and if the rate is greater than or equal to 62, I force the attenuation level directly to 0. I also have an exclusion in the normal envelope generator update cycle when updating the attack curve. If the attack rate is greater than or equal to 62, I don't advance the attack curve. This emulates the behaviour of the YM2612, but it probably isn't emulating the exact way this special case behaviour is implemented. I'm open to any suggestions about a neater way to emulate this. [/QUOTE] What I did is to use the same increment values as when Rate is 0 (infinite rate), in the case Atttack Rate is 62 or 63 when rate values (increment and shift) need to be recalculated. And to immediately jump into Decay phase on Key ON (or SSG-EG loop restart) when Attack Rate is 62 or 63. [QUOTE] More than this, there is an order to the way the SSG-EG update steps during this output cycle interact with the normal envelope generator update cycle. For one of every three output samples, the envelope generator update cycle will occur along with the envelope generator update cycle. When that happens, the operations are performed in the following order: 1. The SSG-EG output cycle update steps are performed 2. The envelope generator update cycle runs 3. The output from the envelope generator is calculated [/QUOTE] Can you confirm that output calculation also happen the same way with normal enveloppe ? Meaning that any change to internal attenuation level (for example on Key ON with AR=62,63) or to TL (on register write) will apply to the EG output calculation used for the next sample, even if no EG update was planned ... [CODE BLOCK WITHHELD: 1194 chars] what happen in this case and more generally during the RELEASE phase for next samples update ? according to your algo, as attenuation level will remain higher than 0x200, this would mean the Invert flag could be swapped (even if output is not inverted during release) or the Phase counter could be reseted for each samples under some conditions... isn't there a OFF state when attenuation reaches 0x3FF which turn the Enveloppe Generator off ? Or does the SSG-EG update process continue anyway ? ######## POST p8017 | SmartOne | 2009-02-24 | t386-420.html [QUOTE] HardWareMan wrote:Then set maximum volume on MD1 (to get maximal signal-to-noise ratio) and attenuate it on Audigy mixer. BTW, volume of this track not so loud, so I set all to maximum. [/QUOTE] Does the Genesis 1 HD max volume really produce the greatest signal-to-noise ratio? I thought about 75% was the most distortion-free... ######## POST p8018 | TmEE co.(TM) | 2009-02-24 | t386-420.html Its model dependant, some models have different headphone amp which starts distorting sound at over ~7. The model he has, has no trouble at max. The VA7 MD1 is one model which is very bad at higher volumes. ######## POST p8019 | Snake | 2009-02-24 | t386-420.html [QUOTE] Eke wrote:What I did is to use the same increment values as when Rate is 0 (infinite rate) [/QUOTE] Indeed, it makes perfect sense. [QUOTE] Eke wrote:Can you confirm that output calculation also happen the same way with normal enveloppe ? Meaning that any change to internal attenuation level (for example on Key ON with AR=62,63) [/QUOTE] If what Nemesis says is 100% correct, then it follows that this must indeed be the case, or certain things would get broken. [QUOTE] Eke wrote:or to TL (on register write) [/QUOTE] TL is done independantly of the env anyway, so, yes, this will happen immediately. [QUOTE] Eke wrote:according to your algo, as attenuation level will remain higher than 0x200, this would mean the Invert flag could be swapped [/QUOTE] This is one of the parts I'm not yet convinced of. I can see where the thinking comes from because it solves a number of problems - then again, I've got a ton of samples that don't look like that is happening. It's possible that it is but I'd need to write some tests before I can say either way. [QUOTE] Eke wrote:isn't there a OFF state when attenuation reaches 0x3FF which turn the Enveloppe Generator off ? Or does the SSG-EG update process continue anyway ? [/QUOTE] It's highly probable nothing ever really 'stops'. There'd be no benefit in doing so. ######## POST p8020 | Nemesis | 2009-02-25 | t386-420.html Gah, more to say, not enough time. I'll reply to some more comments later. [QUOTE] Seems that YM2612 misses DAC writes or does not output them when the sample rate is too high... it is odd that when you wait for the chip to be ready, things will not sound too good.... 32KHz sounds bad (and its around the rate you get when you wait for the chip). 26KHz (~half the YM2612 sample rate) sounds great though [/QUOTE] Hmm, that is strange. It looks like the one running at the higher frequency has some additional noise on the output signal. I'll take a look. [QUOTE] what are default values (internals and registers ) on chip reset ? [/QUOTE] I can't say I've done very thorough tests on this. I generally ran on the assumption that the registers were initialized to 0 on power-on. I found documentation stating this is the case for other Yamaha FM chips, and the same seems to be true on the YM2612, with the exception of the Left/Right flags, which are initially set as Steve mentioned (and would be on the YM2608 as well, presumably for OPN compatibility reasons). I didn't do any tests with triggering a reset after initializing the registers or anything like that however. [QUOTE] Not that it's important, but I would agree with you that writing to registers while the envelope generator is running is really something you're not supposed to do, and the odd things that can happen when you do this can't really be considered 'bugs'. But I disagree on the oddness that happens when AR!=0x1F. The fact that the documentation tells you to do that just strikes me as a "oops, we didn't test this" from Yamaha. Any sensible implementation of SSG-EG wouldn't have this problem, there should be no reason it's needed, and there's plenty of places where they could have, should have, and probably would have (if they'd thought of it) just forced the attenuation to zero - IF that was how it was originally intended to work. "You must use 0x1F" is a workaround, definitely a bug imo. [/QUOTE] That depends on what you think their objectives were. You could say that having the attack phase officially supported and usable with the SSG-EG modes would have been a useful addition, and you're right, it shouldn't have taken a lot of work to do. I honestly don't think they ever planned on allowing the attack phase to be used with SSG-EG modes however, and there is reason behind that line of thinking. It is important to remember that the SSG-EG mode is only provided in order to emulate the behaviour of the SSG envelope generator. The SSG module itself is based on the older AY-3-8910 produced by General Instruments. From the get-go, the purpose of SSG-EG wasn't to add new functionality, it was to emulate old functionality, and it was approached in that manner. The AY-3-8910 effectively only had a linear decay cycle. It had a counter which was set to advance at a specified rate, and it progressed in a linear fashion. That was the spec. In this context, the attack phase is superfluous. Allowing an attack phase to be combined with SSG-EG mode was simply not required, and from some points of view, pointless. The designers would have been given the specs saying "we want the FM envelope generator to be able to mimic the behaviour of this chip", and they went off and designed a function that allowed just that, but the designers obviously didn't feel the need to go beyond that spec. In this context, I would disagree with the statement that the strange behaviour we see when combining an attack phase with SSG-EG should be considered a bug. SSG-EG was built for a purpose, and the attack phase simply wasn't a part of it. They didn't want the attack phase getting in the way of the SSG-EG emulation, so the mandate was to set the attack rate to 0x1F, causing the attack phase to be instantly skipped, getting it out of the way and allowing the decay/sustain phase to emulate the linear counter of the SSG envelope generator without interference. I don't think this was an "oops" at the end, I think it was a conscious decision made early on in the planning stages, and as such, SSG-EG was built without regard for how it would interact with an attack phase. [QUOTE] There's something that you could test. Fairly unimportant, but I believe the reason why it's 3 cycles is that the YM2203 updates the envelopes for channel 1 on the first cycle, channel 2 on the second cycle... The YM2612 probably does one channel from each 'half' every cycle. [/QUOTE] Heh, I hadn't thought of that. You're probably right. I'll do some tests for this. [QUOTE] [QUOTE] I've also figured out the cause of the different sound in Battletech track 12 [/QUOTE] I think there are a number of things that cause the difference, but this is I believe the main one. ... [/QUOTE] Yep, that's along the right line. The cause of the difference is in the analog domain, and it is triggered by high frequency tones. In the case of Battletech track 12, it's specifically the effect of volume changes on a high frequency tone that cause the problem. The tone effectively becomes a carrier wave for another wave which is generated by the volume changes. The MD2 has an imperfect output which causes these volume changes to produce an audible waveform, when they should in fact not be audible at all. I really need to post pictures and samples in order to explain it properly. [QUOTE] [QUOTE] More than this, there is an order to the way the SSG-EG update steps during this output cycle interact with the normal envelope generator update cycle. For one of every three output samples, the envelope generator update cycle will occur along with the envelope generator update cycle. When that happens, the operations are performed in the following order: 1. The SSG-EG output cycle update steps are performed 2. The envelope generator update cycle runs 3. The output from the envelope generator is calculated [/QUOTE] Can you confirm that output calculation also happen the same way with normal enveloppe ? Meaning that any change to internal attenuation level (for example on Key ON with AR=62,63) or to TL (on register write) will apply to the EG output calculation used for the next sample, even if no EG update was planned ... [/QUOTE] Yes. Try using CSM mode with really quick timer periods (IE, one less than minimum) and you'll see this is true for key on/off changes. I can't say I've tested this for TL changes specifically, but I can say it is true for TL anyway, since TL is applied after output inversion, and I confirmed that output inversion happens every sample, so the envelope generator has to read TL each sample to apply it to the output. ######## POST p8023 | Snake | 2009-02-25 | t386-420.html [QUOTE] Nemesis wrote:Hmm, that is strange. It looks like the one running at the higher frequency has some additional noise on the output signal. I'll take a look. [/QUOTE] It's probably writing to the DAC at around the same time the chip is trying to read it. [QUOTE] Nemesis wrote:I can't say I've done very thorough tests on this. I generally ran on the assumption that the registers were initialized to 0 on power-on. I found documentation stating this is the case for other Yamaha FM chips [/QUOTE] Yes, me too, and it's probably correct, at least on power on. I seem to recall hitting the reset line didn't clear things though (maybe it keyed all channels off?) - then again I've done so much of this stuff on different hardware over the last few years I could be thinking of an entirely different system [IMG ./images/smilies/icon_wink.gif] [QUOTE] Nemesis wrote:From the get-go, the purpose of SSG-EG wasn't to add new functionality, it was to emulate old functionality [/QUOTE] Absolutely, and it definitely seems like it was tacked on at the end rather than built into the design from the start. [QUOTE] Nemesis wrote:They didn't want the attack phase getting in the way of the SSG-EG emulation, so the mandate was to set the attack rate to 0x1F [/QUOTE] Yes, but my point is that if they're already forcing the attenuation to zero when AR is above 62, why didn't they just force that all the time in SSG-EG mode? Or in plenty of other places where they could have done so? Leaving this up to the programmer in this way isn't something you'd usually expect to see. In any case, the entire chip seems very well designed and logical - except for this bit, which is all a bit "WTF?" [IMG ./images/smilies/icon_wink.gif] ######## POST p8025 | Nemesis | 2009-02-26 | t386-420.html [QUOTE] Snake wrote:[edit] ok, so the bits I hadn't gotten to yet seem to be the bits that make the least sense. "Surprising" isn't the word. Given what the thing is supposed to do, you'd have to be on crack to implement it this way. I don't doubt that what you posted does indeed match the output of the real chip - it does seem to explain exactly what I'm seeing (all except one case which I won't be able to confirm without testing). But I do wonder if there is another way of getting the same results from some of this, just because - well - it's pretty insane I'd be interested to hear more about how you came to some of these conclusions and the tests you did to verify. [/QUOTE] Notes on a lot of the important hardware test cases are included in the source I posted. There are a few points which could be implemented differently to get the same result, but not a lot. I simply can't think of another way to implement some of the weirdest stuff. Consider the way output inversion is tracked for example. A change to the attack bit always causes an immediate inversion of the output, and believe me when I say I tested this under every conceivable circumstance. The YM2612 doesn't reset the inversion state to the attack state on the write, since if you had a wave where ATT=0 and ALT=1, and it had toggled the output inversion state once since the wave began (so the output was currently inverted), and you then changed the ATT bit to set, the wave output would immediately switch to a non-inverted state. With that ruled out, the observed behaviour says to me that the attack bit is being combined with the output inversion state each cycle through an XOR operation, and the internal flag tracks whether the output has been inverted from the starting value, rather than representing the true output inversion state by itself. A slightly unusual choice perhaps, but that's what the evidence indicates, and it's a fairly simple operation by itself. That has a few flow-on effects however. It simplifies the inversion exclusion for hold mode, since we now only have to test the boolean flag to determine whether the output has been inverted yet (since hold mode only ever allows the ALT bit to toggle the inversion state once), however it now means we have to combine the ALT bit with the inversion bit in 3 places in order to calculate the true, effective inversion state. There are more impacts as well. Now we have to consider release mode. Output inversion is always disabled during the release phase, regardless of what the current state of the output inversion bit was, and the state of the ATT bit, when the release phase was entered. Ok, so output inversion is disabled during release, but how is it disabled? Since the output inversion flag now represents whether the output inversion state has been toggled from the base value given by the ATT bit, it's not as simple as clearing the output inversion flag when entering the release phase. If you clear the output inversion flag and the ATT bit is set, you still get an inverted output. Do you then load the state of the ATT bit into the output inversion state when entering the release phase? Wrong, since toggling the ATT bit during the release phase doesn't cause output inversion to kick in. This means we now need an extra test where we check the output inversion state. If we're in the release phase, the effective output inversion state is forced to false, so our test for output inversion is now something like this: (phase != release) && (ATT ^ inversionBit) Some other interesting choices are having the SSG-EG state updated on the output cycle rather than the update cycle. Perhaps this made the SSG-EG mode easier to integrate with the existing design. All the voodoo with 0x200 makes sense from the point of view of least effort, since they needed some way to hook their SSG-EG update process with the existing envelope generator. Sacrificing one bit of resolution from the attenuation value and using the upper bit of the attenuation as a flag for the SSG-EG update steps in the output cycle was the easiest way to achieve it, and a 9-bit resolution for attenuation was enough for what they were emulating anyway. [QUOTE] Eke wrote:what happen in this case and more generally during the RELEASE phase for next samples update ? according to your algo, as attenuation level will remain higher than 0x200, this would mean the Invert flag could be swapped (even if output is not inverted during release) or the Phase counter could be reseted for each samples under some conditions... [/QUOTE] There's no way to verify, at least that I can think of. Since the effective output inversion state is always forced to false when the release phase is active, there's no way to sample the current value of the invert flag. All we can say with certainty is that when key-on occurs, the note begins with the invert flag cleared. In my implementation, I only clear it during key-on, and simply allow it to be constantly toggled when the release phase reaches 0x200. Instead of this, you could clear it when key-off occurs, and add an exclusion to the SSG-EG update steps to prevent the invert flag being toggled during the release phase. As for the phase counter restart, again there's no way to verify, since the internal attenuation level is always forced to 0x3FF when the release phase hits 0x200. The phase counter is theoretically restarted on the same sample as the attenuation is forced to max, but I have no way to sample the output from the phase generator when the attenuation is at max, and the only way to lower the attenuation from a release phase is to trigger a key-on event, which restarts the phase counter anyway. Of course, seeing as there's no way to verify what the real chip does, it also doesn't matter, since there's no way any of this can have any effect on the output. [QUOTE] Eke wrote:isn't there a OFF state when attenuation reaches 0x3FF which turn the Enveloppe Generator off ? Or does the SSG-EG update process continue anyway ? [/QUOTE] I'd say there isn't an "off" state, simply because there would be absolutely no point to include one. The decay phases include a limiter on the update step to clamp the maximum attenuation at 0x3FF. This prevents the decay phase from advancing once it reaches maximum attenuation anyway, and since the output during any "off" mode is just going to be 0x3FF, adding an "off" state wouldn't serve any purpose. [QUOTE] Snake wrote: [QUOTE] Eke wrote:according to your algo, as attenuation level will remain higher than 0x200, this would mean the Invert flag could be swapped [/QUOTE] This is one of the parts I'm not yet convinced of. I can see where the thinking comes from because it solves a number of problems - then again, I've got a ton of samples that don't look like that is happening. It's possible that it is but I'd need to write some tests before I can say either way. [/QUOTE] Do you mean in general, or during the release phase (the source of the quote)? During the release phase it doesn't matter. During the attack/decay/sustain phases, I'm quite confident the invert flag gets toggled each sample once the attenuation reaches 0x200. If you're looking at the recorded output of the chip, remember that high frequency waves (which is what a constantly toggling inversion bit gives you) get pulverized by the output circuitry. [QUOTE] Snake wrote: [QUOTE] Nemesis wrote:They didn't want the attack phase getting in the way of the SSG-EG emulation, so the mandate was to set the attack rate to 0x1F [/QUOTE] Yes, but my point is that if they're already forcing the attenuation to zero when AR is above 62, why didn't they just force that all the time in SSG-EG mode? Or in plenty of other places where they could have done so? Leaving this up to the programmer in this way isn't something you'd usually expect to see. In any case, the entire chip seems very well designed and logical - except for this bit, which is all a bit "WTF? [IMG ./images/smilies/icon_wink.gif] [/QUOTE] Yeah, that's true. Ok, we can agree then that SSG-EG was clearly an afterthought, done quickly, with the least effort possible, requiring the least changes to the existing core, and certainly using some questionable design approaches. In other words, it's dodgy, but they knew it was dodgy. [IMG ./images/smilies/icon_smile.gif] ######## POST p8026 | Nemesis | 2009-02-26 | t386-420.html Missed this: [QUOTE] Snake wrote:I don't doubt that what you posted does indeed match the output of the real chip - it does seem to explain exactly what I'm seeing (all except one case which I won't be able to confirm without testing). [/QUOTE] Care to share? If there are errors in my implementation, I'd like to track them down quickly before I forget all this stuff. [IMG ./images/smilies/icon_smile.gif] In six months time I'm not going to remember a damn thing about this. ######## POST p8027 | Snake | 2009-02-26 | t386-420.html [QUOTE] Nemesis wrote:Care to share? [/QUOTE] Absolutely, happy to. It's to do with the inverting every cycle thing. I believe my tests were done with AR=0x0A, and one of the inverting patterns. I was looking at what I assume is an inverted attack, and it looks like a perfect sine wave at a constant volume. The samples you provided don't look like that at all. As I said, I can't rule out it is in fact doing what you suggest without testing. If it matters I think the sample came from an MD2, but I'd be surprised if SSG-EG works any differently there. I'll look through my samples and post this one when I find it, but you can probably repro it fairly easily. [edit]Here we go. As you can see it looks like a sine wave at the same frequency as the rest of the wave. I'm not sure your data explains this, or the volume level, but if you can explain it, please do - I've been stupidly busy and haven't had much sleep these last few days, so my brain may just be misfiring [IMG ./images/smilies/icon_wink.gif] Actually, looking at it now, you can see where the wave switches from decay to sustain - and the level of the 'spike' is suspiciously similar to the sustain level. Hmm. ######## POST p8028 | AamirM | 2009-02-26 | t386-435.html Damn, I've got no free time time to read all that [IMG ./images/smilies/icon_cry.gif] . But thanks to everyone who is contributing to these new discoveries [IMG ./images/smilies/icon_smile.gif] . ######## POST p8030 | Eke | 2009-02-26 | t386-435.html ok, I've finished the new SSG-EG implementation in the MAME core.(as well as some other stuff you mentionned, like correct CSM mode) Seems fine so far with the test programs... Nemesis, if you want to have a look and doublecheck it (I tried to optimize it a little bit and avoid unecessary recalculation as most as I could), please check here for fm.c... any advice/corrections appreciated [IMG ./images/smilies/icon_wink.gif] ######## POST p8032 | Nemesis | 2009-02-26 | t386-435.html [QUOTE] Snake wrote:[edit]Here we go. As you can see it looks like a sine wave at the same frequency as the rest of the wave. I'm not sure your data explains this, or the volume level, but if you can explain it, please do - I've been stupidly busy and haven't had much sleep these last few days, so my brain may just be misfiring [IMG ./images/smilies/icon_wink.gif] [/QUOTE] Yep, I can explain what's happening. The recording you've taken is at 44100Hz. The native output of the YM2612 in the Mega Drive is around 52847Hz. With the output being inverted each sample, that creates a wave with a frequency of around 26423.5Hz, but since you need to be able to capture at least two full samples in order to record a wave at that frequency, the sampling rate you're recording at simply isn't high enough to capture the inversion. The samples are averaging together, which is why you're being left with a regular sine wave at mid-level. You'll also note the strange distortion on the sine waves you posted as the phase of the output causes the output to approach 0. That's because the difference between the normal and inverted output samples is being reduced by the attenuation from the phase generator, so your sound card is able to more accurately observe the true slope of the carrier wave as the output approaches 0. If you check the massive sampled recording I made on the hardware (which is recorded at 96KHz), you'll see the inversion occurring. Measure the frequency of the generated wave (spectral view is good for that) and you'll see that it matches the expected output frequency caused by the inversion state toggling each sample. You'll also note in the recording I took that there is still some sample averaging taking place. The only way to get a true, clean sampling of the output with such a high frequency wave would be to run at a multiple of the native output sample rate from the YM2612. Running at 192KHz doesn't make things clearer, since the multiplexed output from the YM2612 becomes visible at that sample rate. [QUOTE] Eke wrote:Nemesis, if you want to have a look and doublecheck it (I tried to optimize it a little bit and avoid unecessary recalculation as most as I could), please check here for fm.c... any advice/corrections appreciated [IMG ./images/smilies/icon_wink.gif] [/QUOTE] I can see one thing that might be a problem, if I'm following your code correctly. When SSG-EG is active and the envelope is in the release phase, the attenuation level is still forced directly to 0x3FF when the release phase reaches 0x200. It looks like you're excluding all SSG-EG update steps when release phase is active, which would also exclude this behaviour. And this is nitpicking, but there are also some old comments under the heading "SSG-EG envelope shapes" which should be looked at. Some of the info under this comment block will no longer match what the code actually does, eg, the bit about a restart of the phase generator. ######## POST p8034 | Snake | 2009-02-26 | t386-435.html [QUOTE] Nemesis wrote:The samples are averaging together, which is why you're being left with a regular sine wave at mid-level. [/QUOTE] I did consider that, but since the sample rate is not divisible by the hardware output rate, I would have expected to see some clear distortion rather than an almost perfect wave - I can see this in other samples. Also - granted, inverted 0x200 will give you 0x000, but every value above 0x200 will also give you a value above 0x200 - I would have expected something much quieter than mid level if the two were just being averaged. But as I said, it's not clear from this sample alone and I'd have to do more tests. I do know that a lot of the info you posted is correct, because I confirmed some of it myself a long time ago. But back then 44KHz was "the business", and I knew it wasn't good enough. I paid a lot of money for a true 96KHz card right before I lost all my equipment anyway :-/ I'd love to be able to confirm all this stuff for myself, and see it we can't come up with a simpler or more logical way of implementing it. Not that it's complicated, just... odd. In my experience, odd usually means wrong, but I'm prepared to accept that in this case, it is probably just a strange piece of hardware hackery. Would like to be sure, though, because that's just "how I roll" [IMG ./images/smilies/icon_wink.gif] [edit] oh - while I'm here - a lot of games write to the upper 4 bits of the SSG-EG registers. I'm not sure what the programmers think they were doing this for, and I didn't test extensively, but I believe they don't do anything. Did you test this? ######## POST p8037 | Nemesis | 2009-02-27 | t386-435.html [QUOTE] Snake wrote:Also - granted, inverted 0x200 will give you 0x000, but every value above 0x200 will also give you a value above 0x200 - I would have expected something much quieter than mid level if the two were just being averaged. [/QUOTE] Ahh, but remember that the attenuation isn't moving past 0x200 during a repeating SSG-EG wave. In the pattern you posted, the attenuation decays until it reaches 0x200. When this happens, if AR was 0x1F, the attenuation would be forced back to 0. Since this isn't the case, what happens is the attenuation sits on 0x200 until the attack phase advances. When it does advance, it will drop the attenuation to 0x1DF. From this point on, you get a valid, advancing attack phase, but all the samples that were generated while the attenuation value was sitting on 0x200 will be inverting each sample. One point where you do get an attenuation level over 0x200 being toggled each sample is when you first key-on an SSG-EG envelope with an attack rate less than 0x1F, if the current attenuation level is over 0x200 that is. Examine the hardware recording I made at the start of patterns 0xA and 0xE. You want to zoom in on the vertical axis a lot and have a really good look at the low-volume lead-in for the attack curve. The DAC starts doing horrible things with this much attenuation, but you'll be able to see the same high-frequency oscillation occurring on this wave. You'll also be able to see a "dead patch" a little before half-way along this block, where the attenuation level is around 0x300, and 0x300 inverted is still 0x300, so the high frequency oscillation reduces as the attenuation approaches 0x300, then increases again as it approaches 0x200. This constantly toggling inversion state just after the key-on event is what causes the initial state of the ATT bit to be overridden. [QUOTE] But as I said, it's not clear from this sample alone and I'd have to do more tests. I do know that a lot of the info you posted is correct, because I confirmed some of it myself a long time ago. But back then 44KHz was "the business", and I knew it wasn't good enough. I paid a lot of money for a true 96KHz card right before I lost all my equipment anyway :-/ [/QUOTE] If you're in the market for a new sound card, this is the one I use for my tests: http://www.emu.com/products/product.asp?product=9872 It's got the best ADC of any card on the market, at least that I've seen. You can pick this card up on ebay for under $200USD. For my hardware tests, I do everything with a Tototek flash cart. When I need to sample digital data, I use test roms to dump data to RAM, and I use a Pro Action Replay to read the contents of the RAM on demand (use the trainer feature, "Slow but sure" mode, then "List possibilities"). [QUOTE] I'd love to be able to confirm all this stuff for myself, and see it we can't come up with a simpler or more logical way of implementing it. Not that it's complicated, just... odd. In my experience, odd usually means wrong, but I'm prepared to accept that in this case, it is probably just a strange piece of hardware hackery. Would like to be sure, though, because that's just "how I roll" [IMG ./images/smilies/icon_wink.gif] [/QUOTE] I understand exactly what you mean. I'm definitely interested in hearing about any simplified, more logical implementations. Personally, the think that irks me the most is the behaviour when the effective attack rate is 62 or 63. If it was just a matter of forcing the attenuation directly to 0 when the attack phase is entered with these rate values, well, that's one thing, but the "stalling" behaviour when changing to this rate during the attack phase bothers me. It just doesn't make any sense for that to occur. When I did the test, I expected to find that the attack curve would proceed with an increment value of 8. I'm sure I'm missing something there. [QUOTE] [edit] oh - while I'm here - a lot of games write to the upper 4 bits of the SSG-EG registers. I'm not sure what the programmers think they were doing this for, and I didn't test extensively, but I believe they don't do anything. Did you test this? [/QUOTE] I can quite confidently say they do absolutely nothing. Most of my test roms that iterated through patterns, including the test ROM I just posted, use an incrementing counter which allows the upper bits of the SSG-EG mode register to be set. I left some of these roms recording for a very long time (over a day once) to generate large blocks of reference data, and I never saw any change in behaviour based on what these upper bits would have been set to. I also did do some specific tests awhile back on forcing all the upper bits of the SSG-EG mode register to set, and it had no effect. ######## POST p8038 | Snake | 2009-02-27 | t386-435.html [QUOTE] Nemesis wrote:Ahh, but remember that the attenuation isn't moving past 0x200 during a repeating SSG-EG wave. [/QUOTE] Ah, this is what I meant, but I didn't explain it very well [IMG ./images/smilies/icon_smile.gif] I was assuming the attenuation starts at 0x3FF, and is decremented until it hits 0x200 - at which point it will immediately switch to decay, then immediately to sustain (provided the sustain level doesn't prevent that) - and then (almost) immediately back to attack. In this case, during the attack it inverts every sample. Values in the 0x201-0x3FF range inverted are still in the 0x201-0x3FF range, which is why I found it a bit odd to see what I was seeing, and for it to have no apparent change in amplitude. Also I was half asleep and can see the errors in this thinking now. [QUOTE] Nemesis wrote:what happens is the attenuation sits on 0x200 until the attack phase advances. [/QUOTE] Right. So the very first time after key on, it should look different. I'll check that again. [QUOTE] Nemesis wrote:One point where you do get an attenuation level over 0x200 being toggled each sample is when you first key-on an SSG-EG envelope with an attack rate less than 0x1F, if the current attenuation level is over 0x200 that is. [/QUOTE] Ah, I see we are actually on the same page [IMG ./images/smilies/icon_smile.gif] As for sound cards and tototek flash cards - I'm pretty stuck at the moment. Don't have anything with PCI slots nor anything with a parallel port, so I need to find something decent in USB flavour. [QUOTE] Nemesis wrote:I can quite confidently say they do absolutely nothing. [/QUOTE] Exactly what I thought, thanks. ######## POST p8040 | Nemesis | 2009-02-27 | t386-435.html [QUOTE] As for sound cards and tototek flash cards - I'm pretty stuck at the moment. Don't have anything with PCI slots nor anything with a parallel port, so I need to find something decent in USB flavour. [/QUOTE] Ouch. Yeah, that cuts down the options somewhat. Personally, I use an old crappy P4 box for all this stuff. I do most of my work on my laptop, and just use the test rig to transfer ROM data to the flashcart, or capture audio/video from the console. I think that's the best way to go. If you don't have an old PC lying around, you could pick one up really cheap if you look in the right place. ######## POST p8045 | Eke | 2009-02-27 | t386-435.html [QUOTE] I can see one thing that might be a problem, if I'm following your code correctly. When SSG-EG is active and the envelope is in the release phase, the attenuation level is still forced directly to 0x3FF when the release phase reaches 0x200. It looks like you're excluding all SSG-EG update steps when release phase is active, which would also exclude this behaviour. [/QUOTE] well, the attenuation level is forced to max during EG update and I considered that, in RELEASE phase, once the attenuation level has reached 0x200 and been forced to max, there is no need to check for SSG-EG update anymore until next KEY ON event... see, in advance_eg_channel, I have this: [CODE BLOCK WITHHELD: 151 chars] The use of EG_OFF state permits to avoid unecessary EG updates checking since the only way the EG output could change anymore after that is to issue a KEY ON. However, to be more corect, I should also force the attenuation level as soon as KEY OFF occurs, in case the attenuation level is already above 0x200... there are some cases where this could happen, especially when an attack phase is programmed. thanks for looking PS: that's make me think to another "extreme" case What would happen if a fast KEY-OFF / KEY ON occurs at the very start of the Decay phase(or Substain Phase with SL=0) , before any EG update have occur, so attenuation level is still 0 ? Doesn't that mean that the EG will immediately restart in the decay phase (or substain if SL =0) ? ######## POST p8049 | Snake | 2009-02-27 | t386-435.html [QUOTE] Nemesis wrote:Personally, the think that irks me the most is the behaviour when the effective attack rate is 62 or 63. If it was just a matter of forcing the attenuation directly to 0 when the attack phase is entered with these rate values, well, that's one thing, but the "stalling" behaviour when changing to this rate during the attack phase bothers me. It just doesn't make any sense for that to occur. [/QUOTE] I think that the attack phase simply doesn't happen at all when the rate is >=62, it's just skipped over. So when you force it to stay inside the attack state with a rate of 62, by modifying registers afterwards, it just does nothing, and has no way of getting out of the attack state. The table used for the envelope timings is undoubtedly stored in a small 4-bit ROM, and will be shared for A/D/S/R. But it never goes higher than 8, which means an immediate attack is impossible. An immediate attack is also desirable, even forgetting for a moment SSG-EG and CSM. It would have been awkward to implement for a few reasons - you'd need a seperate attack table to do this without also changing the D/S/R settings, and you'd need an extra bit in the table. Much easier to just special case it. ######## POST p8403 | vedge | 2009-04-02 | t386-435.html Hi Guys New here (but not new to FM hardware hacking). Ive been doing lots of research, and maybe this is new to you http://www7.plala.or.jp/kikekike/fm/YM3438_APL.pdf Now, this is another PDF that requires translation [IMG ./images/smilies/icon_smile.gif] Kind of awesome since thats the CMOS version of the 2612! Even in Japanese, this will help me finish up my HW 2612 VGM/MIDI synth with amplifyer output setting. ######## POST p8406 | Nemesis | 2009-04-02 | t386-435.html Holy crap! How long has that been online? I looked really hard for documentation on these chips, including the YM3438, and never came across this file. Thank you for posting this link, it's a major find. Well, this is quite simply exactly what I was after at the start. The YM3438 is the YM2612 for all intensive purposes. I've just taken a look through the file, and most of what this document contains is also covered in the YM2608 document (as expected), but this document still contains valuble information which we haven't got. For one thing, it confirms what Steve suspected; they've removed the accumulator. It also formally identifies pin 10 as the TEST pin, shows the difference in the CH3 mode flags between the YM2608 and the YM3438, gives us busy flag timing information, and gives us a description of the CH6 DAC mode. I'll start a translation of this document the same way I did the YM2608 document. Thank you again for sharing this. ######## POST p8407 | Snake | 2009-04-02 | t386-435.html [QUOTE] vedge wrote:Now, this is another PDF that requires translation [IMG ./images/smilies/icon_smile.gif] Kind of awesome since thats the CMOS version of the 2612! [/QUOTE] I don't know if this document will tell us anything we didn't already know, but it does indeed appear to be hardware and software 100% identical to the YM2612. So this is a very nice thing to have, regardless. Thanks [IMG ./images/smilies/icon_smile.gif] It does confirm the 9 bit DAC which I've been saying since the dawn of time, though. [edit] heh - Nemesis beat me to reply and seems to have noticed other nice little bits of info. Get to that translation, kind sir [IMG ./images/smilies/icon_smile.gif] ######## POST p8408 | vedge | 2009-04-03 | t386-435.html Hi Guys Was quite lucky and surprised to find it.. Just google imaged "ym3438" and that pdf was at the bottom of a page that contained a nice picture of a 3438 on a board. Just a few days ago i read through this whole thread with great interest. Cant wait for your translation magic. Cheers EDIT, btw for completeness, theres another document (hidden in the underneath directory structure) http://www7.plala.or.jp/kikekike/fm/YM3438_Cat.pdf ######## POST p8447 | Paul Jensen | 2009-04-06 | t386-435.html Hi everybody. Some of you might remember me as the author of (the not updated for a long, long time) GYM2MID and VGM2MID. Anyway, I'm very interested in this new documentation about the YM3438. I've skimmed through the latest PDF, and have a little input on the matter, mostly in the way of translation. It's too bad the scan quality isn't higher. Makes OCR pretty difficult. [IMG ./images/smilies/icon_wink.gif] [QUOTE] Nemesis wrote:For one thing, it confirms what Steve suspected; they've removed the accumulator. [/QUOTE] Are you sure about this? An accumulator is mentioned on page 33 (page 35 of the PDF): "The accumulator totals up the (9-bit) output sent to each slot of each channel one at a time and sends it to the D/A converter. Therefore, no special attention is required in terms of sound creation." I don't know if this is already common knowledge, but the document also mentions some sort of overflow protection for rate calculation (page 28 of the document, page 30 of the PDF): "'Rate' has a maximum value of 63. When a calculated value is higher than 63, the value becomes 63." "Rate" = 2R (for example, the attack rate) * Rks (the key-scaling value). Cool stuff, everybody. This thread is satisfying a lot of my long-standing curiosity with the YM2612. [IMG ./images/smilies/icon_smile.gif] ######## POST p8469 | Snake | 2009-04-07 | t386-435.html This is probably an error copied over from some other document. A lot of the documentation was probably copied then edited where necessary, same is probably true of most of Yamaha documentation, given the huge similarities with a lot of their chips. But we know this stuff in the YM2612 works differently from other Yamaha chips. The Rate thing was mentioned early on in the thread, and was well known way before that [IMG ./images/smilies/icon_smile.gif] ######## POST p8494 | Lord Nightmare | 2009-04-12 | t386-450.html YM2612/YM3438 are not the only chips which do time-multiplexing of the output channels rather than using a 'real' accumulator to mix them (the 3438 DOES use multiplexing, right?): The YM2413 OPLL and the Konami VRC7 (which is a reduced-ym2413-on-a-famicom-mapper-chip, almost certainly manufactured by yamaha for konami) both do it too. Other 'internal use only' chips such as the YM3427 (a vastly-reduced-pin-count SSG-plus-extras, possibly AY-3-8930 (yes, 8930, not 8910) compatible, chip used on the PSS-80 keyboard) may do so as well. LN ######## POST p8556 | GManiac | 2009-04-19 | t386-450.html I made some tests to get amplitude-frequency characteristic of console's sound and then I remember one strange thing (see below) and made one more test. Here are sources and binaries (2.5 kb) For getting AFC I firstly wrote demo ym_67.asm (octave 6, multiplier 7), which makes frequencies up to 23080 Hz, but AFC looked unnaturaly in 48 kHz oscillogram (because it can't handle 23 kHz sinus and more high frequencies absent), then I made ym_77.asm (octave 7, multiplier 7) - for 46161 Hz. This is 96 kHz oscillogram from my European MD1: [IMG http://shedevr.org.ru/ghost/ym2612/md1_eur_46160_osci_6621.png] You can see that the more high frequency the more it's filtered. But that's not all. Long ago I noticed that YM doesn't produce pure sinus, it produces multiple harmonics of it. If you play frequency F, you will also get frequencies 2F, 3F and so on. Maybe you noticed this fact too. Also when I recorded tunes from HW at 96 kHz I noticed that the high part of spectrum (40+ kHz) is sort of mirror of its low part. It's not bug of my ADC because it records high freqs correctly (for example, 37 kHz from PSG). Here's spectrogram of previous sweep: [IMG http://shedevr.org.ru/ghost/ym2612/md1_eur_46160_spec.jpg] This is interesting sight [IMG ./images/smilies/icon_smile.gif] You see multiple harmonics of every frequencies (they look like the web) and you see freqs' reflection. Our main harmonic and its reflection cross at point of 26390 Hz. On the left side at the top there is corner made by two lines. Its frequency is 48 kHz and its reflection is at 4780 Hz. And on the right side main harmonic is 46160 Hz (our program produced it) and its reflection is 6620 Hz. If we sum main and "mirror" frequencies, we will get 52780 Hz - it's base frequency of YM. To the left of that "corner" there is phantom of low frequencies. It starts from 43220 Hz, that is 96000 - 52780. I dunno what causes this phantom, but it's present. This reflection certainly is not result of my ADC, you may see that after 26390 Hz (point of crossing) "main harmonic" become more weak than its reflection and sound sweeps to low freqs. It can be heard right in headphones. So, for YM it doesn't matter, do you generate freq X or (MAX-X) (MAX = 52781 or 53267), result will be the same. At first pic you can see red line showing one volume level. At the right there is 46160 Hz (final freq of our program) and at the left is... 6620 Hz! One more pic to show multiple harmonics: [IMG http://shedevr.org.ru/ghost/ym2612/1000Hz_96.png] You see that after 5th repetition even harmonics are more weak than odd ones. And then, 13 is weaker than 11 and 15, 19 is weaker than 17 and 21 and so on. At the right side you may see 3 kHz and low reflections of its repetitions: 1780 (52780 - 3000*17), 7780, 13780, 19780... Why YM can't generate pure sinus, what's the reason of multiple harmonics and what causes this reflection? Can anyone provide recording at 192+ kHz or its spectrogram?