(First off, hello it's been a long while since I posted here, and it's wild to see many of the same people still rolling along! Decided to pick up my NES emulator again after 10 years because I needed something to poke at in my spare time, and this is apparently the type of thing that I like to do for fun)
I spent a bunch of time trying to track down what I thought was a triangle channel linear counter emulation bug in the new APU that I'm writing, but I think it's actually a subtle music bug in Castlevania 2, but I can't actually verify on a real NES so I'm not sure.
What I *think* has happened is that CV2's linear counter, at least for the initial town music, was authored against frame counter mode 0, but the game actually initializes with mode 1. As a result, the length counters for the triangle notes are all just SLIGHTLY too long, and rather than having some rhythm to it, it turns into a bunch of long holds. Seems like it was clearly intended to have individual notes, and maybe they switched to mode 1 as a mistake or a last-minute change and didn't notice that this bassline got broken. Oops!
Basically, with mode 0 (i.e. "not what the cart clearly loads into $4017") you get a triangle channel that sounds like this: https://www.youtube.com/watch?v=H58lhgcc-nk
But with its actual mode 1, it instead sounds like this: https://www.youtube.com/watch?v=TaMP6l2UqLw
(note the held notes in the bass at the beginning).
The latter is definitely the behavior I see in both Mesen and Nintendulator (and my ancient emulator code that was using Blargg's awesome libraries, once I fixed it so that it actually sent writes to $4017 to the APU code instead of just not doing that, whoops). My new APU was doing it right, but I was comparing against my old code's output which was wrong. That's what I get for trusting code I wrote 10 years ago and assumed that the new code was wrong because, again, clearly authored to have pauses.
Anyway, has anyone else noticed this? Does this actually happen on a real NES or is there something weirder at play?
I spent a bunch of time trying to track down what I thought was a triangle channel linear counter emulation bug in the new APU that I'm writing, but I think it's actually a subtle music bug in Castlevania 2, but I can't actually verify on a real NES so I'm not sure.
What I *think* has happened is that CV2's linear counter, at least for the initial town music, was authored against frame counter mode 0, but the game actually initializes with mode 1. As a result, the length counters for the triangle notes are all just SLIGHTLY too long, and rather than having some rhythm to it, it turns into a bunch of long holds. Seems like it was clearly intended to have individual notes, and maybe they switched to mode 1 as a mistake or a last-minute change and didn't notice that this bassline got broken. Oops!
Basically, with mode 0 (i.e. "not what the cart clearly loads into $4017") you get a triangle channel that sounds like this: https://www.youtube.com/watch?v=H58lhgcc-nk
But with its actual mode 1, it instead sounds like this: https://www.youtube.com/watch?v=TaMP6l2UqLw
(note the held notes in the bass at the beginning).
The latter is definitely the behavior I see in both Mesen and Nintendulator (and my ancient emulator code that was using Blargg's awesome libraries, once I fixed it so that it actually sent writes to $4017 to the APU code instead of just not doing that, whoops). My new APU was doing it right, but I was comparing against my old code's output which was wrong. That's what I get for trusting code I wrote 10 years ago and assumed that the new code was wrong because, again, clearly authored to have pauses.
Anyway, has anyone else noticed this? Does this actually happen on a real NES or is there something weirder at play?