[hatari-devel] New cycle exact YM2149 emulation |
[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]
Hiafter 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/ |