WCR16

Records the weights for each three-note-follow-up and copies it into the internal array of the "WCG16 module" when you hit "send". vel-input expects a value between 0 and 15, so when, for example, recording velocity, divide it by 4. the vel-input will also be clipped between 0 and 15, so higher/lower values will result in 0 or 15 Connect a midi module note and gate outputs to the note and gate inputs and play a melody. Make sure your last played note makes a connection back to another note played before. When the WCG12/WCG16 hangs on a certain note, this can be altered by playing this note twice on the keyboard, followed up by another note. Press "send" to send the recorded chance-table to the WCG12/WCG16. Press "reset" to reset the recorded table to start a new recording. Press "get" to get the chancetable from the WCG12/16 "core" module so you can alter it. (this way you can alter old recordings "on the fly" while live without losing the original saved settings.)
Author: Remco van der Most
License: BSD
Github: sss/patt/WCR16.axo

Inlets

bool32 gate

int32 vel

Outlets

None

Parameters

bool32.mom send

bool32.mom reset

bool32.mom get

Attributes

objref core

Declaration
static const uint32_t LENGTH = 4096;
int32_t prev;
int32_t PREV;
int i;
int gtrig;
int16_t *array;
int j;
int ctrig;
int rtrig;
int GET;
int Gtrig;
Init
static int16_t _array[LENGTH] __attribute__((section(".sdram")));
array = &_array[0];
for (i = 0; i < LENGTH; i++) {
  array[i] = 0;
}

int prev = 0;
int PREV = 0;
Control Rate
if ((param_reset > 0) && !rtrig) {
  rtrig = 1;
  GET = 0;
  for (i = 0; i < LENGTH; i++) {
    array[i] = 0;
  }
} else if (param_reset == 0) {
  rtrig = 0;
}

if ((param_get > 0) && !Gtrig) {
  Gtrig = 1;
  for (i = 0; i < 256; i++) {
    for (j = 0; j < 16; j++) {
      array[i * 16 + j] = attr_core.array[i * 16 + j];
      if (j > 0) {
        array[i * 16 + j] -= attr_core.array[i * 16 + j - 1];
      }
    }
  }
} else if (param_get == 0) {
  Gtrig = 0;
}
if ((inlet_gate > 0) && !gtrig) {
  gtrig = 1;
  int32_t NOTE = inlet_vel;
  NOTE = NOTE > 15 ? 15 : NOTE;
  NOTE = NOTE < 0 ? 0 : NOTE;
  if (GET == 0) {
    PREV = prev = NOTE;
  }
  array[PREV + prev + NOTE] += 1;
  PREV = prev * 16;
  prev = NOTE * 16;

  GET = 1;
} else if (inlet_gate == 0) {
  gtrig = 0;
}

if ((param_send > 0) && !ctrig) {
  ctrig = 1;
  for (i = 0; i < 256; i++) {
    for (j = 0; j < 16; j++) {
      attr_core.array[i * 16 + j] = array[i * 16 + j];
      if (j > 0) {
        attr_core.array[i * 16 + j] += attr_core.array[i * 16 + j - 1];
      }
    }
  }
} else if (param_send == 0) {
  ctrig = 0;
}

Privacy

© 2024 Zrna Research