The output should be almost identical so I suspect this to be a resampling problem.
Both games still have different sound output when removing external things like BIAS and even hardcoding the frequency.
It appears that halting causes the problem. A uses halting while B doesn't. Removing the halt state in A fixes the audio problems. Halting the CPU results in single runs of 960 cycles which cause the sample function in the APU to run twice sometimes. Although this shouldn't be a problem, it is. Splitting the run function into single parts fixes the issue.
Running 960 at once also ticks the sequencer 960 times. The square channel calculated it's values and this value is now samples twice with the intermediate step missing.
The Nintendo intro bleep (channel 1) is way worse compared to Golden Sun - The Lost Age.
Game A writes to channel 1:
Game B writes to channel 1:
The frequence is slightly different but the bad sound persists even when forcing the value to
0x54
.The written data results in the following sequence:
Game A:
Game B:
The output should be almost identical so I suspect this to be a resampling problem.
Both games still have different sound output when removing external things like BIAS and even hardcoding the frequency.
It appears that halting causes the problem. A uses halting while B doesn't. Removing the halt state in A fixes the audio problems. Halting the CPU results in single runs of 960 cycles which cause the
sample
function in the APU to run twice sometimes. Although this shouldn't be a problem, it is. Splitting the run function into single parts fixes the issue.Running 960 at once also ticks the sequencer 960 times. The square channel calculated it's values and this value is now samples twice with the intermediate step missing.