Re: [hatari-devel] New cycle exact YM2149 emulation

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


Le 19/11/2017 à 20:31, Nicolas Pomarède a écrit :
Le 19/11/2017 à 11:55, Eero Tamminen a écrit :
Hi,

On 06/18/2017 07:01 AM, David Savinkoff wrote:
----- Nicolas Pomarède wrote:

  From a few comparisons with my STF, I would say that Hatari result is a
little bit too attenuated and should be a little more "sharp", but not
as much as when turning filter off completely.

This patch changes filter coefficients for a sharper sound.
I can make more patches until the timbre is right.

Nicolas, David, was there any follow up for this?


I have a new ym2149 emulation ready, need to push it to main repo soon.

Hi

I just pushed the new YM2149 emulation code.

So far, no change in the coefficients were necessary (but maybe it will need adjustements later if someone reports diffrerences with real HW).

As for this new emulation, it now generates all the samples the YM2149 would output when running at 250 KHz ; the previous improved version only updated the YM2149 counters with a simulated 250 KHz freq, but the output samples were converted on the fly to the output freq (44.1 KHz by default).

This resulted in too much filtering and loss of high frequencies.

With the new method, all frequency in the input signal are kept (because we generate a signal at 250 KHz like the YM2149 would do).

The critic part is then do downsample this 250 KHz signal to the chosen output freq of 44.1 KHz. This can be much harder than it sounds, there're tons of very technical paper/thesis on how to do this accurately when the Nyquist criteria is not respected.

Also, there's no miracle, if input signal is 250 KHz and output freq is 44.1 KHz, then some harmonics will be lost.

Still, I added 2 downsampling methods (more to come later) :
- a very simple one taking the nearest sample ; it's fast, but not very accurate for high frequency.
 - a more efficient one using a weighted average of the 2 input samples

The latest is the default method in Hatari for now (this is not user configurable at the moment, will see later, not sure it's useful)

CPU load should be a little higher with this new 250 KHz quality, but compared to the time to emulate CPU and video, I don't think the increase should be noticeable.

If you want to compare the improvements, you can run 2 versions of Hatari side by side playing the same music / demo (run Hatari 2.0 and compare with the latest devel version) ; pause the 1st, listen to the 2nd for a few seconds, then pause the 2nd and listen to the 1st one.

The difference should be hearable, especially with musics using volume modulation with MFP (so called SID sound effect). The result is a little less louder, high freq can be heard more distinctively.

Let me know what you think and if you find some musics that sound worse (hopefully not :) )

Nicolas











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