pianobar

Polyphonic piano-bar sequencer with 3 velocity levels (set with pianoDecoder). Retriggers if velocity changes, even when gates are connected, otherwise, if same velocity, sustains the gate. Used in combination with the pianoDecoder which outputs polyphonic midi internally/externally.
Author: Remco van der Most
License: BSD
Github: sss/seq/pianobar.axo

Inlets

bool32 clear pattern

int32 chainable counter input

int32 select octave

frac32buffer chainable notes input

Outlets

int32 chain

frac32buffer notes

Parameters

bool32.mom clear pattern

int32 select octave

int2x16 B

int2x16 Bb

int2x16 A

int2x16 Ab

int2x16 G

int2x16 Gb

int2x16 F

int2x16 E

int2x16 Eb

int2x16 D

int2x16 Db

int2x16 C

Displays

int32.bar16 count

Declaration
static const uint32_t LENGTH = 72;
int32_t *array;
int i;
uint32_t prv;
int32_t sel;
bool clr;
Init
static int32_t _array[72] __attribute__((section(".sdram")));
array = &_array[0];
Control Rate
int oct = param_oct + inlet_oct;
oct = oct < 0 ? 0 : (param_oct > 5 ? 5 : oct);
int clear = param_clear || inlet_clear;
if (clear && !clr) {
  clr = 1;
  sel = -1;
  for (i = 0; i < 72; i++) {
    array[i] = 0;
  }
} else if (!clear) {
  clr = 0;
}

if (!(oct * 12 == sel)) {
  sel = oct * 12;
  for (i = 0; i < 12; i++) {
    PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_C - i],
                       array[i + sel], 0xFFFD);
  }
}
disp_count = inlet_count;
int32_t sum = param_B + param_Bb + param_A + param_Ab + param_G + param_Gb +
              param_F + param_E + param_Eb + param_D + param_Db + param_C;
if (!(prv == sum)) {
  array[sel] = param_C;
  array[sel + 1] = param_Db;
  array[sel + 2] = param_D;
  array[sel + 3] = param_Eb;
  array[sel + 4] = param_E;
  array[sel + 5] = param_F;
  array[sel + 6] = param_Gb;
  array[sel + 7] = param_G;
  array[sel + 8] = param_Ab;
  array[sel + 9] = param_A;
  array[sel + 10] = param_Bb;
  array[sel + 11] = param_B;
}
prv = sum;

int32_t cnt = inlet_count;
for (int j = 0; j < 12; j++) {
  outlet_notes[j] = 0;
}

if ((cnt > -1) && (cnt < 32)) {
  for (i = 0; i < 6; i++) {
    int k = i * 12;
    for (int j = 0; j < 12; j++) {
      outlet_notes[j] += (((array[j + k] >> (cnt << 1)) & 1) ||
                          ((inlet_notes[j] >> (cnt << 1)) & 1))
                         << (i << 1);
      outlet_notes[j] += (((array[j + k] >> ((cnt << 1) + 1)) & 1) ||
                          ((inlet_notes[j] >> ((cnt << 1) + 1)) & 1))
                         << ((i << 1) + 1);
    }
  }
} else {
  for (i = 0; i < 12; i++) {
    outlet_notes[i] = inlet_notes[i];
  }
}
outlet_chain = inlet_count - 16;

Privacy

© 2024 Zrna Research