This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

Guys give me suggestions: VRC7 vs N163?

Guys give me suggestions: VRC7 vs N163?
by on (#160019)
I initially chose VRC7 for my hack because of its advanced sound, but now I find that I can likely handle N163 sounds even better, so I'm considering switching to it. The problem is though, are there any features present in VRC7 that is not present in N163? I haven't found such features.
Also, how is the emulation of 4-screen mirroring in N163?
Re: Guys give me suggestions: VRC7 vs N163?
by on (#160034)
VRC7's IRQ works differently. VRC7 has 6 voices of 2-op FM synthesis; N163 has up to 8 (but you should probably stop at 6) voices of wavetable synthesis.

I wouldn't count on any emulator to handle 4-screen mirroring with the N163 correctly. Honestly, it's not even clear what "correctly" means in the context of an emulator.

Extra details:
The N163's banking control registers can address up to 288 KiB of CHR memory, in two separate ICs (one, maximum 256 KiB; the other, maximum 32 KiB). All existing cartridges always use the NES's built-in nametable memory in the 32 KiB slot.

The N163 is fairly unique in that it makes almost no distinction between nametable and pattern table addresses: there are twelve banking registers, and they can put almost any 1KiB bank of memory in any of the twelve banks.

One could easily replace (or augment) the 2 KiB of NES CIRAM with an 8 or 32 KiB RAM on the cartridge, providing more than enough RAM to do this. However, whether that extra memory is used for CHR-RAM or nametables is entirely a function of what the program does as it executes.

TL;DR: It's not clear what the "4-screen mirroring bit" in the iNES header means in the context of the N163.
A NES 2.0 header that specified both CHR-RAM and CHR-ROM is more obvious, but I don't think any emulators support that.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#160054)
I'd assume "4 screen" on N163 just means treat it as if there's 4K of RAM hardwired to the name table memory and ignore any banking.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#160058)
But that's not supported by the hardware. We're talking about the behavior that's defined by approximately 5 games and trying to extrapolate it to things where it doesn't really make sense.

Alternatively, to look at another way: the four-screen layout flag is well-defined when the hardware connects PPU /A13 to CIRAM /CE: there it always means one of "disable the 2 KiB NTRAM and add 4 to 8 KiB of RAM instead" or "selectively enable the 2 KiB NTRAM and add 2 KiB of RAM over the rest of the address space".

So, yes, you could disable the NTRAM, and replace it with 4 KiB of RAM ... that the N163 controls ... but there were never any (significant number of ) 4 KiB RAMs. And so maybe it actually means add an 8 KiB RAM instead? It's not well defined.

Or you could instead replace the NTRAM with 4 KiB of RAM and bypass the 163's CHR-ROM/NTRAM enables altogether ... but that hamstrings the mapper.

so there's no good argument to think that one of them is "right". And the simplest (stupidest) definition (ignore the 163's CHRRAM enable, just enable the 4 KiB of RAM over the nametable space) can/will produce bus conflicts.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#160066)
If your question is solely about sound, my personal opinion is that the VRC6 is really the superior extension sound chip. I do not like how the VRC7 sounds, but it is personal.

I do not think 4 screen mirroring is possible with any mapper that allows extra sound. The only games that ever used this were on MMC3 (2 games) and on a custom mapper designed for this (one game). Emulators will support 4 screen mirroring on more mappers, especially those who do not have advanced mirroring control but those who does (such as N163 or MMC5) are definitely out of the question.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#160071)
There were plenty of 2K RAMs though, as used in Gauntlet. These were decoded to $2800-$2FFF.

On Namco 129 and 163, nametable banks $E0 and $E1 mean the console's built-in video memory. Values $E2-$FF are mirrored to $E0-$E1.

Now the question: When banks $E0-$FF are selected, does the mapper still drive CHR A14-A11 based on bits 4-1 of the bank number? For example, if one bank is set to $E0 and another bank is set to $E2, can it tell the difference by looking at A11? If so, the mapper's CHR A11 output can be fed through the Gauntlet circuit.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#160088)
tepples wrote:
Now the question: When banks $E0-$FF are selected, does the mapper still drive CHR A14-A11 based on bits 4-1 of the bank number? For example, if one bank is set to $E0 and another bank is set to $E2, can it tell the difference by looking at A11? If so, the mapper's CHR A11 output can be fed through the Gauntlet circuit.
Yes, it's clear that the N163 was designed to support up to a 32 KiB RAM in that manner.

My point is that for this hardware and iNES encapsulation, specifying "4 screen mirroring" in the iNES header is intrinsically ambiguous. It is not clear exactly which of all the possible variants I mentioned before is intended. And I definitely don't expect multiple emulators to be consistent.


In fact, by emulator, specifying 4 screen does:
FCEU-0.98, FCEUX-HEAD, Nintedulator: ignores the flag altogether
no$nes, NestopiaUE-master: boots up with naïve 4-screen, but subsequent writes to $C000-$DFFF can only select pages 0 or 1 of NTRAM
puNES-master: does tepples's suggestion
Re: Guys give me suggestions: VRC7 vs N163?
by on (#160841)
Bregalad wrote:
If your question is solely about sound, my personal opinion is that the VRC6 is really the superior extension sound chip. I do not like how the VRC7 sounds, but it is personal.

I have more experience with NES music than most of you guys I think. In fact, the VRC6 sounds can even be simulated with N163. However, emulation of N163 audio is faulty with many emulators... Without this issue, the N163 is probably the best sound chip on the Famicom, but very underdeveloped in games though(most games just use a few square/sine/saw waves, Megami Tensei II is probably the game which uses it best but still it's very underdeveloped).

The main questions here are
> Are there any features in VRC7 (besides the sound) that's not supported in N163
> Does major emulators support 4-screen mirroring with N163

Anyway, after reading all those replies, I'll probably just stick with VRC7. Thanks folks, you can continue discussing about it though.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#160918)
w7n wrote:
> Are there any features in VRC7 (besides the sound) that's not supported in N163

Yes. An N163 can only have a repeated periodic waveform with an envelope applied to it. A VRC7 channel on the other hand, cann apply a carrier modulator to a modulatee, allowing the waveform to change over time when a note is sustained. It is also possible to use a trick to get white noise or a square wave. Unfortunately only one "custom" instrument can be used at a time, and can be used in combination with any of the 15 built-in instruments.

Quote:
Does major emulators support 4-screen mirroring with N163

I haven't checked, but it's very likely they does not. (Nor with the VRC7 for that matter). The only mappers which shouls be emulated correctly with 4-screen mirroring are :
- Mappers with no mirroring control (such as NROM, UNROM etc, etc....)
- Mappers where games already exist with 4-screen mirroring (MMC3 and another mapper)

Quote:
In fact, the VRC6 sounds can even be simulated with N163.

I had never realized, but this appears correct ! The N163 is indeed extremely powerful and definitely was undeused in commercial games. However when using the chip to it's fullest, music doesn't sound like NES music anymore, way too many tracks, and too many different sounds ! I had this DKC2 example from Famitracker, it's just insane it sounds closer to SNES music than NES music.

With VRC7 the music also looses it's NES characteristic, while with VRC6, MMC5 or FDS I belive it sound more like enhanced NES music, but still maintain the specific NES sound.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#160986)
One thing to keep in mind with N163 is that it sounds like ass when you add more than 4 channels. This isn't reflected in many emulators because they don't add the aliasing.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#160990)
With the N163, you need to sacrifice a lot of ROM space (and presumably CPU time) to really make use of its potential by rewriting the waveform every frame. You can cycle through a full loop of a string ensemble-sample for example, but you need to have a lot of waveforms to simulate the sound developing over time. This is the demo I like to show people
And also this one
The HuC6280 in the PC-Engine was similarly under-utilised, but the game could do the same waveform updates every frame (or even more frequently with an interrupt if you're willing to sacrifice more CPU for it)
With the VRC7 you can get sounds that slowly change over time much more easily.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#160993)
The question is, does those chips in real hardware support rewriting the wavetable while playback is enabled and without resetting the phase of the channel?
I'm fairly confident that the FDS sound chip and GameBoy's channel 3 have wavetables which cannot be rewritten without resetting the sound channel, causing an annoying side effect similar to writing to $4003 or $4007 on the NES's square wave channels.

The GBA's channel 3 can have two wavetable banks and by double-buffering them any change to the wavetable can be made, but the sappy engine used by 90% of GBA games didn't support that, so nobody outside of the demo-scene made an usage to it.

Quote:
With the N163, you need to sacrifice a lot of ROM space (and presumably CPU time) to really make use of its potential by rewriting the waveform every frame. You can cycle through a full loop of a string ensemble-sample for example, but you need to have a lot of waveforms to simulate the sound developing over time. This is the demo I like to show people
And also this one

I am not surprised that it is technically possible and that someone made an attempt. I am however surprised, because it sound much better than what I'd have expected (considering the waveform is updated only every frame and not every oscillation like it is supposed to). I guess it works especially well with SMW which seriously underuses the SPC700's possibilities.

Quote:
One thing to keep in mind with N163 is that it sounds like ass when you add more than 4 channels. This isn't reflected in many emulators because they don't add the aliasing.

Not only the aliasing, but also the high frequency whistle when switching from channel to channel which should fall into the audible range when 7 or 8 channels are used.
As long as the aliasing/whistle is not emulated, people will continue to abuse the N163 and assume it sounds fine.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#160996)
In practical manners, the N163's aliasing should only really be audible for 7 or 8 channels. The only reason for a threshold of 4 is that all the commercially released games used only 4 or 8.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#160997)
It depends if you use a waveform close to a sine wave where there will be no aliasing, or one close to a saw wave where there definitely will be some. In theory it is of course possible to design your song so that the waveform is automatically prefiltered when reaching high notes, so I guess it's possible to reach clean sound with 6 channels.

With 7 or 8 channels even if there will be no aliasing there will be high frequency whistling.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#160999)
My point is that, if the different voices are uncorrelated, the N163's sound's channel multiplexing produces an alias of the intended sound at every multiple of the channel repetition frequency.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#161003)
lidnariq wrote:
My point is that, if the different voices are uncorrelated, the N163's sound's channel multiplexing produces an alias of the intended sound at every multiple of the channel repetition frequency.

That was my point too, but there is no way more than one multiple could ever be heard, considering this sound would come at 13kHz for 8 channels, the first overtone at 26kHz could not be human earable. This is not aliasing.

Aliasing is when you try to play a high pitched sound but the sampling rate is too low to achieve it. The fundamental could be right, but the other higher harmonics will alias to lower parasite frquencies. For example if you intend do play the following saw wave :

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15

At high pitch and it end up like that :

0, 3, 6, 9, 12, 15, 2, 5, 8, 11, 14, 1, 4, 7, 10, 13, 0, ....

There will be a fake frequency at 1/3 the frequency of the fundamental you want to hear. Neededless to say, this sounds absolutely awful, and I belive it's that what Dish wanted to say.

Having more channels on the N163 means lower sampling rate and thus more aliasing (without a proper filtering, the aliasing will be technically present at even only 1 channel... it just won't be noticeable). At which point aliasing becomes unacceptable depend on the waveform's richness and tolerated signal to noise ration. With a sine wave there won't be any aliasing problem ever, and for waveforms poor in harmonics such as a triangle wave it won't become noticeable.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#161006)
On the N163 you can definitely rewrite the wave RAM no problem, the 24-bit phase counter can be reset manually to zero by writing to all three registers, and I was thinking if this could eliminate the DC clicks when you change the volume from zero to something non-zero. Granted your wave would have to begin with a 0 sample, but at least the note init clicks could be dealt with.
The sine and triangle-like waves might suffer from aliasing less, but they certainly emphasize the qhine coming from the channel switching. I had the pleasure of listening to Erika to Satoru no Yume Bouken music at its "worst", completely unfiltered by an RF demodulation process, or the TV. Even through RF, it's still quite bad, and this game uses two very sine-like waves.
Oh and low-width pulse waves REALLY suffer from the aliasing at certain frequencies. Sometimes you get waves in the amplitude...
Re: Guys give me suggestions: VRC7 vs N163?
by on (#161017)
za909 wrote:
On the N163 you can definitely rewrite the wave RAM no problem, the 24-bit phase counter can be reset manually to zero by writing to all three registers, and I was thinking if this could eliminate the DC clicks when you change the volume from zero to something non-zero. Granted your wave would have to begin with a 0 sample, but at least the note init clicks could be dealt with.

How are you handling the longer waveforms in those videos? Is it just simply a long waveform, updated to the channel waveforms memory at 60hz intervals? Or are you pre-pressing the waveform, identifying specific intervals, and updating along those (with pitch changes to accommodate)?

Also, how are you handling waveform position? On the huc6280, you have the option of resetting the waveform position to zero or not (though writing a full 32 bytes is the same thing, relatively speaking) - but you can never know where the waveform position is at (the playback and write pointer are shared). So you get an audible click because of nonalignment of the new waveform update. With pure square waves, it's not noticeable - but those don't allow for nice filtering effects. And it works fine with low frequency sounds like sound FX (clicks aren't heard). I figured the only way around it was to make sure the instrument is dirty sounding to begin with, to hide/mask it. Bloody Wolf does this, and it's kinda gritty sounding as well as very busy - helping hide it.

Can you do something like this with the N163? https://www.youtube.com/watch?v=V845pHyaePk Since write pointer and playback pointer are shared, writing to sample ram updates the waveform for that position in time.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#161065)
Is there a tutorial of how to draw wave forms of different instruments?
Re: Guys give me suggestions: VRC7 vs N163?
by on (#161067)
You could cut a short snippet out of an actual recorded sample of an instrument and bitcrush it to 4 bits per sample. But then you're back to where to get sound fonts, something that's also a problem for SNES.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#161068)
For this purpose, you could just start with the old Gravis Ultrasound patch sets (debian:freepats), which are already DFSG compliant.

32-sample chip loops are almost assuredly too small to be copyrightable, also.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#161075)
psycopathicteen wrote:
Is there a tutorial of how to draw wave forms of different instruments?


The website for it seems to be gone, but I've attached the program that I've used to create the wavetable instruments in my Squeedo synth. I've found it pretty handy. Press keys on the keyboard as in a tracker editor, to hear it at different pitches.

I had been working on a full General MIDI set for my synth, so 128 instruments, and 128 percussion sounds. I made it pretty far, haven't worked on it for a while. My wavetable mode uses 256 byte samples, though I'm sure most of them could be smashed down to 32 bytes without much loss. Usually what I did was find some sounds of the instrument on youtube, then try to come up with a wavetable and volume envelope that somewhat approximates it. As I made more instruments, I made sort of an audible development log here, if anyone wants to hear it: http://membler-industries.com/squeedo/ And obviously, the later dated ones start to sound better, though far from ideal. Other than noise and maybe one sample (timpani), those are all 256-byte (and a few 32-byte) 8-bit samples. My synth does support other modes, but I've yet to create even a partial General MIDI set for them.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#161084)
tomaitheous wrote:
za909 wrote:
On the N163 you can definitely rewrite the wave RAM no problem, the 24-bit phase counter can be reset manually to zero by writing to all three registers, and I was thinking if this could eliminate the DC clicks when you change the volume from zero to something non-zero. Granted your wave would have to begin with a 0 sample, but at least the note init clicks could be dealt with.

How are you handling the longer waveforms in those videos? Is it just simply a long waveform, updated to the channel waveforms memory at 60hz intervals? Or are you pre-pressing the waveform, identifying specific intervals, and updating along those (with pitch changes to accommodate)?

Also, how are you handling waveform position? On the huc6280, you have the option of resetting the waveform position to zero or not (though writing a full 32 bytes is the same thing, relatively speaking) - but you can never know where the waveform position is at (the playback and write pointer are shared). So you get an audible click because of nonalignment of the new waveform update. With pure square waves, it's not noticeable - but those don't allow for nice filtering effects. And it works fine with low frequency sounds like sound FX (clicks aren't heard). I figured the only way around it was to make sure the instrument is dirty sounding to begin with, to hide/mask it. Bloody Wolf does this, and it's kinda gritty sounding as well as very busy - helping hide it.

Can you do something like this with the N163? https://www.youtube.com/watch?v=V845pHyaePk Since write pointer and playback pointer are shared, writing to sample ram updates the waveform for that position in time.


My mind is blown! Is it writing a new sample 60 times per second, and are the samples incrementing by one each time, or is there a table? I need to do that on the SNES.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#161101)
psycopathicteen wrote:

My mind is blown! Is it writing a new sample 60 times per second, and are the samples incrementing by one each time, or is there a table? I need to do that on the SNES.


I think it's 60 times per second, although you could theoretically do it up to 7000 times per second, per channel, with not a lot of overhead on the cpu (interrupts). If I remember correctly, that game is using either a sine wave or a triangle wave, in which each interval (say 60hz) they read from the 32 byte table and write to the sample ram port. The value is output to the DAC as well as overwriting the sample that's currently pointed to by the playback pointer.

The game uses a fixed interval update (tied to vblank), while the channel playback frequency is whatever being played (the note). So the timbre effect sounds different depending on the note played. I would think, ideally, they would try to keep the ratio correct between the two. The game also doesn't start the process over for new notes, which I thought was weird as well (i.e. restarting the timbre effect).


Are you trying to do some different stuffs with the SNES SPC unit? I think that's much more interesting that the simple stock usage of the setup. The BBR samples are direct deltas, right? As in, not indexes like IMA ADPCM. I wonder how you could exploit the BBR data on the fly to do something similar.



On a side note, I've streamed PCM samples to the channel port while I left the channel playing at a specific frequency. It would add weird filter type sound effects to the sample stream.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#161176)
Oh, it's from an actual game. I thought you invented the technique.

Quote:
Are you trying to do some different stuffs with the SNES SPC unit? I think that's much more interesting that the simple stock usage of the setup. The BBR samples are direct deltas, right? As in, not indexes like IMA ADPCM. I wonder how you could exploit the BBR data on the fly to do something similar.


You could set up a BRR sample as a normal 4-bit PCM sample, and it has a nibble swap instruction.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#161268)
psycopathicteen wrote:
Oh, it's from an actual game. I thought you invented the technique.

I discovered it on my own, but apparently wasn't the first one to do so. But yeah, that video was to show a commercial gaming doing it.


Quote:
You could set up a BRR sample as a normal 4-bit PCM sample, and it has a nibble swap instruction.

So as direct range values and not deltas, right? Can you overwrite this ram while the DSP is play from this region? If the values are direct range values and you can overwrite this area of ram, you could do a lot of different types of realtime sounds/timbre effects.
Re: Guys give me suggestions: VRC7 vs N163?
by on (#161271)
Filter 0 uses direct range values, filtered only by the Gaussian stage. But you still have to skip a byte after every eight pairs of nibbles.