AidanHockey5/MegaBlaster2

MDFourier results point to many improvement opportunities.

Closed this issue · 3 comments

Just want to start by saying I love the project and have been having a blast with it. Finally got in my SN76489AN chips (authentic pulls from Twisty Wrist Arcade). Thanks Aidan! This feedback is just to help the project, definitely not a complaint. Part of the reason I bought the board was because I wanted to get the MDFourier results. Hopefully these results help you with future firmware updates.

Summary

  • Noise channel has very large differences, very obvious upon listening to the MDFourier tone generator when it gets to the noise section. This might be unavoidable since the DCSG is different fundamentally than the one used in the real Sega Genesis (which was integrated into the VDP and modified very slightly).
  • Pitch is overall different.
  • 100Hz to 10kHz+ frequencies are more pronounced indicating a high pass filter (or potentially phase inversion?). This is less of an issue overall, since you probably weren't looking to simulate some specific Sega Genesis model's audio filtering. Also, it's more "transparently" representing these chips in a way, so it's kind of a good thing as a focus.

Graphs

image
All differences. Note bottom right pointing out pitch differences. When using -R command to adjust the sample rate to match though...

image
You can see that this throws off the comparison more, because now we are probably getting closer to per-sample frequency comparisons.

When compared to a MD1-VA6 without rate adjustment:
image
Things are much tighter but still a heavy high-pass filtering effect. Obviously this.

Then when compared to another original hardware sample to be thorough. This test is my recording off of my MD1-VA3's Headphone jack using the latest build of Deadfish's VGM Player ROM builder (https://mega.nz/file/BRYixB4Q#-yRrWiNo7WYILCeB2ZBq4gCpd8A_xi-So2zIj2lYvUE) which can disable the VDP to dramatically reduce noise floor (video is always unplugged physically for our tests, but the VDP still produces a lot of noise), compared against the MegaBlaster 2 sample. This is to further reduce the possible differences that can be accounted for in the frequency plot due to excess noise.
image
As you can see there is still a very heavy high-pass filter effect going on (or phase inversion?) on FM and SPSG. The pitch is still off by the same amount (1.82%).

Feel free to contact me if you'd like me to test nightly releases that you don't feel comfortable posting here or something like that.

kevinscoleman@protonmail.com

Tools Used

MegaBlaster 2 running v1.00 firmware release.

Motu M4 USB Audio Interface Line 1-2 input, balanced gain manually to 9'o clock position roughly.

https://www.retrodev.com/blastem/nightlies/blastem-win64-0.6.3-pre-1e7a63f0ccf4.zip - This is the version of BlastEm! used to log the VGM for the latest MDFourier test.

http://junkerhq.net/MDFourier/ - MDFourier for reference.

Files

MDFourier-1.21.vgm.zip - This is the VGM used for the test.

A-MD1UTVA3-M192-96khz-24b-2021.zip - This is the reference used, latest good 96kHz recording from Artemio Urbina.

MegaBlaster2_v1.00_96khz.flac.zip - This is the sample I took on my Motu M4 Interface at 96kHz/24-bit as I commonly do.

A-MD1UTVA3-M192-96khzxfl_vs_MegaBlaster2_v1.00_96khz.zip - Here are the results from MDFourier zipped up.

Hello!

Thank you for taking the time to do these sorts of measurements. I'll go ahead and address the discrepancies the best I can.

  1. Noise differences on the PSG: Yeah, this one is unavoidable. The discrete PSG simply has a different noise pattern than the one built into the VDP. No getting around that. This resource has visualizations of the noise differences.

  2. Could you define what you mean by pitch? The pitch of the YM2612 is directly dictated by the Si5351 clock-gen IC that is referenced to a 25MHz crystal. My measurements always landed me within a 1% margin of error for the clock. The Si5351's are extremely accurate clock synths, so I'd be comfortable ruling them out as the cause of this issue. Basically, the clock for the YM2612 is so close that you'd need a machine to notice any difference in pitch - it's imperceptible by humans.
    Timing, however, is likely more of an issue, though again, the accuracy differences are so minute that it's very unlikely to be noticeable on human time scales.
    My VGM driver is "time-lossy" in the sense that if the MCU is ever falling behind because it was blocked processing something else, or a VGM command is taking a while, it will rush through as many samples as it can to "catch up." This is most noticeable if you scroll through a menu while a VGM is playing. You can hear pronounced jumps in time as the driver catches up after being blocked by a screen draw. I'm limited on absolute time resolution since there's only so much resolution in an MCU's timer. A lot of time is spent just waiting for the chips to process their writes, so having 1:1 accuracy to an actual console is probably not possible with my driver. Again though, the time differences are so minute that it's simply not noticeable on human time scales, so I'm not too worried about it. There is around 60ms per minute of worth of time inaccuracy (0.1%), which is extremely tiny, but noticeable on machine time scales. It's just one of the quirks of dealing with the VGM format on embedded devices.

  3. The filtering differences don't really surprise me. The filters are indeed different and this was an intentional design decision. This is totally my own opinion, but I think the actual consoles have a really lackluster analog stage and sound pretty bad. The original Mega Blaster design tracked Sega's schematic pretty closely, at least for the mixing and preamp portion, and had pretty "meh" results, but this new design is based on the Kunoichi analog stage originally designed by @natarii
    I'll ping her and see if we can get some information from her perspective. Personally, I absolutely love the sound profile this analog stage design brings, so I don't think I'll be changing anything there.

Hopefully that gives you some insight on to these differences!

  1. Okey doke! I figured that was going to be the case. The VDP-based DCSG implementation is different after-all, has a different pitch. I heard this can be accounted for though. What you are saying basically mirrors @ValleyBell's comments to me in a discord channel when I inquired about it. The firmware can account for it somewhat, but then there may be other problems like noise artifacts as a result. Thanks for the insight!
  2. Yeah, if this is just a limitation of the hardware, obviously not a big deal. Just was curious to do this testing to see where it landed :) on the timing side of things. The best way to show you what I mean is probably from the verbose log in MDFourier when comparing the two (note this is 96kHz, not 44.1kHz, so adjust math accordingly, but the percentage difference will just be more detailed as a result):
* Loading 'Reference' audio file C:\MDFourier-Genesis-SegaCD-Recordings-14062020\Recordings-2020-06-14\A-MD1UTVA3-M192-96khz-24b-2021.flac
 - Decoding FLAC
 - Audio file is 96000Hz 24bits PCM Stereo and 61.41 seconds long
 - Sync pulse train: 
	   1.19694s [114906 samples]
	 to 59.6065s [5722227 samples]
 - Detected 59.9217 Hz video signal (16.6885ms per frame) from Audio file

* Loading 'Comparison' audio file C:\MDFourier-Genesis-SegaCD-Recordings-14062020\MegaBlaster2_v1.00_ym2612_02-28-2021\MegaBlaster2_v1.00_96khz.flac
 - Decoding FLAC
 - Audio file is 96000Hz 24bits PCM Stereo and 60.0005 seconds long
 - Sync pulse train: 
	   0.367031s [35235 samples]
	 to 58.8364s [5648299 samples]
 - WARNING: Comparison file framerate difference is 0.0175476 ms per frame.
 - Estimated sample rate is off: 96100.945076hz calculated from signal length
  The source might have a timing difference.
 - Expected 58408ms and got 58469.4ms (Difference is -61.4167ms/-3.68029 frames of 16.688ms/-5896 samples)
 - Pitch difference in cents: 1.81946
 - Detected 59.8604 Hz video signal (16.7055ms per frame) from Audio file

= Different frame rates found (0.0170923), compensating to 16.6885 =

So this just means it took this much longer --> (5896/96,000ths of a second) - to finish the tone generator VGM than original hardware does. Artemio Urbina (MDFourier project founder) just corrected me in chat, it's cents (music term - https://en.wikipedia.org/wiki/Cent_(music) ) not percent X_X sorry about that. So the difference is 100.10515112083333333333333333333% that's within the expected range you cited so that makes sense to be around 0.1% slower or so.
3. I agree I actually like the sound profile quite a bit since I can treat it as a starting point and filter it however I want in post :)

Awesome! Yeah, 2% pitch change would have totally been noticeable at human scale, so I was super confused on that bit. If it’s only a cent or so off, that’s pretty much to be expected since it’s well within margin of error. I’m going to go ahead and close this issue now, but thanks for the insight!