SameBoy icon indicating copy to clipboard operation
SameBoy copied to clipboard

Attenuated treble on DMG

Open jkotlinski opened this issue 3 years ago • 8 comments

When comparing an ad hoc white noise signal played back through wave channel, I found SameBoy 0.13.6 remarkably close to a real DMG A/B/C. While the digital signal generation seems impeccable, I found a difference in high-end of the spectrum, giving real hardware an edge due to a sharper, crisper and ultimately more satisfying sound. The difference is confirmed by spectral analysis, which shows that Sameboy audio above 8 kHz is attenuated by a few dB.

Test files: noise.zip

Spectrogram

The image shows two superimposed signals. Red = DMG, purple = SameBoy 0.13.6. It can be seen that DMG signal is 1-2 dB louder above 8 kHz.

overlay

jkotlinski avatar Feb 25 '21 17:02 jkotlinski

After inspecting the code, it feels plausible that this error is introduced when downsampling APU output to 48 kHz.

jkotlinski avatar Mar 01 '21 10:03 jkotlinski

As a sanity check, I made the same comparison with Gambatte (configured to use Highest Quality FIR downsampler). Here, there is no serious roll-off until 17 kHz. I think the difference is audible and Gambatte certainly sounds closer to the real thing.

gambatteoverlay

gambatte.wav.zip

jkotlinski avatar Mar 02 '21 11:03 jkotlinski

Could also be different high-pass-filter constants as well as the lack of a low pass filter in SameBoy.

LIJI32 avatar Mar 02 '21 17:03 LIJI32

Maybe Blip Buffer could be incorporated for the resampling?

IMO this would be the last hurdle for 100% audio emulation.

jkotlinski avatar Apr 10 '21 19:04 jkotlinski

I investigated further. In the samples attached in this message, it looks like most of the difference is from wave refresh audio spikes being more pronounced on real DMG. So in this particular case, Sameboy is "too good" :) which is maybe not a disaster.

808.zip

jkotlinski avatar Apr 15 '21 06:04 jkotlinski

As a summary, my analysis now is that the DC blocker emulation is a bit off. Sometimes it sounds better, sometimes it sounds worse.

You can choose for yourself, if it is something worth fixing :-)

jkotlinski avatar Apr 15 '21 20:04 jkotlinski

Definitely, the 808.zip comparison is clearly audible. How other emulators behave with this test?

lpla avatar Apr 20 '21 07:04 lpla

Gambatte is very close to Sameboy. BGB is different, also not so much like real hardware.

On Tue, 20 Apr 2021 at 09:17, Leopoldo Pla @.***> wrote:

Definitely, the 808.zip comparison is clearly audible. How other emulators behave with this test?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/LIJI32/SameBoy/issues/348#issuecomment-823038673, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAY34OYGBLI33PYTHLTWLZLTJUTA7ANCNFSM4YG5WMMQ .

jkotlinski avatar Apr 20 '21 09:04 jkotlinski