Hi, Bob. You could reduce the rate of a process by using sample-and-hold functions as in the example below:
import("stdfaust.lib"); mynoise(seed, period) = random / RANDMAX with { mask = 4294967295; // 2^32-1 random = +(seed) ~ ba.sAndH(clock, *(1103515245) & mask); // "linear congruential" clock = ba.period(period) == 0; RANDMAX = 2147483647.0; // = 2^31-1 = MAX_SIGNED_INT in 32 bits }; process = mynoise(12345, ma.SR); // a different value every second If you just want a single random value, perhaps at the very beginning of your process, you could just sample-and-hold a magnified and fmod-ed version of whatever is in your ADC: import("stdfaust.lib"); init_rand(x) = ba.sAndH(1 - 1', fmod(x * 2 ^ 20, 1)); // some 120 dB gain process(x) = init_rand(x); I wouldn't know how else to get a random value at time index 0 in Faust. I hope it helps. Dr Dario Sanfilippo http://dariosanfilippo.com On Thu, 6 May 2021 at 02:19, Bob Bobsled <thebobbobs...@gmail.com> wrote: > > Hi, > I've pondered this code for a while, and am failing to understand how to > declare a variable which has a single random value. Of course this code > creates random values at the sample rate. How would you get just one value > instead of a constant stream of values? > > mynoise = random / RANDMAX > with{ > mask = 4294967295; // 2^32-1 > random = +(12345) ~ *(1103515245) & mask; // "linear congruential" > RANDMAX = 2147483647.0; // = 2^31-1 = MAX_SIGNED_INT in 32 bits > }; > process = mynoise; > > In other words, one would like to be able to do something such as this: > process = os.osc(myrandomvalue); > > I understand there are various ways to provide frequencies, graphical and > non-graphical. What I'm fundamentally searching for is how to declare a > variable with a single random value. I cannot seem to figure out how to > slow down or stop things from flowing at the SR other than set SR to 1. > > Regards, > Bob > _______________________________________________ > Faudiostream-users mailing list > Faudiostream-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/faudiostream-users >
_______________________________________________ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users