Re: Fwd: [hatari-devel] Improved YM2149 cycle accuracy

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


Le 28/07/2021 à 07:03, David Savinkoff a écrit :
---------- Forwarded message ---------
From: David Savinkoff
Date: Tue, Jul 27, 2021 at 4:57 PM
Subject: Re: [hatari-devel] Improved YM2149 cycle accuracy
To: Nicolas Pomarède <npomarede@xxxxxxxxxxxx>


On Tue, Jul 27, 2021 at 6:01 AM Nicolas Pomarède wrote:

Hi

As for YM2149_Next_Resample_Nearest(), I don't think it will give the
best result...

see EDIT (below)
I was thinking about antialiasing filters, and came up with two:
1) Running average filter (very cpu efficient)
     The filter length must always be an odd number of samples.
     The middle sample is added in twice. Best to get a running sum
      then add the middle sample, then divide by the number of samples,
      then use the sample. The running sum is always updated at 250 KHz
      by adding in a new sample, and subtracting the oldest sample.
      I would make the running sum length = 250000*3/44100
      Adding in the middle sample and averaging is done every 250000/44100
      samples so that the output is decimated to 44100 Hz.
      EDIT: Maybe this one will take experimentation to find what sounds best.


Hi

isn't that similar to what YM2149_Next_Resample_Weighted_Average_N() does ? It does a weighted average of the input sample to create one output sample (for example 5.66 input samples when going from 250 kHz to 44.1 kHz).
What would be the advantage of this running sum quality wise ?

2) Fourth order IIR Chebyshev, Low pass filter at 16KHz with
     1.5dB passband ripple. This filter uses two biquads and runs at 250KHz.
     Regular 32 bit float math so that the compiler can take advantage of SSE
     instructions.
     Output samples are taken every 250000/44100 samples so that the output
     is decimated to 44100 Hz.
     EDIT: 0.5% passband ripple, not 1.5dB.
See www.dspguide.com

This would certainly be more correct than the simple average in YM2149_Next_Resample_Weighted_Average_N() but at the cost of more CPU.

Eventually Hatari should have a way to select the downsample method with various choice taking more or less CPU, but that would require to write some part of the code (when mixing YM2149 at 250kHz with STE/Falcon DMA sound at other freq) and also to have several tested filtering methods to choose from.

Nicolas



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