TM185Seq

Turing Machine Random Looping Sequencer (note) with Roland M185 Sequencer style (rhythm). https://musicthing.co.uk/random-sequencer-documentation/ https://www.matrixsynth.com/2009/05/roland-100m-m185-mkii-sequencer.html
Author: Jérôme Burlando
License: BSD
Github: gao/seq/TM185Seq.axo

Inlets

bool32.rising clock in

Outlets

bool32 trig

frac32 note

Parameters

frac32.u.map random

Declaration
uint8_t ntrig;
int8_t pc;  // pulse counter [0..7]
uint8_t gm; // gate mode [0..3] 0 : silence, 1 : one trig, 2 : multiple trig, 3
            // : long trig
uint32_t note;
uint8_t trig;
uint8_t ft; // first trig
uint8_t buf;
uint8_t newbit;

uint8_t noiseGen(uint8_t in) {
  return (((((in >> 7) ^ (in >> 5)) ^ (in >> 4)) ^ in) & 1) | (in << 1);
}
Init
ntrig = 0;
pc = 0;
gm = 0;
note = 0;
trig = 0;
ft = 0;
buf = 0;
newbit = 0;
Control Rate
trig = 0;
if ((gm == 3) || (gm == 2) || ((gm == 1) && (ft == 1)))
  trig = 1;

if ((inlet_trig > 0) && !ntrig) {
  ntrig = 1;
  if (pc < 1) {
    if ((GenerateRandomNumber() % 255) < (param_random >> 19)) {
      newbit = ~buf & 0x1;
    } else {
      newbit = buf & 0x1;
    }
    buf = (buf >> 1) | (newbit << 7);

    if (buf & 128)
      note = -((buf & 0x7F) << 20);
    else
      note = (buf << 20);

    pc = noiseGen(buf) >> 5;
    gm = noiseGen(noiseGen(buf)) >> 6;
    trig = 0;
    ft = 1;
    // LogTextMessage("buf(%x)\tpc(%d)\tgm(%d)\n", buf, pc, gm);
  } else {
    ft = 0;
  }
  if (gm == 2)
    trig = 0; // multiple trig
  pc--;
}
if (!(inlet_trig > 0))
  ntrig = 0;

outlet_trig = trig;
outlet_note = note;

Privacy

© 2024 Zrna Research