nesdev.com
http://forums.nesdev.com/

$4011 writes and DPCM together
http://forums.nesdev.com/viewtopic.php?f=6&t=14203
Page 1 of 1

Author:  za909 [ Mon May 09, 2016 11:01 am ]
Post subject:  $4011 writes and DPCM together

Hey, I have this little question, I would like to add a little extra punch to my percussion but since I'm already using the DMC for raster effects, the only thing I can think of is setting the level via $4011 and since I'm always playing 0 bits with the DMC, it would make a pop sound and then recover the level to 0. But wiki says that if the DMC is active and happens to change the level in the same cycle as you are trying to write to it, the level "doesn't change properly". But what does this mean? Does the $4011 not take effect at all, or is the DMC change ignored? (which would be fine in my case) Moreover, is there any way to fix this, other than doing my $4011 write in NMI, during which I always disable the DMC until the sprite 0 clear? This would delay the pop by about one frame and that's not what I really want.

Author:  thefox [ Mon May 09, 2016 11:32 am ]
Post subject:  Re: $4011 writes and DPCM together

blargg's apu_ref.txt is unambiguous:
Quote:
Writing to the DAC register ($4011) while a sample is playing sometimes has no
effect, probably because the DMC's output unit is clocking the counter at the
same moment as the write.

If you want to ensure that the write takes effect, probably you can enforce it by doing the write two times (since DMC channel updates are always at least ~50 CPU cycles apart, if the update happens to take over the first write, it should never take over the second one).

Author:  Dwedit [ Sun May 15, 2016 7:45 am ]
Post subject:  Re: $4011 writes and DPCM together

Also note that setting the sample value to an extreme makes DMC clip against the edges, so it won't sound very good. You need to set the sample value back to the middle to make DMC clip less.

Author:  Dwedit [ Sun May 15, 2016 10:54 am ]
Post subject:  Re: $4011 writes and DPCM together

Example song: One without DMC pops, and the other one with them. Bassline in DMC channel, percussion in Noise channel.

Attachments:
test_pops.ogg [67.47 KiB]
Downloaded 59 times
test_nopops.ogg [65.6 KiB]
Downloaded 57 times

Author:  Bregalad [ Sun May 15, 2016 1:18 pm ]
Post subject:  Re: $4011 writes and DPCM together

@dwedit : My understanding is that what you are telling has nothing to do with what he's doing. He's using DMC as a timer for raster effect, not to play any sound. He'd want to use $4011 just for popping sound, like Rad Racer II and Final Fantasy III, and that simultaneously. za909 correct me if I'm wrong.

Author:  za909 [ Mon May 16, 2016 10:24 am ]
Post subject:  Re: $4011 writes and DPCM together

Yes, that's exactly what I want to do. It's not as harsh though because the DMC gets the level back to zero a lot more smoothly and not another $4011 write. I could even do this and have some control over the APU2 volume by selecting to play either $00 bytes all the time or $FF and writing $3F to $4011 would always work regardless of the sample being played.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/