The [[APU|NES APU]] noise channel generates pseudo-random 1-bit noise at 16 different frequencies. [[APU#Glossary|Timer]] --> [[#Operation|Shift Register]] [[APU Length Counter|Length Counter]] | | v v [[APU Envelope|Envelope]] -------> Gate ----------> Gate ---> (to [[APU#Glossary|mixer]]) = Registers = == Noise envelope settings ($400C, write) == 7 bit 0 ---- ---- ..LC VVVV || |||| || ++++- When C is set: channel volume value || When C is clear: [[APU Envelope|envelope]] divider reload value |+------ Constant volume flag (override [[APU Envelope|envelope]] with V) +------- [[APU Length Counter|Length counter]] halt flag ''and'' [[APU Envelope|envelope]] loop flag == Noise mode and period ($400E, write) == 7 bit 0 ---- ---- M... PPPP | |||| | ++++- Noise period +--------- Periodic noise mode The timer period is set to entry P of the following: {|class="wikitable sortable" !data-sort-type="number"| Period (P) || NTSC || PAL |- | $0 || 4 || 4 |- | $1 || 8 || 8 |- | $2 || 16 || 14 |- | $3 || 32 || 30 |- | $4 || 64 || 60 |- | $5 || 96 || 88 |- | $6 || 128 || 118 |- | $7 || 160 || 148 |- | $8 || 202 || 188 |- | $9 || 254 || 236 |- | $A || 380 || 354 |- | $B || 508 || 472 |- | $C || 762 || 708 |- | $D || 1016 || 944 |- | $E || 2034 || 1890 |- | $F || 4068 (2046 in [[CPU variants#Official (NTSC)|early RP2A03 revisions]]) || 3778 |} The period determines how many CPU cycles happen between shift register clocks. These periods are all even numbers because there are 2 CPU cycles in an APU cycle. == Length counter load value ($400F, write) == 7 bit 0 ---- ---- LLLL L... |||| | ++++-+---- [[APU Length Counter|Length counter]] load value Writing to this register also restarts [[APU Envelope|envelope]]. = Operation = The shift register is 15 bits wide, with bits numbered
14 - 13 - 12 - 11 - 10 - 9 - 8 - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 When the timer clocks the shift register, the following actions occur in order: # Feedback is calculated as the exclusive-OR of bit 0 and one other bit: bit 6 if [[#Noise mode and period ($400E, write)|periodic noise mode (M bit)]] is set, otherwise bit 1. # The shift register is shifted right by one bit. # Bit 14, the leftmost bit, is set to the feedback calculated earlier. This results in a pseudo-random bit sequence, 32767 steps long when Mode flag is clear, and randomly 93 or 31 steps long otherwise. (The particular 31- or 93-step sequence depends on where in the 32767-step sequence the shift register was when Mode flag was set). The [[APU#Glossary|mixer]] receives the current [[APU Envelope|envelope volume]] except when * bit 0 of the shift register is set, or * the [[APU Length Counter|length counter]] is zero Within the mixer, the DMC level has a noticeable effect on the noise's level. On power-up, the shift register is loaded with the value 1. In the earliest revisions of the 2A03 CPU, the [[#Noise mode and period ($400E, write)|periodic noise flag (M bit)]] was nonexistent: the shift register always used bits 0 and 1 for feedback, and the lowest period (rate $F) lasts 2046 M2 cycles instead of 4068. These CPUs were used in the first batch of Famicom consoles (which were recalled), in Vs. System boards, and in the arcade games that used the 2A03 as a sound coprocessor. [http://forums.nesdev.org/viewtopic.php?p=58046#p58046], [https://bsky.app/profile/plgdavid.bsky.social/post/3llhf3ocbx22d] The 93-step sequence is about a quarter tone (50 cents) sharp relative to A440 tuning. The approximate frequencies and pitches (in [[wikipedia:Helmholtz pitch notation#Variations|LilyPond's variant of Helmholtz notation]]) are as follows: {| class="wikitable" |+ Pitches of 93-step noise ! || colspan=4|NTSC || colspan=4|PAL |- ! Register value || Sample rate || Repeat rate || MIDI note || Pitch || Sample rate || Repeat rate || MIDI note || Pitch |- | $80 || 447443.2 Hz || 4811.2 Hz || 110.41 || d''''' + 41¢ || 415651.8 Hz || 4469.4 Hz || 109.13 || c#''''' + 13¢ |- | $81 || 223721.6 Hz || 2405.6 Hz || 98.41 || d'''' + 41¢ || 207825.9 Hz || 2234.7 Hz || 97.13 || c#'''' + 13¢ |- | $82 || 111860.8 Hz || 1202.8 Hz || 86.41 || d''' + 41¢ || 118757.6 Hz || 1277.0 Hz || 87.45 || d#''' + 45¢ |- | $83 || 55930.4 Hz || 601.4 Hz || 74.41 || d'' + 41¢ || 55420.2 Hz || 595.9 Hz || 74.25 || d'' + 25¢ |- | $84 || 27965.2 Hz || 300.7 Hz || 62.41 || d' + 41¢ || 27710.1 Hz || 298.0 Hz || 62.25 || d' + 25¢ |- | $85 || 18643.5 Hz || 200.5 Hz || 55.39 || g + 39¢ || 18893.3 Hz || 203.2 Hz || 55.62 || g + 62¢ |- | $86 || 13982.6 Hz || 150.4 Hz || 50.41 || d + 41¢ || 14089.9 Hz || 151.5 Hz || 50.54 || d + 54¢ |- | $87 || 11186.1 Hz || 120.3 Hz || 46.55 || a#, + 55¢ || 11233.8 Hz || 120.8 Hz || 46.62 || a#, + 62¢ |- | $88 || 8860.3 Hz || 95.3 Hz || 42.51 || f#, + 51¢ || 8843.7 Hz || 95.1 Hz || 42.48 || f#, + 48¢ |- | $89 || 7046.3 Hz || 75.8 Hz || 38.55 || d, + 55¢ || 7044.9 Hz || 75.8 Hz || 38.54 || d, + 54¢ |- | $8A || 4709.9 Hz || 50.6 Hz || 31.57 || g,, + 57¢ || 4696.6 Hz || 50.5 Hz || 31.52 || g,, + 52¢ |- | $8B || 3523.2 Hz || 37.9 Hz || 26.55 || d,, + 55¢ || 3522.5 Hz || 37.9 Hz || 26.54 || d,, + 54¢ |- | $8C || 2348.8 Hz || 25.3 Hz || 19.53 || g,,, + 53¢ || 2348.3 Hz || 25.3 Hz || 19.52 || g,,, + 52¢ |- | $8D || 1761.6 Hz || 18.9 Hz || 14.55 || d,,, + 55¢ || 1761.2 Hz || 18.9 Hz || 14.54 || d,,, + 54¢ |- | $8E || 879.9 Hz || 9.5 Hz || 2.53 || d,,,, + 53¢ || 879.7 Hz || 9.5 Hz || 2.52 || d,,,, + 52¢ |- | $8F || 440.0 Hz || 4.7 Hz || -9.47 || d,,,,, + 53¢ || 440.1 Hz || 4.7 Hz || -9.47 || d,,,,, + 53¢ |} {{APU nav}} [[Category:APU]]