Open bootsector opened 1 year ago
I can confirm the high-pitched whine in After Burner II. I tried all of the filter settings, but it exists even with no filter.
Perhaps this is a Nuked MD bug?
Reverting Megadrive Test 2
might help. @sorgelig
Need to be more specific how it's loud. Twice louder?
As far as i know, different models have different volumes
I think it is better if someone can provide mdfourier result from the new core vs original hardware. @Ace9921 can probably help out here
As far as i know, different models have different volumes
Yes Model 2 consoles have a blown out distorted volume.
Ace's comparison and comments are specifically about the Model 1 filter, as compared to a Model 1 VA3 Genesis console.
Looks like PSG is about 2 decibels louder than FM currently, so it would need to be about 63% of current volume, if I did my math right.
Can he compare volume with "No Filter" option? It's possible that PSG pre-filter may amplify a little.
Tried with the filter off using both the YM2612 and YM3438, makes no difference.
YM2612:
YM3438:
This is being compared against the VA3 Genesis model 1 again. Of course, now, the frequency response doesn't match on the upper frequency range since the hardware has a low-pass filter in its analog path.
According to @nukeykt tests, MiSTer core sounds very close to a Model 1 VA0, maybe sounding a tiny bit louder on the MiSTer.
I will finish with some additional mappers and will back to this issue. As i understood i need to lower PSG by 2db.
As for whistle: Genesis core detects PCM playback on PSG and do a shortcut with samples. This makes very clean audio but it doesn't work as original HW. In MD core it works like HW. But HW has some filters applied naturally and artificially while FPGA does only digital part. So it needs additional filter to be applied.
I can add filter if someone will tell me which one is needed. Also i've noticed old filters used in Genesis core don't work well but i'm not sure about parameters. I've used comments to generate same filters using MiSTer's IIR filter, but filtering result is different. May be comments in Genesis filter are outdated.
That makes sense, thanks for clarifying
Try latest changes in PSG
MegaDrive_20230904.zip Here's an RBF with the latest changes
Model 1 Filter, YM2612 with latest changes.
Looks like PSG is too quiet now
Not sure why this would be as the audio rebalance change looks right to me. Maybe I am not reading the graphs correctly?
Working on this by making changes to the PSG amplification and then testing in MDFourier. I'll post my changes when I'm finished
Made the change in #9
one thing I do notice is the psg filtering seems more aggressive than the one used in a real system, that’s why there’s a difference in the yellow line on the right.
Probably PSG pre-filter need to be changed. I've used 8KHz to workaround that whistle in afterburner II.
Latest changes are very close, PSG is still a little bit low.
You can try to increase the value further till it will match.
MegaDrive_20230907.zip Just submitted a pull request with a PSG volume change, here's an RBF
Volume looks spot on! Thanks @birdybro for teaching me how to read this. And thanks @MP2E for looking into this. Now we just need to resolve that dropping yellow line at the end 🤔
That was part of the temporary workaround from sorgelig, an 8khz filter. The whistling is still there but probably most people can't hear it anymore as above 20khz people struggle to hear anything.
Need to understand the nature of that whistling. Then see how we can fix it.
@sorgelig can you please remove the 8khz filter you added for silencing the whistle so we can see how MDFourier will plot the graph for higher frequencies? That falling yellow line at the end is the bigger problem, I think.
if you choose "no filter" then that 8khz filter will be off too. I don't want to remove it till proper filtering will be used. But you can remove it in your own build for test purpose - it's very easy to do.
Root cause thanks to advice from @nukeykt and a little bit of my own research for a couple weeks:
PSG sample rate = 223722Hz (In After Burner II) SMS FM sample rate = 49715Hz FM synth sample rate = 53267Hz
When these are all shoved together into the genesis_lpf module without any true pre-filtering, the Gibbs phenomenon combined with the fact that decimation will bring down frequencies that are normally not able to be heard by humans down into the human-hearable range, this likely creates the ringing/whistling artifact.
I think the only way to solve this is to pre-filter the PSG by interpolating first and then decimating in stages down to the FM synth sample rate, using a CIC-FIR filter. Then interpolating them together up to the sample rate of the MD master clock. Since the SMS FM synth is also included in this core and could match with the PSG, then it too should be interpolated and decimated to get it to the MD FM sample rate.
This is the same method that @jotego had done with his jt12_genmix module and accompanying modules. I found it hard to read what all of the code did because it's a very different code style than my own, so I refactored sort of what it did to learn about it.
The number of stages and the depth of these stages of each CIC filter step (either interpolation of decimation) will have to be adjusted to account for DC bias and gain, in order to prevent clipping/distortion.
I'm not an electrical engineer at all so the formulas to get the number of filters and stages I'll need were a bit over my head. Maybe @ghogan42 has some advice, but no pressure, I know you're busy. :)
WIP draft PR here --> https://github.com/MiSTer-devel/MegaDrive_MiSTer/pull/19
After Burner II PSG background noise sample from nukeykt at the original sample rate from his software simulator --> ab2.zip - Might be useful for simulation models.
Birdy, great work! Thanks for looking into this.
Speaking of audio, something I just noticed both on the original Genesis core and the new Megadrive core is that there is a noticeable clicking sound when you switch between YM2612 and 3438 sound chips in the menu. It is easily heard when you just start the core without a game running. Not sure if this is already known, but thought it would be worth pointing out.
One click when you switch between chips?
I've had this happen before in the Genesis core prior. It's game-dependent in my experience. Probably not a concern.
PSG sample rate = 223722Hz (In After Burner II)
This is very variable for PCM, and as a PSG it has no sampling rate.
Yes, the PSG sound that isn't PCM is TDM, which doesn't really have a set sample rate since it's multiple controlled instruments without a target set output rate.
The sample rate for AB2's PCM is coming from the PSG wire input from the core is what I mean when I say PSG, sorry. The PCM from AB2 is taking advantage of the attenuation registers by rapidly switching them on and off, treating the PSG like a 1-bit DAC.
Yeah, i know PCM is coming from PSG. Other games doing similar trick may have different sampling rate.
well, it's possible to add an option to have similar PCM trick as it was done in Genesis core. Not sure what else you mean by modifying ym7101.
From Discord:
https://cdn.discordapp.com/attachments/1096614378968727652/1147379997313613935/DA__ALL_AVG_A-MD1UTVA3-M192_vs_NukedMD_96KHz_0000.png