Was the SPC700's noise channel based on the 2a03's noise channel?

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: Was the SPC700's noise channel based on the 2a03's noise channel?

Post by Drag »

rainwarrior wrote: Sat Jun 11, 2022 1:29 am Oh, well yes I don't believe there is any kind of separate convolution, it's just the one inherent in the operation of the LFSR, so it would be at the same period as the noise itself.

At least in bsnes' code, m.noise is the LFSR itself, and it just replaces the sample output directly. No separate shift register, or interaction with the gaussian interpolation, or anything like that.
Interesting! I'm happy to know it now. :D

Now I wonder which games used the noise channel, since I don't think I'd recognize the sound, or I'd just assume it was a sample being used. Maybe Link's sword in LTTP?
User avatar
Memblers
Site Admin
Posts: 4044
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Re: Was the SPC700's noise channel based on the 2a03's noise channel?

Post by Memblers »

psycopathicteen wrote: Thu Jun 09, 2022 10:14 am
Why are those frequencies an octave higher than the ones on nesdev wiki?
Probably the lookup table is more trustworthy than the comments. You mentioning that kind of jogs my memory of me tweaking that table, and if I left the comments alone that wouldn't be too surprising.
Drag wrote: Sat Jun 11, 2022 3:29 pm Now I wonder which games used the noise channel, since I don't think I'd recognize the sound, or I'd just assume it was a sample being used. Maybe Link's sword in LTTP?
The Final Fantasy and Dragon Quest series both come to mind, the noise channel channel is used often in the sound effects. In those cases, it's like they were keeping the traditional sound effects from the earlier Famicom games.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Was the SPC700's noise channel based on the 2a03's noise channel?

Post by rainwarrior »

So... I am recently working independently on the problem of reproducing NES sound on the SNES, and I seem to find that the SNES has a very strange highpass filter effect on its hardware noise?

On the left is a spectrum plot of Famitracker playing high NES noise frequencies. More or less flat response, as expected. On the right is from Mesen playing SNES hardware noise at its highest frequency (FLG low bits = $1F), and... it's very dramatically not flat? This also matched a recording of the same ROM on my SNES, so I believe the emulation is accurate:
famitracker_high_noise_vs_mesen.png
This is not explained by it outputting the whole LFSR instead of just 1 bit. The effect of that should just be the mild lowpass that was mentioned earlier in this thread. (I also tried some empirical testing with an ideal waveform just to make sure there wasn't some aspect of this we hadn't thought of.)

So... has anyone else seen this? If you make the SNES output plain hardware noise at $1F, is this what you get? Does it have this very strong highpass coloration? Or... am I somehow doing something horribly wrong? Unfortunately I don't have a ROM I can share at the moment, but an independent test would also help to rule out something strange in my implementation.

(EVOL=0,0 EON=0 FLG echo disable bit is set, so I don't think it can be echo... PMON=0... am I missing something that can do this?)

Emulators do seem to be getting this correct vs. the same ROM tested on hardware, but I have no idea where this effect comes from. Couldn't spot anything relevant in the source code. Noise does not seem to be subject to the BRR filter at all...
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Was the SPC700's noise channel based on the 2a03's noise channel?

Post by rainwarrior »

Okay, wrote a really quick, very simple test ROM. All it does is turn on noise on voice 0 at frequency 31, maximum volume.

The highpass effect is quite clear. As to why it happens... I'm currently mystified. Does anyone see anything wrong with what I'm doing in the ROM, or conversely, does anyone have any idea why the SNES does this? Emulators are clearly getting it right... but what's the mechanism?

ROM Link: noise31.sfc
Source: github / spc.s
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Was the SPC700's noise channel based on the 2a03's noise channel?

Post by rainwarrior »

So... we were discussing this on discord and came to the following realization: SNES noise output is signed, just like the BRR sample it would be replacing.

So, the theoretical lowpass filter of [1 1/2 1/4 1/8...] isn't right. The high bit becoming the sign bit instead creates something more like [-1 1/2 1/4 1/8...] which does indeed have the strong highpass effect that is seen. (Thanks especially to lidnariq for helping with this realization.)

Well, there you go. SNES noise is highpassed 1-bit noise, more or less.

It's not a fixed highpass, it applies at the rate of the noise, so the cutoff is proportional to the noise frequency.


In my experiments I was finding the mid ranges pretty comparable to NES noise, the high ranges were a little "tinny/hissy" because of this effect but low frequency noise had the most prominent discolouration as a result. I just can't get a bass kick "thump" out of a few frames of low-freqency noise that I could from the NES.
MSonage
Posts: 22
Joined: Fri May 06, 2022 4:34 pm

Re: Was the SPC700's noise channel based on the 2a03's noise channel?

Post by MSonage »

Drag wrote: Sat Jun 11, 2022 3:29 pm
rainwarrior wrote: Sat Jun 11, 2022 1:29 am Oh, well yes I don't believe there is any kind of separate convolution, it's just the one inherent in the operation of the LFSR, so it would be at the same period as the noise itself.

At least in bsnes' code, m.noise is the LFSR itself, and it just replaces the sample output directly. No separate shift register, or interaction with the gaussian interpolation, or anything like that.
Interesting! I'm happy to know it now. :D

Now I wonder which games used the noise channel, since I don't think I'd recognize the sound, or I'd just assume it was a sample being used. Maybe Link's sword in LTTP?
Is used in several games.
Super Mario World uses for lava bubbles, boss falling in lava, enemies throwing fireballs, bat clapping wings, chucks clapping hands, lit fuse and maybe more. The noise was really put to good use.
A lot of RPGs uses for special atacks with some kind of explosion.
Blazeon shamefully uses it for every single explosion, sounding like a NES game. Not even the music sounds like a SNES game to be honest.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Was the SPC700's noise channel based on the 2a03's noise channel?

Post by tepples »

"shamefully"?

I'm not sure what was meant by that. I was planning to someday learn SNES dev in earnest in my free time by starting with faithful ports of my past NES works, and hearing use of LFSR noise called "shameful" doesn't help.
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: Was the SPC700's noise channel based on the 2a03's noise channel?

Post by Drag »

I don't think the use of the LFSR channel is shameful; I interpreted the post as the author expressing disappointment that the explosions weren't an explosion sample instead, given that the sound hardware is definitely capable of it. :P

That speaks to the author's preferences though. For example, I'm indifferent; if it works, it works. :D
User avatar
Jarhmander
Formerly ~J-@D!~
Posts: 569
Joined: Sun Mar 12, 2006 12:36 am
Location: Rive nord de Montréal

Re: Was the SPC700's noise channel based on the 2a03's noise channel?

Post by Jarhmander »

And I interpreted it as "it sounds bland in that game", sounding like a NES game. This was said in contrast to Super Mario World which used the LFSR noise cleverly to make good looking sounds. I wasn't aware of that, that's really neat.
((λ (x) (x x)) (λ (x) (x x)))
MSonage
Posts: 22
Joined: Fri May 06, 2022 4:34 pm

Re: Was the SPC700's noise channel based on the 2a03's noise channel?

Post by MSonage »

Ok, both users above explained exactly what I meant. XD
Just watch a gameplay of this game:
https://youtu.be/O0_iJ-gI9EE?t=414
it's... weird.
I mean, that's the main sound effect of the game and they used a weak sounding noise?
Is nice for the NES or a NES looking game, but on SNES it sounds out of place.

Here's more examples of LFSR:

Earthbound makes heavy use during the PSI effects and they sound really cool, fitting well with the retro visual effects.
https://youtu.be/PJ42Afr_F3E?t=46

The Lion King uses for lightning and for bugs blowing up (not a fan of the usage here, also sound out of place)
https://youtu.be/zc4xXSwYRos?t=1593

Mickey Mania uses a lot, maybe a little too much. The sound effects sequence here is mostly noise.
https://youtu.be/XDcz3JkBLM8?t=911

Donkey Kong Country uses it wisely for snakes. When playing on TV I didn't even realize it was noise, it sounds just like a snake.
https://youtu.be/d4EUEsEM328?t=1362

Super Mario RPG uses for a waterfall sound effect.
https://youtu.be/3e524-lC3i8
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Was the SPC700's noise channel based on the 2a03's noise channel?

Post by rainwarrior »

So, in simulating NES sound on SNES, I ended up taking an approach that combines an appropriately lowpassed noise sample with the hardware noise to fill out the spectrum and make something closer to NES noise.

You can hear the result in the Lizard SNES Demo ROM (press SELECT on the title screen for a soundtrack option).

I'm also working on a port of another of my NES projects, and it was a convenient place to put the source code for it. It doesn't simulate all features of the NES APU (sweep, length counter, etc.) though there's nothing preventing their addition except I didn't need them. (...aside from DPCM, of course, which is a bigger problem.)

Source is available here, with a pre-compiled SPC binary which could be used as-is: https://github.com/bbbradsmith/NESertGo ... e/snes/spc
Post Reply