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

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


Le 16/06/2017 à 21:08, David Savinkoff a écrit :
Hi,

I just took a quick look at all of the few code changes (large research)
that make this big improvement. Excellent.


Thanks ; indeed, the longest part was not the coding in sound.c, because changes are rather small part of code in the end (the new emulation is even simpler as you don't have to simulate fractional steps).

But the longest part was writing some "sync lock" sound code to precisely change YM register on my STF and see how it affected the resulting sound wave. Quite a lot of combinations to check, but I'm happy some undocumented behaviours of the YM2149 are now better understood.

Once I have some proper recording of some musics / specific sound effects, I think your science of filtering will be much appreciated to try to match real YM2149 :)

By the way, for those interested in hearing "unfiltered" sound emulation, set YM2149_LPF_Filter=YM2149_LPF_FILTER_NONE and YM2149_HPF_Filter=YM2149_HPF_FILTER_NONE near line 300 in sound.c

The result will be much more "raw" to hear, but it's interesting to see the unfiltered square waves in a wav recording.

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.

Nicolas


----- Nicolas Pomarède wrote:
Hi

after extensive tests on my STF to measure as accurately as possible
some not well documented behaviours of the YM2149, I wrote a new
rendering for sound emulation.

The YM2149 works at 2 MHz, but all internal counters (tone, noise,
envelope) are handled using a 250 kHz clock.

By measuring my STF output, I could also confirm that all counters are
incremented from '0' up to 'period' (and no the opposite as stated in
Yamaha documentation)

The YM2149 emulation now does the same, all internal counters are
incremented 250000 per second and the resulting state is used to output
new audio data at the host frequency (for example 44.1 kHz)

This allows to accurately emulate some very specific tone transitions,
as well as some random "phase cancelling" effects (as reported by Troed
in some 7an musics), but overall it's safe to say that 95% or more of
all musics were already correctly emulated and will sound the same.

For now, the code in sound.c uses a "#define YM_250" to enable this new
rendering ; it can be commented to use the previous method in case some
regressions would be reported.

For now, I think this gives Hatari the most accurate YM2149 emulation of
all emulators :)

Next step will be to improve the filters, as it seems the sound is too
"attenuated" in many case. I will capture some real music wav recording
to be able to compare with Hatari output and see where and how it could
be improved.

Nicolas









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