Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > SID noise generator testing
2016-08-13 11:56
chatGPZ

Registered: Dec 2001
Posts: 11386
SID noise generator testing

yay!

one thing that'd be really nice to have in the VICE testprograms repo for regression testing would be one (or more :)) programs that check for various properties of the noise generator LFSR. now i tried a few things, and always run into one annoying problem - the damn thing doesnt seem to like being "reset" in any sort of way. which makes comparing with reference data kindof hard.

so my question to the SID wizard is - can you share some ideas please? whatever wizardry may reset the damn thing into a state so that after it it can be sampled and compared to some reference reliably would do the trick.
2016-08-13 12:20
JackAsser

Registered: Jun 2002
Posts: 2014
Doesn't the combined waveforms with noise make the LFSR shift in zeroes? (I'm not the wizard you're looking for)
2016-08-13 12:23
Oswald

Registered: Apr 2002
Posts: 5094
wait until a pattern occurs, then consider it reset ? :P I guess it might take a LONG time :) no wizard either
2016-08-13 12:24
chatGPZ

Registered: Dec 2001
Posts: 11386
please, no vague guessing, i've done that myself already :)
2016-08-13 12:38
JackAsser

Registered: Jun 2002
Posts: 2014
I was referring to: http://www.dekadence64.org/sidwav.txt
2016-08-13 19:05
Jammer

Registered: Nov 2002
Posts: 1335
I based 2nd sid detection on noise generator in register copies and vice surprised me unpleasantly (on the other hand, funniest thing is that disabled vice sound was identified as no 2nd sid as well).
2016-08-13 19:19
chatGPZ

Registered: Dec 2001
Posts: 11386
noise in resid seems to have various problems - hence the need for some test programs :)
2016-08-13 21:09
Claus_2015

Registered: Oct 2012
Posts: 53
Chiming into the vague guessing: is it an option to simply wait for a specific sequence of 3 bytes or so? I would assume that there must be some sequences that are unique in the 23 Bit LFSR period. If you find them, you know where you are. If you did not find them after 2^23 steps, the noise generator is obviously wrong.
2016-08-13 23:12
ChristopherJam

Registered: Aug 2004
Posts: 1409
This thread from some folk reverse engineering various bits of SID behaviour from die shots looks pertinent?

http://forum.6502.org/viewtopic.php?f=8&t=4150&start=0

They move on to other parts of the SID before coming to any kind of definitive conclusion about how the LFSR is reset, or even how combining waveforms infects the state.
2016-08-14 09:26
chatGPZ

Registered: Dec 2001
Posts: 11386
AAAAAAAARRRRRGG GNGNGNGNG
2016-08-14 10:42
Mixer

Registered: Apr 2008
Posts: 452
Considering what sort of tests are possible on c-64.

We can only put a value to some voice 3 register, wait, read something from env3 or osc3.

I tried noise mapping to certain osc values by setting a frequency, then using SounDemons combiwaveform reset, and then waiting for 2 rasterlines for certain OSC3 value to appear. If it did not occur, then change frequency. Obviously the purpose was to get a map for 126 cycle delay.

The resulting map looked different on different c-64 units, so, no universal map that way. However some values did not change between units. There may be something there worth studying.

A better way to study noise might be to do the same but then just wait until a value appears and record times when it does. A sequence of those occurrences could be used to determine where in the "noise" one is. If noise is chaotic then that obviously wont work. Based on what I've understood from the linked texts, there should be at least some short sequences that remain constant as Claus_2015 suggested.
2016-08-14 12:25
chatGPZ

Registered: Dec 2001
Posts: 11386
wait until a (one) value isnt really practical.... you'd have to wait for a longish sequence - which isnt really practical either unfortunately.

what i tried so far is what sounddemon describes, set testbit for a while (several seconds) with $f0 wave selected, then set $81 and sample the result from osc3 cycle by cycle. this does "almost" work, the resulting sequence is "almost" predictable.... however not entirely, after ~50 or so bytes randomness seems to creep into it. which is sort of strange, it either means the reset didnt work, or the feedback of the LFSR is subject to analog magic too. i get also different results from different C64s, which supports the theory of analog magic going on. :(
2016-08-14 12:50
Mixer

Registered: Apr 2008
Posts: 452
Has anyone recorded the noise cyclewise from many c-64 units for statistical study? (using REU as in http://www.sidmusic.org/sid/sidtech5.html)
2016-08-14 14:47
Oswald

Registered: Apr 2002
Posts: 5094
noise loops, I guess I've read this in a c= hackin article someone sample it into reu iirc.
2016-08-14 19:49
chatGPZ

Registered: Dec 2001
Posts: 11386
yes sure, thats besides the point however :)
2016-08-16 16:46
ChristopherJam

Registered: Aug 2004
Posts: 1409
OK, working on some tests off the back of those die shots, but I can't currently transfer files to my real c64. Once I get that working again I'll report back.
2016-08-18 20:40
lft

Registered: Jul 2007
Posts: 369
From the resid source (0.16):

Combined waveforms:
By combining waveforms, the bits of each waveform are effectively short
circuited. A zero bit in one waveform will result in a zero output bit
(thus the infamous claim that the waveforms are AND'ed).
However, a zero bit in one waveform will also affect the neighboring bits
in the output. The reason for this has not been determined.

Example:
 
            1 1
Bit #       1 0 9 8 7 6 5 4 3 2 1 0
            -----------------------
Sawtooth    0 0 0 1 1 1 1 1 1 0 0 0
Triangle    0 0 1 1 1 1 1 1 0 0 0 0
AND         0 0 0 1 1 1 1 1 0 0 0 0
Output      0 0 0 0 1 1 1 0 0 0 0 0

(...)

Tests show that minor (1 bit) differences can actually occur in the output from otherwise
identical samples from OSC3 when waveforms are combined. To further
complicate the situation the output changes slightly with time (more
neighboring bits are successively set) when the 12-bit waveform
registers are kept unchanged.


And:

All waveform combinations including noise output zero after a few cycles.
NB! The effects of such combinations are not fully explored. It is claimed
that the shift register may be filled with zeroes and locked up, which
seems to be true.


So here's my hypothesis: The bleeding between neighbouring bits happens not only for combined waveforms, but for regular noise too. Theoretically, the bit that is shifted into the LFSR is bit 22 EOR bit 17. However, bit 22 is an output bit (it's bit 7 of OSC3). Sometimes a zero will bleed over from OSC3 bit 6 (LFSR bit 20) and upset this computation.

Here's how to falsify it: Record some actual noise sequences (e.g. read OSC3 by REU), and find the places where the output diverges from the theoretical LFSR. In all of these places, if the hypothesis is correct, bit 22 should be 1 and bit 20 should be 0 just before it happens. Otherwise it's back to the drawing board.
2016-08-18 21:00
chatGPZ

Registered: Dec 2001
Posts: 11386
its easier infact - using $f wave when resetting causes 0s to sneak in, using $0 wave instead works reliably :)

see here for progress: https://sourceforge.net/p/vice-emu/bugs/746

(and why would you look at resid 0.16 when there is 1.0 in the trunk already? =P)
2016-08-19 05:10
lft

Registered: Jul 2007
Posts: 369
Quoting Groepaz
its easier infact - using $f wave when resetting causes 0s to sneak in, using $0 wave instead works reliably :)

see here for progress: https://sourceforge.net/p/vice-emu/bugs/746


It's nice that you found a way to consistently reset the lfsr. Still, there's a need for an explanation for how those zeros "sneak in". The link you provided has some interesting information, so thanks for that!

Quoting Groepaz

(and why would you look at resid 0.16 when there is 1.0 in the trunk already? =P)


That's easy: I happen to have 0.16 on disk, so that's the version that my subconsciousness is familiar with. When I got the idea for the hypothesis, it was therefore based on information present in version 0.16. It's not like I deliberately went and downloaded the latest version in order to read it and see if I came up with something; the idea came uninvited, and I documented it.
2016-08-19 12:22
Mixer

Registered: Apr 2008
Posts: 452
One could take a state of the bit 0 of some number read in osc3, that bit state should eventually appear in higher bits when the noise lfsr is clocked. When it appears in the next bit is the sequence in which output bits are in lfsr. Testable. Would prove that the shifting works.

The observation that testbit clear clocks the lfsr once is interesting, one could use low or 0 frequency and clock the lfsr when needed. Testbit will reset the oscillator, but not the noise lfsr. Testable.

Third idea is a question: are the "analog effects" more likely to take place when frq is low, and lfsr state stays the same a long time or when frq is high? Testable.
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
hedning/G★P
Chesser/Blazon
MWR/Visdom
LightSide
Mike
Steffan/BOOM!
t0m3000/hf^boom!^ibx
Trap/Bonzai
4gentE/ΤRIΛD
Perplex/Offence
Walt/Bonzai
REBEL 1/HF
Mibri/ATL^MSL^PRX
Inge/HVSC
Guests online: 121
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Crackers
1 Mr. Z  (9.9)
2 Antitrack  (9.8)
3 OTD  (9.8)
4 Fungus  (9.8)
5 S!R  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.075 sec.