Bank switching while DMC sound plays

Discuss NSF files, FamiTracker, MML tools, or anything else related to NES music.

Moderator: Moderators

Post Reply
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Bank switching while DMC sound plays

Post by dougeff »

Just curious...if a DMC sample is playing, and the bank it sits in is switched for a few hundred cycles and switched back...what would likely happen? Noise for 1/100th of a second? Would the sample stop?

I'm trying out an AxROM style mapper, and I think it would be a waste of space if I had to put the DMC samples on every bank.
nesdoug.com -- blog/tutorial on programming for the NES
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Bank switching while DMC sound plays

Post by lidnariq »

DMC fetches a new byte every 400 (PAL, maximum frequency) to 3424 (NTSC, maximum period) CPU cycles.

If the wrong bank is mapped when it fetches its byte, it'll just fetch the wrong byte.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Bank switching while DMC sound plays

Post by rainwarrior »

Usually the use pattern means the wrong bytes are being fetched at a regular interval (i.e. 60 Hz), which will likely manifest as a bit of a buzz at the interval frequency. The strength and timbre of this buzz would vary with how much of the interval is spent with the wrong samples playing.

Note also that the DPCM is only going to fetch a new byte every 400 cycles or so at worst, so if the time spent in the wrong bank is relatively small, you might not even catch a bad byte every frame.

Also, receiving "noise" DPCM is not nearly as strong an effect as it would be if it was PCM. The counter only gets a +2 or -2 per sample, so the relative amount of distortion you're getting for a single bad byte is fairly low.
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Bank switching while DMC sound plays

Post by dougeff »

I figured as much, but I hadn't thought about the 60 hz buzz. Thanks.
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
za909
Posts: 249
Joined: Fri Jan 24, 2014 9:05 am
Location: Mijn hart woont al in Nederland

Re: Bank switching while DMC sound plays

Post by za909 »

You might even find a use for the random noise that aries, or playing back code as DPCM. Unrolled PPU update code can usually produce some kind of limited wavetable-like tone.
Post Reply