mmitch / gbsplay

gameboy sound player
https://mmitch.github.io/gbsplay/
Other
98 stars 19 forks source link

noise channel not being played correctly in Castlevania 2's GBS #114

Closed ruby-R53 closed 4 months ago

ruby-R53 commented 5 months ago

especially on subtunes New Messiah (9) and Praying hands (10), rather than making noise, the noise channel produces a quiet clicking sound when retriggered multiple times quickly, and changing the sample rate and output types doesn't help

i'm not sure if it only happens on this specific file (konami's BGM-making software fault?) or if it happens on more tunes (emulation issue)

mmitch commented 5 months ago

Might be a problem with the GBS dump, but it might be us as well. We're investigating.

mrehkopf commented 5 months ago

Apparently there is a problem with switching between LFSR lengths for the noise channel. First tinkering yields favorable results but I need to make sure about the taps.

mrehkopf commented 5 months ago

Some background: The game seems to switch LFSR length without retriggering the channel, which causes our LFSR to run out of 1's. Only retriggering the channel will reload the LFSR with all 1's. The current implementation moves the taps of the LFSR according to the length bit in NR43, effectively creating variable width shift registers. However the actual Gameboy hardware does not seem to move the taps but insert an additional feedback bit at bit 6. (Source: https://gbdev.gg8.se/wiki/articles/Gameboy_sound_hardware#Noise_Channel)

ruby-R53 commented 5 months ago

that's interesting, good luck on fixing that!