Using DMC as a fader/envelope for tri: questions.

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Using DMC as a fader/envelope for tri: questions.
by on (#217651)
The things i understand:
-A value of $7F written to DMC will lower the volume of the tri channel (and noise channel).
-A value of $00 will raise it back up.
-This can be used as either/both a volume fader for the tri (and noise) channels, or/and a rudimentary envelope generator for the same.
-Playing such a value will causes a woodpecker-like sound because of the sudden change.

What i have trouble with getting right:
-While sometimes it just *might* be a nice percussive addition to have the popping sound of a single $00 or $7F, are there any practical way to make these volume changes noiseless? I tried a scale like this: 3F 48 4F 58 5F 68 6F 78 7F, and maybe going back- which is a thinner woodpecking sound and the decrease of volume by one, um, unit, but it is still very audible. I could do it finer/longer, but will loose the ability to make reasonably fast-decaying envelopes that way, and the sample gets bigger. It becomes a goldilocks problem.

Questions:
-Do you have any suggestions for a good compromise?
-Am i missing something important?
-a pop-softening ladder leading back to $3F doesn't seem change it for the better. Am i wrong in assuming it should start and go back to $3F?
Re: Using DMC as a fader/envelope for tri: questions.
by on (#217652)
The last time I saw discussion of this, I saw people used DPCM samples to generate ramps to adjust the current position. This let them choose quiet tones that were enharmonic with the current chord during the ramp instead of sudden pops.

The volume of such a ramp should be very roughly equal to 0.5 on the pulse channels' volume scale.
Re: Using DMC as a fader/envelope for tri: questions.
by on (#217657)
Here's an example of that:
http://rainwarrior.ca/music/goose.ftm

At the beginning of the tune I play a ramp DPCM sample at a pitch where the playback samplerate sounds a little sqeak of a "D" which is covered by the harmony already in play. There's two other points where I do the same to transition back and forth at other pitches, again covered by the harmony it's adjacent to.
Re: Using DMC as a fader/envelope for tri: questions.
by on (#217709)
Thanks for the example! In it, your ramp_60 file contains 10 * $57:s + 7 * $77:s. Were these chosen deliberately, and how/why? (I suspect i'm missing something here).


A bit about other methods i've tried:
Directly writing to $4011 (or using the z effect in famitracker to try it out), it seems i can get smooth results as long as i either

a)increment or decrement the delta counter by 1 at at a time in long series (at 60hz that creates a moderately paced, smooth fadein/fadeout, see attached file for the whole range faded). This isn't very pragmatic when using the z effect in famitracker (a long ramp sample might be better), but an automated fade-to effect is conceivable, on the other hand, plastered onto an engine. What little 'vinyl crackle' there is isn't bothering me. Especially if this was used in an actual composition and not just a lone tone. It also causes a bit of a shimmer to the bass (most notable in octaves 1 to 2) that could be used as an effect without too much noticeable volume change if you loop a more shallow selection of entries.

or

b) increment/decrement it by no more than ~$10 in one-offs between patterns. These are relatively easy to hide in the overall sound. A difference of no more than ~$20 seems to be convenient enough just sometimes (preferrably if there's noisy percussion). This seems to be just enough for when the tri channel goes up into the octave that is bordering on sounding shrill in one of my songs, but i assume mileage will vary.
Re: Using DMC as a fader/envelope for tri: questions.
by on (#217741)
FrankenGraphics wrote:
Thanks for the example! In it, your ramp_60 file contains 10 * $57:s + 7 * $77:s. Were these chosen deliberately, and how/why? (I suspect i'm missing something here).

In each case the ramp was sample was created to increase or decrease the counter by a specific number. Since samples are required to be specific lengths in increments of 128 samples (bits), if you want a value besides 0 or $7F you have to balance 1s with 0s past the target counter value. A $5 nybble is a balanced 0101, a $7 nybble is a "slow" ramp up of 0111.

So 10 x $5 is +0, and 24 x $7 is +48. DPCM is actually a 2x increment/decrement per bit, so +48 is really +96 = +$60.

That said, this piece was also specifically for a Famitracker demo compo. If I was writing for VRC6 or even a real NES I doubt I'd be so fussy as to distinguish between $60 and $7F. There's just not enough fidelity there. This was really about making it sound the way I wanted in Famitracker.

FrankenGraphics wrote:
a)increment or decrement the delta counter by 1 at at a time in long series (at 60hz that creates a moderately paced, smooth fadein/fadeout, see attached file for the whole range faded). This isn't very pragmatic when using the z effect in famitracker (a long ramp sample might be better), but an automated fade-to effect is conceivable, on the other hand, plastered onto an engine. What little 'vinyl crackle' there is isn't bothering me. Especially if this was used in an actual composition and not just a lone tone. It also causes a bit of a shimmer to the bass (most notable in octaves 1 to 2) that could be used as an effect without too much noticeable volume change if you loop a more shallow selection of entries.

This is the Super Mario Bros. method, and also StarTropics does something similar, I think.

I would say in the original hardware, the resulting 60Hz buzz is quiet enough to blend in with existing crosstalk from the PPU, and the other baseline buzz from updating volume registers at this rate, in general. Not quite so in emulation, but TBQH I never noticed it until I knew where to look (e.g. fade from $00 to $48 during the start of the overworld theme).

SMB uses it as a per-song setting, that begins to slide to that value as soon as the new song plays (e.g. when you touch the flagpole). StarTropics does it as part of a generic fadeout it attempts across all channels before starting the next song. The other channels have explicit volume controls, but a partial triangle fade is accomplished this way at the same time. I think the buzz in this case is a lot more noticeable, but still easy to ignore.