nesdev.comhttps://forums.nesdev.com/ Noise Channel LFSRhttps://forums.nesdev.com/viewtopic.php?f=3&t=11535 Page 1 of 1

 Author: beannaich [ Thu Aug 14, 2014 7:32 pm ] Post subject: Noise Channel LFSR NES Dev Wiki wrote:This results in a pseudo-random bit sequence, 32767 steps long when Mode flag is clear, otherwise 93 steps long (the particular 93-step sequence depends on where in the 32767-step sequence the shift register was when Mode flag was set).I did a brute force checking of this fact, using the algorithms supplied on the wiki. It seems there are 31 "seed values" that result in a 31 step sequence instead of 93.The code can be found here. I'm just making sure this is correct. If so, the wiki should be adjusted to mention it.There is no such discrepancy for the 32767 step sequence.

 Author: rainwarrior [ Thu Aug 14, 2014 10:19 pm ] Post subject: Re: Noise Channel LFSR Yes, I believe that is correct. Sometimes you get an "off" note from the periodic noise.

Author:  lidnariq [ Fri Aug 15, 2014 3:53 pm ]
Post subject:  Re: Noise Channel LFSR

Does that mean that there's precisely one 31-period loop, and all the other possible states of the LFSR are the null state (period 1) and 352 different 93-period loops?

Hm. Yes, that does seem to be the case.
There is one 31-period sequence that contains the 31 states (in decimal) 10519 12211 13190 13602 14442 16078 1700 17234 17910 18622 19994 21039 21643 22979 24423 25001 26381 27205 27873 28884 30320 3052 31544 32156 3400 4477 6105 6801 7221 8955 9311, and the FFT of same implies that the resultant waveform is just an impulse train (since the 3rd, 6th, 9th, &c harmonics are all the same magnitude and all others are 0)

There are 209 total different tone colors the tonal noise can make (including the silent null state) :
\$ ./tonal | cut -f 1 -d : | sort -n | uniq | wc -l
209

The 352 different 93-period loops break down into 207 tone colors; of those 62 are unique, and the other 145 exist twice (forwards and backwards bitstreams?) There seems to be no obvious correlation between volume of fundamental or presence/absence of 31st harmonic (whose presence is, notably, boolean)

 Attachments: File comment: compile with " gcc tonal.c -lfftw3 -lm " tonal.c [974 Bytes] Downloaded 88 times

 Author: beannaich [ Sat Aug 16, 2014 9:16 am ] Post subject: Re: Noise Channel LFSR lidnariq wrote:Does that mean that there's precisely one 31-period loopcorrect, there is only one 31-step loop, with 31 possible entries into it from the 32767-step form (since the 32767-step form will generate all unique values).could the wiki be updated with this information? right now there is no mention of the 31-step form, only the 32767 and 93-step forms.

 Author: lidnariq [ Sat Aug 16, 2014 11:28 am ] Post subject: Re: Noise Channel LFSR Already got it.

 Author: Drag [ Sat Aug 16, 2014 11:58 am ] Post subject: Re: Noise Channel LFSR I'm not sure this is necessary to have on the wiki like that, because it is canonically 93 steps, with the 31 step sequence being more of an artifact of having a weird seed (especially moreso because only one seed generates it, it just feels like more attention is being brought to it than necessary). Maybe put it as a sidenote instead?

 Author: beannaich [ Sat Aug 16, 2014 2:01 pm ] Post subject: Re: Noise Channel LFSR Drag wrote:especially moreso because only one seed generates itTechnically speaking, there are 31 seed values that jump you into the 31-step loop. Drag wrote:Maybe put it as a sidenote instead?I agree that it should be mentioned as a quirk, since only ~0.09% of the seed values send you along the 31-step path. I'll be whipping up a little test later to make sure this does indeed happen on hardware in the mean time (It almost certainly does).

Author:  lidnariq [ Sun Aug 17, 2014 6:13 pm ]
Post subject:  Re: Noise Channel LFSR

Well, from a musical point of view, the 31-period doesn't matter, but the largely unpredictable ratio of harmonics does. Even just among the 93-period sounds there's a wide variety of different strengths of each of the first three harmonics:
Attachment:

graph-of-tonal-noise-harmonics.png [ 8.91 KiB | Viewed 2466 times ]
Legend:
Purple: the period 31 defective case, right next to some of
Green: the set of period 93 that only occur once, producing an outline around
Blue: the set of period 93 that occur twice, making a wavy surface.
Red: the set of period 93 that have a loud 31st harmonic

I made this graph using gnuplot, source files attached. In the actual program you can drag around the camera to actually be able to visualize the surface.

 Attachments: tonal-noise-gnuplot.zip [2.11 KiB] Downloaded 80 times

 Author: tepples [ Sun Aug 17, 2014 6:16 pm ] Post subject: Re: Noise Channel LFSR Try making eight frames of this plot a degree apart from each other and tossing them in an animated GIF. I wonder how that'd look.

 Author: lidnariq [ Sun Aug 17, 2014 6:37 pm ] Post subject: Re: Noise Channel LFSR Here's something rotating about (45°+10°·sin(t),45°+10°·cos(t)). The purple point for period=31 is off the left side of the viewport.Attachment: rotating-tonal-noise-harmonics.gif [ 39.46 KiB | Viewed 2460 times ]

 Page 1 of 1 All times are UTC - 7 hours Powered by phpBB® Forum Software © phpBB Grouphttp://www.phpbb.com/