It is currently Sun Jan 20, 2019 2:50 pm

 All times are UTC - 7 hours

 Page 1 of 1 [ 10 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Noise Channel LFSRPosted: Thu Aug 14, 2014 7:32 pm

Joined: Wed Mar 31, 2010 12:40 pm
Posts: 207
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.

Top

 Post subject: Re: Noise Channel LFSRPosted: Thu Aug 14, 2014 10:19 pm

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7111
Yes, I believe that is correct. Sometimes you get an "off" note from the periodic noise.

Top

 Post subject: Re: Noise Channel LFSRPosted: Fri Aug 15, 2014 3:53 pm

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7974
Location: Seattle
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 94 times
Top

 Post subject: Re: Noise Channel LFSRPosted: Sat Aug 16, 2014 9:16 am

Joined: Wed Mar 31, 2010 12:40 pm
Posts: 207
lidnariq wrote:
Does that mean that there's precisely one 31-period loop

correct, 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.

Top

 Post subject: Re: Noise Channel LFSRPosted: Sat Aug 16, 2014 11:28 am

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7974
Location: Seattle
Top

 Post subject: Re: Noise Channel LFSRPosted: Sat Aug 16, 2014 11:58 am

Joined: Mon Sep 27, 2004 2:57 pm
Posts: 1258
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?

Top

 Post subject: Re: Noise Channel LFSRPosted: Sat Aug 16, 2014 2:01 pm

Joined: Wed Mar 31, 2010 12:40 pm
Posts: 207
Drag wrote:
especially moreso because only one seed generates it

Technically 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).

Top

 Post subject: Re: Noise Channel LFSRPosted: Sun Aug 17, 2014 6:13 pm

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

Top

 Post subject: Re: Noise Channel LFSRPosted: Sun Aug 17, 2014 6:16 pm

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 21004
Location: NE Indiana, USA (NTSC)
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.

Top

 Post subject: Re: Noise Channel LFSRPosted: Sun Aug 17, 2014 6:37 pm

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7974
Location: Seattle
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 2535 times ]

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 10 posts ]

 All times are UTC - 7 hours

#### Who is online

Users browsing this forum: No registered users and 4 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ NES / Famicom    NESdev    NESemdev    NES Graphics    NES Music    Homebrew Projects       2018 NESdev Competition       2017 NESdev Competition       2016 NESdev Competition       2014 NESdev Competition       2011 NESdev Competition    Newbie Help Center    NES Hardware and Flash Equipment       Reproduction    NESdev International       FCdev       NESdev China       NESdev Middle East Other    General Stuff    Membler Industries    Other Retro Dev       SNESdev       GBDev    Test Forum Site Issues    phpBB Issues    Web Issues    nesdevWiki