Hi,
Sorry for the stupid question, but does [noise~]'s inlet have any use?
thanks m.
Matteo Sisti Sette wrote:
Hi,
Sorry for the stupid question, but does [noise~]'s inlet have any use?
No. There is nothing in the code to handle anything arriving on that inlet. Also there is no way to change the random sequence -- it's the same every time. So with a teeny bit more code, the inlet could potentially be used to initialize to a different starting point, but it would not change the sound, except for example if you were multiplying two [noise~]s.
Martin
Martin Peach escribió:
Matteo Sisti Sette wrote:
Hi,
Sorry for the stupid question, but does [noise~]'s inlet have any use?
No. There is nothing in the code to handle anything arriving on that inlet. Also there is no way to change the random sequence -- it's the same every time. So with a teeny bit more code, the inlet could potentially be used to initialize to a different starting point, but it would not change the sound, except for example if you were multiplying two [noise~]s.
Yeah, it would be interesting to have the ability to seed the random generator.
Now, just out of curiosity: is there some reason why all dsp objects must have at least an inlet even if it is "useless"? [adc~] also has one inlet that I don't think accepts any method.
Matteo Sisti Sette wrote:
Now, just out of curiosity: is there some reason why all dsp objects must have at least an inlet even if it is "useless"? [adc~] also has one inlet that I don't think accepts any method.
They are instantiated with the parameter CLASS_DEFAULT instead of CLASS_NOINLET, so they have a single inlet. They should work just the same with CLASS_NOINLET. I just made a version of [noise~] with no inlet and it seems to work OK.
Martin
On Sat, 29 May 2010, Martin Peach wrote:
So with a teeny bit more code, the inlet could potentially be used to initialize to a different starting point, but it would not change the sound, except for example if you were multiplying two [noise~]s.
Every [noise~] is initialised with a seed that is 1319 times the previously used seed, mod (1<<32).
x->x_val = (init *= 1319);
Could you please explain what could sound different when multiplying two [noise~] together ?
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
Mathieu Bouchard wrote:
On Sat, 29 May 2010, Martin Peach wrote:
So with a teeny bit more code, the inlet could potentially be used to initialize to a different starting point, but it would not change the sound, except for example if you were multiplying two [noise~]s.
Every [noise~] is initialised with a seed that is 1319 times the previously used seed, mod (1<<32).
x->x_val = (init *= 1319);
Ooops, I missed that init is declared static in noise_new(), so the same variable is used by every instance of [noise~].
Could you please explain what could sound different when multiplying two [noise~] together ?
I doubt if it would sound any different. Subtracting two identical noise signals should result in zero, but since it's very difficult to make two identical [noise~] streams it probably doesn't matter any more.
Martin
On Sat, 29 May 2010, Martin Peach wrote:
Mathieu Bouchard wrote:
x->x_val = (init *= 1319);
Ooops, I missed that init is declared static in noise_new(), so the same variable is used by every instance of [noise~].
right. and then init *= 1319 is a process that loops after pow(2,30) iterations. int is a finite ring, the set of all values of init is a subring of that, therefore its number of elements is a divisor of the number of elements of int (that is, of pow(2,32)), so, another power of two. testing repeated squaring of 1319 mod pow(2,32), you can find that pow(1319,pow(2,30)) = 1 but any smaller power won't equal 1. therefore it takes pow(2,30) more instanciations to get back to the first noise seed.
Could you please explain what could sound different when multiplying two [noise~] together ?
I doubt if it would sound any different. Subtracting two identical noise signals should result in zero, but since it's very difficult to make two identical [noise~] streams it probably doesn't matter any more.
well, another line from the pd source code says :
val = val * 435898247 + 382842987;
this thing loops after pow(2,30) iterations. you can find it like that :
int a = 435898247; int b = 382842987; for (int i=0; i<32; i++) { printf("i=%d a=%d b=%d\n",i,a,b); int newa = a*a; int newb = a*b+b; a = newa; b = newb; }
then I don't recall why val=val*a+b would always loop after a power of two iterations (I know it for b=0), but in this case, it says that pow(2,30) iterations are like val=val, and if there were any smaller number for that, it would be a divisor of pow(2,30), so, we would know from this list anyway.
I don't know any tricks to expose any patterns in the noise, especially as the lower bits are hidden (truncated when converting from int32 to float32). I'm not an expert with that stuff...
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
On Sun, 30 May 2010, Mathieu Bouchard wrote:
then I don't recall why val=val*a+b would always loop after a power of two iterations (I know it for b=0), but in this case, it says that pow(2,30) iterations are like val=val, and if there were any smaller number for that, it would be a divisor of pow(2,30), so, we would know from this list anyway.
even though val loops after pow(2,30) iterations, all the output of [noise~] uses (val & 0x7fffffff) instead of val, which effectively cuts the loop to pow(2,29) iterations :
i=29 a=1 b=-2147483648
because -2147483648 & 0x7fffffff == 0
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
On Sat, 29 May 2010, Matteo Sisti Sette wrote:
Sorry for the stupid question, but does [noise~]'s inlet have any use?
no.
it's just a forgotten CLASS_NOINLET declaration.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801