lfsrburst 6 b

lfsr burst, 6bit = 63 samples, audio rate
Author: Johannes Taelman
License: BSD
Github: pulse/lfsrburst 6 b.axo

Inlets

bool32.rising trigger

Outlets

frac32buffer.bipolar lfs burst

Attributes

combo polynomial

Declaration
uint32_t state;
int32_t count;
int32_t ntrig;
Init
state = 0;
count = 0;
ntrig = 0;
Control Rate
if ((inlet_trig > 0) && !ntrig) {
  state = 1;
  count = 63;
  ntrig = 1;
} else {
  if (!(inlet_trig > 0))
    ntrig = 0;
}
Audio Rate
if (count > 0) {
  count--;
  if (state & 1) {
    state = (state >> 1) ^ attr_polynomial;
    outlet_out = 1 << 27;
  } else {
    state = (state >> 1);
    outlet_out = -1 << 27;
  }
} else
  outlet_out = 0;

Privacy

© 2024 Zrna Research