Day 15 - The Noise Channel

Published: 2005-07-22
Updated: 2010-12-19
Author: Mike Huber

Intro

The noise channel is channel number 4 and outputs, well, a "noisy" sound. As with all the sound stuff I talk about here, the info comes from The NES Sound Doc.

The technical description of what the "noise" is, is random frequencies. The reason this isn't described with the other sound channels is for 3 reasons:

  1. Doing less at once.
  2. Noise is slightly different from the others.
  3. I felt like it.

Features

The features of the noise channel are as follows:

  1. 29.3 Hz to 447 KHz
  2. Noisy sounds

On to the registers!

The Registers

a.k.a ¿Dónde vas con este?

The Noise Channel registers are at $400C-$400F; the noise channel is enabled with (setting to 1) bit #3 of $4015. Let's see what they do! :)

$400C

Register $400C is the same as $4000, except bits #6-7 are unused.

$400D

Register $400D is totally unused.

$400E

Register $400E controls how fast the frequency goes from random frequency to random frequency or something like that, I'm not sure. The sound doc describes it as "playback sample rate". The bits are:

Bits #0-3 (a.k.a the first hex digit)
"playback sample rate".
Bits #4-6
unused. Can stay zero (0).
Bit #7
"random number type generation", as far as I can tell a 1 is higher sounding noise, a 0 is lower sounding noise. Since this is bit #7 and Bits #4-6 are unused, we can just make a 0 or a 1 be the second hex digit.

$400F

Register $400F is the same as $4003 (except first 3 bits are unused), I just write whatever to it. You can still write #$AB to it if you want, I guess.

If you really want to know, I'm not sure what it means, but bits #3-7 are the "length counter load value". This may or may not have something to do with the frequency.

$4015

To enable the Noise Channel, set bit #3 in $4015. Like so:

lda #%00001000 sta $4015

The Full Code

Again, I'll make a full code listing just because I'm way too much of a nice guy. Here it is:

;;---CODE START---;;

.inesprg 1
.inesmap 0
.inesmir 1
.ineschr 0  ; note that we have no CHR-ROM bank in this code

.bank 1
.org $FFFA
.dw 0 ; no VBlank routine
.dw Start
.dw 0 ; we'll get to this at a later time

.bank 0
.org $8000 ; note that I just copy/pasted code from the register sections Start:
lda #$FF   ; Like $4000 we just write all 1s 'cause
sta $400C  ; we don't mind all the stuff in there being "on".

lda #$50   ; play rate of 5 (5), lower sounding mode (0)
sta $400E

lda #$AB
sta $400F

lda #%00001000  ; enable Noise Channel
sta $4015

infinite: jmp infinite

;;--- END OF CODE FILE ---;; </code>

Assemble and Listen! That code is just a modified version of the previous code file in Day 14. This code sounds like static, I realize thats what the Noise Channel does, but I mean this really sounds like radio or TV static (sorta). It could also be water if you stretch your imagination a little.

This Day In Review

Hope you liked that, The DMC Channel will happen when I figure it out. So there. Hope you have fun with that! :)

Also, be sure to read through the sound doc for all the complete tech info.

Happy listenings (again!),
-Mike H a.k.a GbaGuy