I've been making improvements to GGSound and was certain what I was seeing must have been a regression, only the way in which I make it happen can't possibly have anything to do with my NES code. Here's what I noticed:

-I play a song that is nothing but a drum loop on the noise channel and observe the perceived volume coming from my speakers, playing this song using ggsound from Nestopia.

-I click on the title bar of Nestopia in Windows and drag it, doesn't matter how far, and let go.

-Suddenly the audio is noticeably louder. I did not notice this occur on any other channels, and yet when I isolate just the noise channel using Nestopia's volume settings, I can't seem to reproduce the issue any longer.

I can't imagine simply dragging the emulator (which presumably would pause emulation) and observing different behavior could have anything to do with my NES code...

just wondered if anybody has noticed this with Nestopia or not. It's kinda subtle, and for all I know I'm hallucinating from coding too much this evening

*edit* I can also reproduce the sudden increase in volume by restarting the song, which would point back to my NES code. I'm wondering if there's some subtle setting in the APU I am neglecting which could affect the volume. I am not familiar with or understand the "sweep unit" that couldn't affect this, could it...?

*edit* Yet, I can't seem to make this happen in any other emulator.

Author:

lidnariq [ Wed Jan 24, 2018 8:34 pm ]

Post subject:

Re: Drag Nestopia window results in louder noise channel?

Any chance the problem you're encountering is that nestopia uniquely accurately emulates the DPCM DAC nonlinearity (accidental volume control) and other emulators don't?

(The nonlinearity not only changes the volume of the triangle channel but the noise channel also)

Author:

GradualGames [ Wed Jan 24, 2018 8:37 pm ]

Post subject:

Re: Drag Nestopia window results in louder noise channel?

lidnariq wrote:

Any chance the problem you're encountering is that nestopia uniquely accurately emulates the DPCM DAC nonlinearity (accidental volume control) and other emulators don't?

(The nonlinearity not only changes the volume of the triangle channel but the noise channel also)

That seems possible. I can make the problem happen when no DPCM samples are playing, however, though they would have played previously (one of the first tracks that plays as you advance towards this drum loop track would have played some DPCM samples).

Is there a way to control this behavior?

Author:

lidnariq [ Wed Jan 24, 2018 8:42 pm ]

Post subject:

Re: Drag Nestopia window results in louder noise channel?

If it is the DPCM+triangle+noise channel nonlinearity, you should be able to explicitly write to $4011 to set the volume.

This is making me suspect something odd with the emulator, potentially. All channels explicitly set their volume on every frame (I store their current channel state and upload it once per frame to the apu registers). Plus, this problem can happen just from dragging the window. I don't see how dragging the window would trigger NES quirk emulation behavior...

Author:

lidnariq [ Wed Jan 24, 2018 8:49 pm ]

Post subject:

Re: Drag Nestopia window results in louder noise channel?

I've noticed that recent builds of Nestopia (i.e. UE) have grown some weird bugs with audio, especially when interacting with save states, high speed, or rewinding.

No idea if that's related.

Also, writing to $4011 isn't the same "set the volume" that the pulse and noise channels have.

Author:

GradualGames [ Wed Jan 24, 2018 8:50 pm ]

Post subject:

Re: Drag Nestopia window results in louder noise channel?

Actually if anybody else wants to try the ggsound demo in Nestopia, advance to the last track (just hit up a bunch of times until you hear nothing but a looping drum track). You can restart the song by continuing to hit up. It sometimes suddenly gets loud just doing this. You can also try dragging the window and it'll get loud in that case too.

I know it's not a regression now because the demo linked there has none of the changes I've been working on this evening.

I forget which registers do what; just that all of their volume settings are uploaded once per frame.