Re: [hatari-devel] Preserving YM2149 sound phase |
[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]
Le 17/10/2016 à 23:46, David Savinkoff a écrit :
Hi Nicolas, The following was posted on Atari Forum, and was partially investigated: **** http://www.atari-forum.com/viewtopic.php?f=18&t=27521&sid=a0d1b43f0f66988900541b039ab5f6d4#p285292 "Postby troed » Sun Dec 20, 2015 10:20 pm Re: some questions about YM2149F vs emulators vs MIST There are several ways in which Hatari doesn't sound like an original machine. The first version of 7an's song for our STNICCC demo "Closure" had to be scrapped altogether. He wrote the song(s) in Hatari which apparently always plays all voices in phase, while on actual hardware they fall in and out of phase (sometimes cancelling each other out completely). This is somewhat better emulated by SC68." **** The enclosed patch tested ok on the few demos that I tried. Please see if it works for you. This patch preserves the value in posA, posB and posC rather than over-writing the value when stepA, stepB or stepC is zero. Thus reducing interference with the phase. stepA, stepB and/or stepC are no longer set to zero when a frequency is higher than the sampling rate, this affects phase also. I'm hoping this patch solves the phase problem. Sincerely, David Savinkoff
Hithanks for your patch ; I'm aware of the problem, but before applying any new patch, I'd like to do some "high frequency" recording of the analog YM output of my STF to carefully measure what happens exactly when PerLo/PerHi are changed, depending on which point of the square wave we're at the moment of the change.
Basically, this all depends on own the YM uses the PerLo/Hi value :- does it starts an internal counter from 0 and change phase when counter reaches Per ? - does it starts an internal counter from Per and decrement it and change phase when it reaches 0 - If so, does it change phase when reaching Per (or 0) or at the next iteration ?
I saw numerous implementations of the YM (or its derivative), each one claiming "compatibilty" with the original chip (fpga, vhdl, MAME, ...), but each one with a different way to count :( It seems the correct way is to start at 0 and change when reaching Per, but that's I want to measure (that's not how Hatari works at the moment, hence the problem)
To do so, I'm planning some very precise writes in the sound register (sync'ed with the video counter) to get a very reproducable test and to be able to change PerLo or PerHi at some exact point where the phase is supposed to change in the YM (or just after/before). Depending on whether each write will have an effect or not, I will be able to determine how the YM takes Per regs into account and if a change to them is immediate or not.
Nicolas
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |