class: mDust
random impulses
Description
Generates random integer impulses between 0 and 255 at a specified density. Essentially it is gated white noise. Inspired by Dust object in Supercollider.
Template Parameters
template <uint32_t UPDATE_RATE = CONTROL_RATE>UPDATE RATE: how often the .next() function will be called. Defaults to CONTROL_RATE
Class Methods
Constructor
mDust(float density_ = 1)density: average number of non-zero impulses per second
void setDensity(float density_)Sets average number of non-zero impulses per second
int32_t next()Generates a potential impulse and outputs it as an integer between 0 and 255
Example
// global declaration
mDust<AUDIO_RATE> my_dust;
// in updateControl
my_dust.setDensity(meap.pot_vals[0]/10); // use pot 0 to set density between 0 and ~410 impulses per second
//in updateAudio
int32_t out_sample = my_dust.next();