Silencing the triangle channel with $4015

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Silencing the triangle channel with $4015
by on (#134037)
Hey, I just thought of a way to silence the triangle channel using $4015 without having trouble with the DMC. That's pretty simple:

  • After you start a (non-looped) DPCM sample, write 0 to $4013 and optionally write to $4012 the sample "address" of a silent byte ($55 or $AA);
  • Silence the triangle channel with a read/clear bit 2/write to $4015.

Note that only the 1 -> 0 transition of $4015.4 can be asynchronous. So between the read/write of $4015, $4015 might get clear by hardware then set by our write, triggering a sample start; but because we wrote 0 to $4013, it will only play a 1-byte sample that will go unnoticed. Furthermore, even at the slowest rate, the sample will finish much quickly than a frame, so the 1-byte sample will play 0 or 1 times, never more.
Re: Silencing the triangle channel with $4015
by on (#135491)
Interesting way to deal with that edge case.

I've always preferred to silence the triangle by loading the length counter with 0. It has a 1/4 frame delay, I guess, but I've never found that unacceptable and it completely obviates this issue. (Also lets me use $4015 bits for a global silence control.)


Alternatively you can set it to the highest frequency as a form of silence, but this tends to make a more prominent pop than the regular halt, I find, and also may cause aliasing instead of silence on emulators that don't hack the high frequency triangle to silent.