I've run into an odd artifact in my sound engine, which only seems to be noticeable in certain situations. I've got a volume envelope in the square 1 channel that gradually increases in volume. During this song, a sound effect may play and overlay on the same square 1 channel with a different envelope, with different volume settings. Right now, it is overlaid directly, frame by frame, so when the sound effect ends, the music stream will supply where it would have been in its own envelope, potentially making a rude transition from one volume setting sharply to another. This results in an unpleasant "hiccup." And, I am certain this is not the effect described in MetalSlime's sound tutorial over on NA:
"Crackling Sounds: Writing to the 4th port of the Square channels ($4003/$4007) has the side effect of resetting the sequencer. If we write here too often, we will get a nasty crackling sound out of our Squares. This is not good."
I already followed his advice for preventing this effect when I upload all my apu register data. I think what I'm experiencing is purely due to abrupt shifting of the volume setting. If I'm right, it makes me wonder if others here who have written sound engines have any scheme to quickly interpolate volume values when overlaying sound effects, over a couple of frame perhaps---to smooth out this problem.
"Crackling Sounds: Writing to the 4th port of the Square channels ($4003/$4007) has the side effect of resetting the sequencer. If we write here too often, we will get a nasty crackling sound out of our Squares. This is not good."
I already followed his advice for preventing this effect when I upload all my apu register data. I think what I'm experiencing is purely due to abrupt shifting of the volume setting. If I'm right, it makes me wonder if others here who have written sound engines have any scheme to quickly interpolate volume values when overlaying sound effects, over a couple of frame perhaps---to smooth out this problem.