Hey, I just thought of a way to silence the triangle channel using $4015 without having trouble with the DMC. That's pretty simple:
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.
- 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.