Guys give me suggestions: VRC7 vs N163?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Re: Guys give me suggestions: VRC7 vs N163?

Post by Bregalad »

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.
User avatar
za909
Posts: 229
Joined: Fri Jan 24, 2014 9:05 am
Location: Hungary

Re: Guys give me suggestions: VRC7 vs N163?

Post by za909 »

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...
tomaitheous
Posts: 592
Joined: Thu Aug 28, 2008 1:17 am
Contact:

Re: Guys give me suggestions: VRC7 vs N163?

Post by tomaitheous »

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.
__________________________
http://pcedev.wordpress.com
psycopathicteen
Posts: 3001
Joined: Wed May 19, 2010 6:12 pm

Re: Guys give me suggestions: VRC7 vs N163?

Post by psycopathicteen »

Is there a tutorial of how to draw wave forms of different instruments?
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Guys give me suggestions: VRC7 vs N163?

Post by tepples »

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.
lidnariq
Posts: 10677
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Guys give me suggestions: VRC7 vs N163?

Post by lidnariq »

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.
User avatar
Memblers
Site Admin
Posts: 3901
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Re: Guys give me suggestions: VRC7 vs N163?

Post by Memblers »

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.
Attachments
mumem.zip
(39.92 KiB) Downloaded 94 times
psycopathicteen
Posts: 3001
Joined: Wed May 19, 2010 6:12 pm

Re: Guys give me suggestions: VRC7 vs N163?

Post by psycopathicteen »

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.
tomaitheous
Posts: 592
Joined: Thu Aug 28, 2008 1:17 am
Contact:

Re: Guys give me suggestions: VRC7 vs N163?

Post by tomaitheous »

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.
__________________________
http://pcedev.wordpress.com
psycopathicteen
Posts: 3001
Joined: Wed May 19, 2010 6:12 pm

Re: Guys give me suggestions: VRC7 vs N163?

Post by psycopathicteen »

Oh, it's from an actual game. I thought you invented the technique.
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.
tomaitheous
Posts: 592
Joined: Thu Aug 28, 2008 1:17 am
Contact:

Re: Guys give me suggestions: VRC7 vs N163?

Post by tomaitheous »

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.

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.
__________________________
http://pcedev.wordpress.com
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Guys give me suggestions: VRC7 vs N163?

Post by tepples »

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.
Post Reply