N163 Multi-Wave Sampling in FamiTracker

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

Moderator: Moderators

TurtwigX
Posts: 17
Joined: Mon Aug 31, 2020 8:11 pm

N163 Multi-Wave Sampling in FamiTracker

Post by TurtwigX »

Hello everyone! This is my first post, so I'll try to make my question as clear and direct as I can, and apologies if something comes off a little too vague.

I want to track an N163 version of Mario Circuit from Super Mario Kart. One thing I wanted to do is sample the Latin percussion (the timbale and bongo) each as multiple N163 waves in an instrument, to increase the fidelity. To do this I took the sample from the SPC, imported into Audacity, and used a plugin to turn waves into N163 wave steps. Perfect, except it did not sound anything like a drum when I pasted the values in. I got something confused somewhere along the line. So what I'd like to know is...

1. What is the best way to sample a sound as multiple N163 waves?
2. What is the minimum wave size I could use? (32 would be best, or even 64)
3. And is there a different process for multi-wave sampling looped instruments?

Please feel free to ask to ask for further clarification if need be, and thank you in advance!
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: N163 Multi-Wave Sampling in FamiTracker

Post by lidnariq »

It would help if you showed what you had, or described how what you made didn't meet your hopes.

Most percussion sounds require some amount of white noise as part of the attack, so I don't know if you'll be really able to get a satisfying result without also using the white noise channel.
TurtwigX
Posts: 17
Joined: Mon Aug 31, 2020 8:11 pm

Re: N163 Multi-Wave Sampling in FamiTracker

Post by TurtwigX »

I tried to look for the file but I guess I didn't save it... luckily, I do have an example of what I would like to do, and it comes from this video
https://www.youtube.com/watch?v=NnuplOOGrHE

I know for the non-pitched part of the percussion I'll need to use the noise channel, which I still plan to do, but it's the tone I want to achieve
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: N163 Multi-Wave Sampling in FamiTracker

Post by lidnariq »

I believe I understand what you want to do, it's just that I don't understand what went wrong.
User avatar
Bregalad
Posts: 8055
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Re: N163 Multi-Wave Sampling in FamiTracker

Post by Bregalad »

TurtwigX wrote: Wed Jan 20, 2021 8:38 pm I tried to look for the file but I guess I didn't save it... luckily, I do have an example of what I would like to do, and it comes from this video
https://www.youtube.com/watch?v=NnuplOOGrHE

I know for the non-pitched part of the percussion I'll need to use the noise channel, which I still plan to do, but it's the tone I want to achieve
Just to say OMG this sound amazing, it doesn't sound like it's the NES/FC at all !
Useless, lumbering half-wits don't scare us.
TurtwigX
Posts: 17
Joined: Mon Aug 31, 2020 8:11 pm

Re: N163 Multi-Wave Sampling in FamiTracker

Post by TurtwigX »

lidnariq wrote: Wed Jan 20, 2021 11:42 pm I believe I understand what you want to do, it's just that I don't understand what went wrong.
I'll try to make it again and post and example later today, but I can explain the steps I took.

I posted imported the bongo sound into Audacity, zoomed in to see the individual samples, highlighted a large swath of them, used the plugin to turn that into a 32 step N163 wave, and repeated the process until I had the whole sound (it was less than 100 milliseconds). Then I pasted them into the N163 wave editor and instead it sounded like... well nothing very much like the tone of a bongo. Just a generic electronic wave sound. And I figure somewhere in the process I'm doing something wrong, but I'll try it again later today and post the result with the original WAV and an FTM/fti
Bregalad wrote: Thu Jan 21, 2021 3:38 am Just to say OMG this sound amazing, it doesn't sound like it's the NES/FC at all !
Agreed! That's why I wanna know just howwwww
User avatar
Dwedit
Posts: 4921
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: N163 Multi-Wave Sampling in FamiTracker

Post by Dwedit »

Need to make sure the wave number changes every frame when editing the instrument.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
TurtwigX
Posts: 17
Joined: Mon Aug 31, 2020 8:11 pm

Re: N163 Multi-Wave Sampling in FamiTracker

Post by TurtwigX »

Dwedit wrote: Thu Jan 21, 2021 10:54 am Need to make sure the wave number changes every frame when editing the instrument.
Well yeah I did that but it still didn't sound like the original instrument
User avatar
Dwedit
Posts: 4921
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: N163 Multi-Wave Sampling in FamiTracker

Post by Dwedit »

One NES frame is about ~16.6394ms (might be rounded to ~16.6666ms).
Waveform can only change that often, so it can be hard to match the source wave, considering that there are non-looping parts as well.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
TurtwigX
Posts: 17
Joined: Mon Aug 31, 2020 8:11 pm

Re: N163 Multi-Wave Sampling in FamiTracker

Post by TurtwigX »

That I didn't take into account! I'll try splitting the sound into 16.67ms chunks and then upload the results of that
TurtwigX
Posts: 17
Joined: Mon Aug 31, 2020 8:11 pm

Re: N163 Multi-Wave Sampling in FamiTracker

Post by TurtwigX »

Update: I think that may have worked! At least for the 240 wave size, since it sounds percussive. As for 32 and 64, not so much. Which leads me to believe they might not be the best for reproducing percussive sounds, or that there's something else I'm not understanding.

Either way, here is the FTM and the original sounds
Attachments
Bongotest.ftm
(2.66 KiB) Downloaded 193 times
Bongo.mp3
(9.2 KiB) Downloaded 147 times
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: N163 Multi-Wave Sampling in FamiTracker

Post by lidnariq »

The longest waveform that the 163 can hold is 240 samples.
The (NTSC) NES CPU can't be told to update the 163 wavetable RAM more often than 60 times per second.
This means that the highest sample rate you can support for this combination is 14424 Hz.

If you use a shorter wavetable, your possible sample rate drops correspondingly. For a 64-sample wavetable, you need to preprocess your waveform down to only 3840 Hz before importing it.

("But", you say, "I'm not playing things at a fixed sample rate. How does that work?" This is accidentally relying on the poor man's pitch bender, where you assume that seams at the end of each loop won't add significant tonal or rhythmic content to the desired waveform. It's a vaguely ok, ish, assumption within a factor of 2 of the original. It also works better with much longer loops, ideally around 1/20th of a second.)
TurtwigX
Posts: 17
Joined: Mon Aug 31, 2020 8:11 pm

Re: N163 Multi-Wave Sampling in FamiTracker

Post by TurtwigX »

And just like that... I can see clearly now, the rain is gone

Okay, so I went back, did some light limiting to raise the overall amplitude, exported it at 14400Hz for the 240 wave size instrument and 1920Hz (ouch) for the 32 wave size instrument. Then I cut them up into chunks of the appropriate sample length, imported the strings, and... well I think that's it! It sounds fantastic for the 240 sample size. As for the 32, It's still probably just too short to accurately reflect noisy percussive information. I could do some more tweaking on the sample editing end, but I think this is good, yeah?
Attachments
Bongotest.ftm
(4.63 KiB) Downloaded 167 times
User avatar
za909
Posts: 248
Joined: Fri Jan 24, 2014 9:05 am
Location: Mijn hart woont al in Nederland

Re: N163 Multi-Wave Sampling in FamiTracker

Post by za909 »

This may sound close, but it is still not as good as writing your own code to use the N163 wave memory as a sample buffer. This is because Famitracker does not let you reset the phase accumulator of the N163 channels, which determines where the channel looks for the current waveform step in the memory. This accumulator is increased at a fixed rate by the value held in the frequency register, and shows up as constantly cycling values in the "register view" of the tracker. Unfortunately this causes a "random" starting position within the first waveform, and pretty much all the waveforms. The perfect solution would be if you could reset the phase accumulator to 0 when each note starts, or rather every time a new waveform is loaded.
TurtwigX
Posts: 17
Joined: Mon Aug 31, 2020 8:11 pm

Re: N163 Multi-Wave Sampling in FamiTracker

Post by TurtwigX »

That makes sense, and is also pretty annoying that perfection is a tweak away. But, given that I cannot code at that level, I think this is as close as I'll get. Unless someone wanted to walk me through it, which might still go over my head. And when the sound is masked by a flurry of other tones and drums I'm sure the phase issues will fade into the background
Post Reply