Getting the best-sounding samples

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Getting the best-sounding samples
by on (#217539)
I've recently done an overhaul on my sound engine by incorporating the DMC channel into it. The samples I currently have, a gunshot sound effect and an "empty clip" sound effect, sound okay on their own, at least as good as I feel they can sound for 1-bit DPCM (They use the highest sample rate), but when I put them in with the rest of the game, they always seem to be drowned out by the rest of the channels. When I compare it to other games' samples, especially those from sample-heavy games like Konami and Sunsoft games, theirs just seem a lot richer and louder overall. I guess I am currently just using the DMC channel as a glorified noise channel, so it kinda gets drowned out by the actual noise channel.

Basically I'm just wondering if there's any auditory techniques or anything that can be done to make samples sound as good as they can; not fidelity-wise, but more volume-balance-wise. I know this is kind of a vague question, and I can elaborate better if need be.
Re: Getting the best-sounding samples
by on (#217540)
The DPCM channel is just not good at high-frequency content. It can only do it quietly, if at all.

For this specific case, you might find my tool to convert samples to a noise channel sequence useful.
Re: Getting the best-sounding samples
by on (#217541)
The obvious thing would be to scale down the volume of the other channels. E.g., only use volume levels 0-7. If you look at many songs from commercial games I think you'll find they mostly operate on the lower range of the pulse volumes.
Re: Getting the best-sounding samples
by on (#217549)
A few years ago RushJet1 made a DPCM tool:
http://forums.nesdev.com/viewtopic.php?t=6975

One of the options it has is just an easy way to experiment with different amounts of pre-gain to try and find a good balance between clipping and quantization.

I think a more ideal tool would have maybe a well formed EQ and not just gain (and probably a more advanced sample encoder), but I don't think anyone's really made the perfect DMC tool yet.

lidnariq: that looks pretty neat. For a long time I've had a "convert FFT to best-fit NES APU registers at 60hz" note on my to do list, so it's pretty cool to see someone actually has done it, at least for noise. :)
Re: Getting the best-sounding samples
by on (#217551)
Three tips:
1) I don’t know about best, but you can get them smaller and reduce hi-frequency noise at the same time by speeding the clip up to a higher pitch, save, import, then play it back in your sound engine at a slower speed (ultimately this means fewer samples per second and as a result a treble roll-off). This might even suffice as a good enough lowpass filter instead of hardcoded filtering, if you’re lucky, but check case-for-case.

Castlevania 3 does this. You’ll notice that the grunting noise, the tom, and the thunder is higher in pitch when played back neutrally.

2) Low bitdepth is in an unhappy marriage with dynamic content. Abrupt volume changes result in noise. Try to keep the body of your samples flat, with the help of a limiter, compressor or compander plugin (compressor + expander).

3) Really low frequencies take more energy to push than higher frequencies. If dynamic depth is limited (which it is), you may get better results by filtering out the lowest frequencies, so that they don’t suppress more important frequencies.
Re: Getting the best-sounding samples
by on (#217552)
FrankenGraphics wrote:
1) I don’t know about best, but you can get them smaller and reduce hi-frequency noise at the same time by speeding the clip up to a higher pitch, save, import, then play it back in your sound engine at a slower speed (ultimately this means fewer samples per second and as a result a treble roll-off). This might even suffice as a good enough lowpass filter instead of hardcoded filtering, if you’re lucky, but check case-for-case.

I don't know why this would be any different than just initially importing it at the lower pitch to begin with?

Possibly though the resampling mechanism of whatever you're importing with ends up doing some sort of effective filtering by this roundabout process? ...though that kinda points toward what I was saying about wishing RJDMC had an EQ: the DPCM format has a hierarchical bandwidth where low frequencies get priority over high frequencies. EQing a sound (esp. reducing bass) can go a long way to finding a balance that minimizes the distortion.
Re: Getting the best-sounding samples
by on (#217553)
Do you mean, in the case of CV like importing trevors' grunting noise at a low sample rate and play it at a higher pitch to produce syphas' grunting noise? As opposed to importing a high-pitched sound and playing it slower to produce syphas' and even slower still to produce trevors'?

I guess else the method is about the same, ie. downsampling the file to a low-resolution collection of averages.

One difference is that you can condition the sound further after the pitch shift, for what good it does.
Re: Getting the best-sounding samples
by on (#217555)
FrankenGraphics wrote:
Do you mean, in the case of CV like importing trevors' grunting noise at a low sample rate and play it at a higher pitch to produce syphas' grunting noise? As opposed to importing a high-pitched sound and playing it slower to produce syphas' and even slower still to produce trevors'?

No, I was speculating about why you were suggesting to pitch up a sample before importing, then pitch it down after importing. This shouldn't really produce a different result than just importing it at the final samplerate, so I was merely speculating that if it does happen to be effective this is maybe some quirk of your importer's resampler acting as a filter conveniently?

...or ere you just saying to try a lower target samplerate to see if it sounds better? (It's that you specifically suggested to pitch it up before importing that throws me here... why not just import at the samplerate you want it to be played at?)
Re: Getting the best-sounding samples
by on (#217561)
I guess the next step up from lidnariq's tool is to use the FFT to determine what frequencies are strongly tonal and what are noise, and then send the tonal frequencies to pulse and the remainder to noise, or the atonal to noise and the residue to DMC.
Re: Getting the best-sounding samples
by on (#217570)
Quote:
...or ere you just saying to try a lower target samplerate to see if it sounds better? (It's that you specifically suggested to pitch it up before importing that throws me here... why not just import at the samplerate you want it to be played at?)


Yeah you could do either and the result should be 1:1 provided the export itself has a high enough sample rate. With a pitch shift up and a low output samplerate, you eventually start to push harmonic content outside the window if you go high enough = aliasing and low pass filtering. Of course, if you go low enough with the sample rate only, you get the same result.

It is better (more controlled) to condition the sample with EQ:s / filters beforehand, at any rate.

I agree setting just setting the sample rate is more straightforward. I just got used to a method where a sample in audacity is shifted by the count of semitones, and then account for that later.
Re: Getting the best-sounding samples
by on (#217631)
Another thing to watch out for is where the delta counter is during your sample's playback. If your sample isn't loud enough to reset the "midpoint" of the sample, this can be a thing (and even if it IS loud enough, you can tilt the data toward zero with RJDMC and FamiTracker).
Re: Getting the best-sounding samples
by on (#217676)
Sogona wrote:
I've recently done an overhaul on my sound engine by incorporating the DMC channel into it. The samples I currently have, a gunshot sound effect and an "empty clip" sound effect, sound okay on their own, at least as good as I feel they can sound for 1-bit DPCM (They use the highest sample rate), but when I put them in with the rest of the game, they always seem to be drowned out by the rest of the channels. When I compare it to other games' samples, especially those from sample-heavy games like Konami and Sunsoft games, theirs just seem a lot richer and louder overall. I guess I am currently just using the DMC channel as a glorified noise channel, so it kinda gets drowned out by the actual noise channel.

Basically I'm just wondering if there's any auditory techniques or anything that can be done to make samples sound as good as they can; not fidelity-wise, but more volume-balance-wise. I know this is kind of a vague question, and I can elaborate better if need be.


The other suggestions and ideas in this thread are great. It may work to equalize and then compress the sounds at a mid high frequency and then amplify the sound to their maximum volume. I would be interested to look at your samples in Audacity if you would like to post them. Another thing that may work would be to layer the sample sounds with a burst of noise to give them more high frequency pop and volume to the effect.
Re: Getting the best-sounding samples
by on (#217686)
thefox wrote:
The obvious thing would be to scale down the volume of the other channels. E.g., only use volume levels 0-7. If you look at many songs from commercial games I think you'll find they mostly operate on the lower range of the pulse volumes.
The only real issue with this is that it reduces the granularity of volume envelopes by half.

FrankenGraphics wrote:
1) I don’t know about best, but you can get them smaller and reduce hi-frequency noise at the same time by speeding the clip up to a higher pitch, save, import, then play it back in your sound engine at a slower speed (ultimately this means fewer samples per second and as a result a treble roll-off). This might even suffice as a good enough lowpass filter instead of hardcoded filtering, if you’re lucky, but check case-for-case.
How exactly would I go about doing this in audacity?

cdigi wrote:
I would be interested to look at your samples in Audacity if you would like to post them.
Go right ahead
Attachment:
gunshot.mp3 [16.33 KiB]
Downloaded 196 times

Attachment:
gunshot.bin [1.41 KiB]
Downloaded 196 times

Attachment:
empty_clip.mp3 [8.24 KiB]
Downloaded 192 times

Attachment:
empty_clip.bin [209 Bytes]
Downloaded 193 times

Just rename the .bin files as .dmc files.
Also is there any reason why .wav files aren't allowed? Hopefully 320kb/s mp3's are good enough if anyone wants to try and work with these. I'll try out what's been suggested in a few days when I have more free time.
Re: Getting the best-sounding samples
by on (#217691)
Quote:
The only real issue with this is that it reduces the granularity of volume envelopes by half.

Yes, it does. But i think it’s an allright tradeoff considering the sound of the overall mix. I even go as far as to have pulses’ sustain portions be at 4 and 3, respectively, and on average pretty often. (the difference between the channels i have most of the time also helps the tone distinction). This allows the bass not only to be strong in comparison, but also gets a strong rhythmic, even percussive presence. Same goes for samples.

Quote:
How exactly would I go about doing this in audacity?
I don’t have my computer at hand, but under the effects list you have options for changing it. The dialogue allows you to set the pitch/speed difference in semitones, which i found quite handy. Note though that rainwarriors’ suggestion is more straightforward.
Re: Getting the best-sounding samples
by on (#217695)
FrankenGraphics wrote:
Quote:
The only real issue with this is that it reduces the granularity of volume envelopes by half.

Yes, it does. But i think it’s an allright tradeoff considering the sound of the overall mix. I even go as far as to have pulses’ sustain portions be at 4 and 3, respectively, and on average pretty often. (the difference between the channels i have most of the time also helps the tone distinction). This allows the bass not only to be strong in comparison, but also gets a strong rhythmic, even percussive presence. Same goes for samples.

Also note that since the "volume" in NES APU is actually a linear amplitude, the perceived difference between levels 15 and 14 is much less than the difference between 8 and 7, for example. So much of the granularity at the higher end goes to waste anyways.
Re: Getting the best-sounding samples
by on (#217706)
Attachment:
gunshotsamplechange1.jpg
gunshotsamplechange1.jpg [ 94.73 KiB | Viewed 3148 times ]

I opened the gunshot mp3 file in Audacity and used a graphic equalizer in the Effect section to raise the frequencies above 400 and decrease the frequencies below 400 with the 400 band in the middle. I also deleted the lead and did a very short fade in in the Effect section to remove any clip and also a fade out on the end fourth of the sample. The original sample had some low mid frequencies so this processing should remove some of that and amplify the higher end to cut through the sound mix a little.

Attachment:
gunshotchange1.bin [1.41 KiB]
Downloaded 184 times

The new sample is not much different from the original after importing into Famitracker. They both sound good in their own way to me.

Attachment:
gunshotsampleandnoise.jpg
gunshotsampleandnoise.jpg [ 22.44 KiB | Viewed 3148 times ]

I think to get that high end burst you should layer the sample with noise if you can. Here, I added high noise for the initial attack 8-#. Then, mid high for pop 5-#. The tail is low for the fade 4-# & 2-#.

I tinkered a little with the clip sound but it didn't affect it much. Thanks for uploading the sounds.