Namco 163 techniques (ftm inside)

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

Moderator: Moderators

Post Reply
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Namco 163 techniques (ftm inside)

Post by FrankenGraphics »

Since i've got my eyes opened for the flexibility of the N163, it has become an enjoyable diversion. This will be a thread where i post ftm:s with various techniques as i find them. You can add yours too if you want to.

First try with N163. Main thing to show:
-Mono, single channel delay built into instrument with a more "natural" wobbling between low and high harmonic content than you can achieve on square channels.

With more channels, you could make more elaborate and impressive delays, but at the cost of brightness/fidelity and wave size. You could also smooth the effect with more waves.

Flip through wave # 4-6 to see how dark and bright harmonic content (represented by different lengths of hi and lo) shift back and forth in dynamic range, besides any other changes. Note how these are cycled in a loop, and amplitude shaped via the volume envelope.

Other, more mundane things to note:

-Waves #1-4 (mainly) morph the harmonic content from resonant to less resonant, approximating a bit of a filter.
-I "crushed" the lowest/longest harmonic content into much shorter widths in wave #0 to give it a bit of a bright bite for the attack.


I'm planning to add the following in new song snippets:
-A better attempt at mimicking synced oscillators set at different rates (this started out as one but then went another route when i discovered other things that were more readily doable).
-An attempt to mimic tonewheel synthesis (electric organs).

Some things i'd like to discuss further:
-Can the technique be refined?
-Am i getting it right that the CPU would have quite the job to do hotswapping waveforms like this? That's what is happening, right?
-What's your favourite N163 techniques, if any?
Attachments
namco_continuescreen.ftm
(2.99 KiB) Downloaded 450 times
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: Namco 163 techniques (ftm inside)

Post by lidnariq »

Yeah, the N163 audio literally is configured with "sample start" and "sample length", so every aspect of the envelope has to be swapped out by the CPU. (However, to make it clear, the CPU doesn't have to dynamically update the wavetable contents itself)

The interesting thing is that there's actually a single literal 128-to-240-nybble long waveform, and that for each channel, the 163 is configured to play a subset of this waveform. For something like the formant sweep you're using here, one could start with a single sample and continuously move the loop points within that sample.

However, Famitracker (justifiably!) decided that exposing this is awkward, and instead lets you only pick one of a subset of aligned waveforms.
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: Namco 163 techniques (ftm inside)

Post by FrankenGraphics »

Thanks for the info; that's a very good thing to know - that it's in theory possible to sweep/scan/jump the waveform memory as one would like. That'd be a very neat basis to knit around for a more dedicated wave table synth application.
User avatar
za909
Posts: 248
Joined: Fri Jan 24, 2014 9:05 am
Location: Mijn hart woont al in Nederland

Re: Namco 163 techniques (ftm inside)

Post by za909 »

In a game (provided that the sampling rate is not too high), any N163 channel could be easily used to play 4-bit PCM data with volume control by having the channel set to a 4-step wavetable, with all steps of that wavetable always being equal. To avoid potential noise coming from the little time delay between writing two wavetable bytes to change the volume, the frequency could be set to 0 and if that's not really possible, then set to such a low amount that the PCM update would happen too fast, which should also reset the wave phase to 0 just to make sure.

Alternatively (and this may be potentially much less CPU-intensive and better in pretty much every way) the same trick could be used to play samples as on the Gameboy. The wavetable serves as a buffer, and is set to a desired frequency, while the 163 also generates IRQs at the same rate, so that when the wavetable cycles through once, the CPU rewrites the wavetable with the next chunk of data. This only requires attention from the CPU when a new data chunk is needed (sadly rules out melodic samples because of OAM DMA in a game)

I'd also definitely generate pulse waves with different widths on the fly if I were to write an N163 sound engine. (Or use the trick where two flipped and slightly detuned sawtooth waves cancel out into a PWM sweeping pulse wave)
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: Namco 163 techniques (ftm inside)

Post by FrankenGraphics »

The trick with two sawtooths:
This is a neat trick because it's very easy to control via FamiTracker.
It is also neat because you can control cross-blend between PWM wave and sawtooth by lowering/increasing the volume of the contrahent so that it's off balance. Now, unfiltered sawtooth waves aren't very pleasant when sustained, but you could always have the edges rounded off to get the same effect as a non-resonant LPF.
Starting off with a saw and quickly moving into PWM will keep the attack of the note consistent regardless the free-running detune setting.

Or if you want to use just the one channel for PWM, you could have a range of 64 samples (or less/more) and simply sweep the offset position 0...31 for a ~3% to
~97% PWM, if the engine would allow it.
Post Reply