Re: [hatari-devel] STe DMA sound

[ Thread Index | Date Index | More Archives ]

On 13/04/2018 at 21:19, Christian Zietz wrote:
There's clearly something wrong with Hatari.

Thanks for your support!

The attached Audacity screenshot shows what happens when I try to play a
sine-wave with the LMC1992 set to maximum treble boost (+12 dB).
For information, here is how to obtain the spectral analysis I have posted, with Audacity. The option is extremely good, but a bit hidden:

I also have a theory: The big peaks followed by some ripple look like the
step response of a high-pass filter. Effectively the treble boost *is* a
high-pass filter.
Ok, so we agree that the issue may come from the post-processing of emulated LMC1992 treble adjustment.

But why does it affect a sine wave? Easy:
Hatari first does the upsampling ("upscaling" as you called it),
introducing stair-like steps into the output signal.

On real hardware, there is no such stair-like steps (should be measured), otherwise we would hear some bogus high-pitched harmonics, just like when playing samples on the YM-2149. There is no such thing on the STe DMA: i.e. when playing 6 KHz samples, we can only hear low frequencies, high frequencies are cut by an appropriate low-pass filter.
So Hatari is already wrong here.
I would have expected that David's low pass filter, while forced, would address that issue, but it doesn't.

Only then it applies the emulated LMC1992 filters,
Probably a good thing. As I understand, the LMC1992 is an analogical component, so it makes sense to emulate it after full upsampling.

which will of course also act on the steps, introducing these ugly
That make sense.
Bad input results in even worse output.

Possible solutions: Either do the filtering on the original DMA sound signal
Might not be possible, due to too low frequency.

or upsample by smooth interpolation.

Exactly. Something like cubic upsampling would probably provide the best possible sound, without any artifact. Maybe not exactly the same sound as real hardware (difficult to measure), but having an option for best possible sound would definitely be good.

BTW, if my ears reminds well, the LMC1992 bass/treble settings also apply to the YM-2149 sound. So it makes sense to apply such filters/boost after full upsampling.

BTW2: I'm still surprised to hear LMC1992 emulation artifacts in Lethal Xcess. I would have bet that it uses default settings. In that case, the LMC1992 should not alter the sound at all. So, in case of current Hatari, we should see perfect square steps, not step artifacts.

Well, a bunch of things to test on real hardware for real accuracy...

Vincent Rivière

Mail converted by MHonArc 2.6.19+