Brad:
At some point the sound emulation moved to a 250kHz model of the YM sound,
but was still applying the same lowpass filters which were written with
coefficients for 44100-48000 Hz. This means that the effect of the lowpass
filter is essentially disabled, as the cutoff frequency is now 5x too high,
and out of the range of human hearing.
David:
I noticed this years ago, looked at the problem and other changes and thought
about it. Nobody seemed to notice much so I let it slide. Partly because there
was some other thing that I wanted to investigate but didn't get feedback on
which I had let slide also. Maybe I need to use my own ears to hear the
differences between my Atari ST and Hatari.
Brad:
The fix is simple, move the relevant lowpass filter code in sound.c into
YM2149_NextSample_250 where they can apply at the output audio rate
instead. This restores the previous behaviour of these filters as intended.
David:
Good.
Note that if the sample rate down-converting method is not good, the
'asymmetric' filter may be better left at 250 KHz (new coefficients required).
Brad:
However, this brings me to a second suggestion. The two lowpass filters
provided have very poor quality, extremely distorted sound. This is due to
them applying asymmetrically with a hard break point in the middle.
David:
The two lowpass filters are not low quality and are not distorted, nor do
they look or sound distorted. They produce separate exponential decay curves
for rising and falling edges of the square wave they filter. Not everything
is frequency domain, some is time domain.
Brad:
I assume this is modeled on some version of STF circuitry,
David:
Yes.
-------extra-------------
The sound code before the changes used AC analysis with the DC component
for audible frequencies, and DC analysis only for high frequencies. High
frequencies thus didn't need to be AC filtered if they were not there.
Beyond all of this is Hatari must now convert 250 KHz samples to 44.1 KHz
and 48 KHz, possibly with selectable methods. I've been thinking about this
also. I guess the sound is in for another round.