Re: [hatari-devel] Improved YM2149 cycle accuracy

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


[cc-ing hatari-devel, please respond to the ML not to me directly :) ]

Le 28/07/2021 à 18:05, David Savinkoff a écrit :
On Wed, Jul 28, 2021 at 6:26 AM Nicolas Pomarède wrote:

even if IIR convolves many samples, it does so only every 5.66 input
samples in the case of YM2149_Next_Resample_Nearest(), so you loose some
information between those 5.66 samples that can be meaningful when
period is <= 6.
Hopefully when period is <= 6, the filter has attenuated some of the
high frequency
so that it aliases less without filtering to much of the desirable frequencies.

I don't agree because YM2149_Next_Resample_Nearest() will only process one input sample every 5.66 samples. So these samples might be attenuated by the filter, but the skipped part (the rest of the 5.66 samples) will not be taken into account at all while it might contain valuable information. For sound period <= 6 I really think that YM2149_Next_Resample_Nearest() is not good enough, especially for per=0 or per=1, as used in several digi replay routines.



This might be OK when emulating YM2149 for sound having period>=6, but
with very high freq sound, this gives bad results.

IIRC this was hearable in the game Lethal Xcess in STF mode where they
play digi sound by setting period=0 on one voice and modulating volume
for this voice. In that case YM2149_Next_Resample_Weighted_Average_N()
gives much better result as it uses all samples from the 250kHz input
signal.

Nicolas

  From the snippet of code from sound.c below:
- LowPassFilter(sample); is supposed to sound like a ST or STF
- PWMaliasFilter (sample); is supposed to sound like a STE

          /* Apply low pass filter ? */
          if ( YM2149_LPF_Filter == YM2149_LPF_FILTER_LPF_STF )
              sample = LowPassFilter ( sample );
          else if ( YM2149_LPF_Filter == YM2149_LPF_FILTER_PWM )
              sample = PWMaliasFilter ( sample );

  From what you say... I suppose that PWMaliasFilter(sample); is ineffective
and can be removed.

I'm not sure it should be removed. There's this part in audio.c
OK

                  if ( Config_IsMachineST() && nAudioFrequency >= 40000 )
                          YM2149_LPF_Filter = YM2149_LPF_FILTER_LPF_STF;
                  else
                          YM2149_LPF_Filter = YM2149_LPF_FILTER_PWM;

so if PWMaliasFilter() is supposed to sound more like an STE, it should
be kept.
By all means (sometimes I have opposing ideas in quantum entangled states).

OK, keep the PW filter for STE.


However, LowPassFilter(sample); is supposed to give the charactistic ST
sound (less sharp). This is the same ST sound that everyone thought was OK
a few years ago. I'll calculate some sharper sounding coefficients soon.

I don't disagree, it's just that the change is hearable between hatari
2.3 and current devel version when I apply the patch you sent on 26/7/2021.
Maybe sound was too "sharp" before, I can't tell, some YM2149 musicians
could give their opinion on this compared to a real STF.

Maybe the existing antialiasing algorithms are filtering some of the audio
frequencies, and making the sound less sharp. The STE/STF filters could
be adjusted to compensate to some extent.

We could have some kind of bass/trebble filter inside Hatari's UI so everyone one could adapt the filter as he like. But that would not be on top of my TODO list for now ;)

Nicolas






Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/