Still not 100% clear, but the drums in SMB3 are DMC samples.
I was able to fit 32 DMC samples of OK quality into an NROM game (NEStalk), each about .25 seconds, that's about 8 seconds. A better mapping could fit 8x as much, for a total of 64 seconds at an OK sample rate. At the best sample rate, half that... So, about 30 seconds of high quality sound could fit in a normal game.
(Correct me if I'm wrong, guys).
My current method for DMC sound samples, is to get a MONO 44100 rate audio sample, cut it down to abou 0.2- 0.5 seconds, import it into Famitracker, and save it as a DMC file (which can be included into a the game code).
I find that DMC is much better at low to mid range frequencies, as the upper range is lost in DMC hum noise (artifacts of the DMC sample rate being in the audible spectrum). The highest sample rate has the least noticeable hum/noise.
Also, DMC sounds tend to be much quieter than other channels, which will have to be volumed down to balance this issue.
DMC is also the only way to get really low Bass notes.
PCM sound requirements?
Moderator: Moderators
Re: PCM sound requirements?
nesdoug.com -- blog/tutorial on programming for the NES
Re: PCM sound requirements?
DPCM = delta pulse code modulation
DMC = delta modulation channel
The DMC has a 7-bit "current value" register. Raw PCM playback feeds individual samples to this register. A program may also write once to this register before starting background playback of a DPCM sample, producing the pops common in Konami NSFs.
I've written tools to encode and decode DPCM in Python. This should give you an idea of exactly how it would sound. Are you capable of running Python programs on your computer? What operating system (Windows, Linux, or OS X) does your computer run?
DMC = delta modulation channel
The DMC has a 7-bit "current value" register. Raw PCM playback feeds individual samples to this register. A program may also write once to this register before starting background playback of a DPCM sample, producing the pops common in Konami NSFs.
I've written tools to encode and decode DPCM in Python. This should give you an idea of exactly how it would sound. Are you capable of running Python programs on your computer? What operating system (Windows, Linux, or OS X) does your computer run?
Re: PCM sound requirements?
The DMC playback is equivalent to a first-order lowpass at frequency 0 (i.e. it's an integrator). Frequency X can be represented as twice as loud as frequency 2X.dougeff wrote:I find that DMC is much better at low to mid range frequencies, as the upper range is lost in DMC hum noise (artifacts of the DMC sample rate being in the audible spectrum). The highest sample rate has the least noticeable hum/noise.
So as you found, it's good for bass guitars, bass drums, toms, and deep rumbly synth samples, and it's rather suboptimal at cymbals, high hats, and other broadband noise sources. (Fortunately, there's the noise channel)
Each individual step in DPCM is pretty close to the quietest pulse channel volume; 15 steps are close to pulse channel maximum volume. The triangle channel is equivalent in volume to a DPCM stream of 20 ↑ followed by 20 ↓ (and repeat).Also, DMC sounds tend to be much quieter than other channels, which will have to be volumed down to balance this issue.
IME, I found that companding the audio first is vital towards getting good volume (and lack of hiss) out of DPCM-encoded recordings.
- rainwarrior
- Posts: 8732
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: PCM sound requirements?
The most DPCM I've seen in an NES game was Gimmick! which has less than 32k (4 x 8k banks) dedicated to samples. It had a mapper that could swap out the C000-DFFF region which helps a lot there. Most of these samples are used for a DPCM bass instrument that plays constantly. Sunsoft put DPCM bass in several games (look up "sunsoft bass"); Journey to Silius makes do with a much smaller collection of DPCM samples in a single bank (MMC1), but its bassline is less varied and a bit out of tune compared to their later games which afforded more data to it.Marscaleb wrote:So with THAT in mind, to what sort of quality would I need to convert a wave file to in order for it to be played during normal gameplay? And about how much room would a normal game from 1989-1991 (with probably an MMC3) be able to reasonably devote to storing this PCM-like audio? I'm not talking about a game that makes a special effort because it needs special sound, but just a game that wants a few sound effects that sound better.
The majority of DPCM using games just use them for a couple of percussion sounds (e.g. bass drum, snare drum), and often they are sharing precious space in a fixed bank with important code. The amount of data devoted too samples tends to be rather small. A couple of kilobytes, maybe ~2k or so? 8k would probably be excessive if you can't bankswitch $C000-DFFF.
Really there is a wide variety of options available, what games did was about how they wanted to manage their resources. Sunsoft wanted their soundtracks to stand out, and they certainly paid for it in their game's data budget.
Re: PCM sound requirements?
Ooooohhhhhhh!! That makes sense.tepples wrote: DMC = delta modulation channel
When I read that i thought... Could you feed the DMC the result of an algorithm to produce another simple wave, like another square or another sawtooth, to get an extra channel but without the expense that an actual DPCM file would carry?tepples wrote: The DMC has a 7-bit "current value" register. Raw PCM playback feeds individual samples to this register.
Probably. I run Windows 7 64-bit.tepples wrote:Are you capable of running Python programs on your computer? What operating system (Windows, Linux, or OS X) does your computer run?
(Redacted)
Last edited by Marscaleb on Mon Feb 08, 2016 1:04 pm, edited 1 time in total.
- rainwarrior
- Posts: 8732
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: PCM sound requirements?
PCM is the expensive one, not DPCM. So, no. This is backwards.Marscaleb wrote:When I read that i thought... Could you feed the DMC the result of an algorithm to produce another simple wave, like another square or another sawtooth, to get an extra channel but without the expense that an actual DPCM file would carry?tepples wrote:The DMC has a 7-bit "current value" register. Raw PCM playback feeds individual samples to this register.
Gimmick! was an example of DPCM, not PCM, and also if you think it sucks I don't know what game you would think is impressive.Marscaleb wrote:Gimmick, Gauntlet II, Sesame Speak and Spell...rainwarrior wrote:The most DPCM I've seen in an NES game was Gimmick! which has less than 32k (4 x 8k banks) dedicated to samples.
Did any game that DIDN'T suck do anything impressive with PCM?
Re: PCM sound requirements?
That would need one of two things: a mapper that maps RAM to $C000-$DFFF (which means Famicom Disk System or MMC5), or feeding one byte at a time through (ab)use of the completion IRQ as in blargg's saw demo.Marscaleb wrote:Could you feed the DMC the result of an algorithm to produce another simple wave, like another square or another sawtooth, to get an extra channel but without the expense that an actual DPCM file would carry?
Are you also familiar with the Windows command prompt? If so, try the Python installation instructions and let me know what messes up.Marscaleb wrote:Probably. I run Windows 7 64-bit.tepples wrote:Are you capable of running Python programs on your computer? What operating system (Windows, Linux, or OS X) does your computer run?
Does Wheel of Fortune also suck? Does SCAT suck? And do the two community multicarts known as Action 53 (volume 1 and volume 2) also suck? All three use PCM. Usually if a game could afford to stop the action for speech, it would use PCM for higher quality.Marscaleb wrote:Gimmick, Gauntlet II, Sesame Speak and Spell...rainwarrior wrote:The most DPCM I've seen in an NES game was Gimmick! which has less than 32k (4 x 8k banks) dedicated to samples.
Did any game that DIDN'T suck do anything impressive with PCM?
Re: PCM sound requirements?
I've made a square wave generator using the DMC IRQ. I play a 1-byte sample, which is the value $AA, so an alternating bit pattern of 1s and 0s. I play the sample at the fastest possible DMC sampling rate. This is so that the DPCM sample doesn't interfere with the rest of the sound more than it has to. You get an inaudibly high, very quiet square wave as an artifact, which is no big deal, and if I remember correctly it takes about 3500 cycles per frame to handle this, with the cost getting lower, the lower you go with the frequency. The issue is that in a game this would be interrupted by OAM DMA, and you'd get a 60Hz buzz in the sound. So the only practical use of this would be an extra channel for sound effects, or tone drums where the interference doesn't matter that much.
I screwed up something with the controller routine so sometimes you get dropped input, and sometimes you get double reads. Couldn't be bothered to fix it because this is just a proof of concept-type thing.
Every x IRQs the state bit of the "sequencer" is flipped, and I write a zero to the "current value" or the current volume based on this bit, which makes a square wave.
Up-Down changes the divisor value, Left-Right changes the volume.
It might work incorrectly if your emulator doesn't have accurate DMC IRQ emulation.
Edit: Got the code here that makes it happen, not very complex...
I screwed up something with the controller routine so sometimes you get dropped input, and sometimes you get double reads. Couldn't be bothered to fix it because this is just a proof of concept-type thing.
Every x IRQs the state bit of the "sequencer" is flipped, and I write a zero to the "current value" or the current volume based on this bit, which makes a square wave.
Up-Down changes the divisor value, Left-Right changes the volume.
It might work incorrectly if your emulator doesn't have accurate DMC IRQ emulation.
Edit: Got the code here that makes it happen, not very complex...
- Attachments
-
- DPCM Square generator.nes
- (40.02 KiB) Downloaded 256 times