note play

play back a sequence recorded with 'note rec'
Author: Robert Schirmer
License: BSD
Github: rbrt/seq/note play.axo

Inlets

bool32.rising stop all active notes

int32.positive index (0 - 512)

bool32.risingfalling start/stop

Outlets

int32 note

int32 velocity

Attributes

objref table

Declaration
uint16_t v;
uint16_t vout;
bool play;
uint8_t active[128];
uint8_t note;
uint8_t velo;
uint8_t i;
Init
i = 128;
Control Rate
if (inlet_play && !play)
  play = 1;

if (play) {
  v = attr_table.array[inlet_index];
  if (v && (v != vout)) {
    vout = v;
    note = (vout & 127) - 1;
    velo = vout >> 8;
    active[note] = 1;
  }
}
if (!inlet_play && play) {
  play = 0;
  i = 0;
}
if (inlet_stopall)
  i = 0;

if (i < 128) {
  if (active[i] > 0) {
    note = i;
    velo = 0;
    active[i] = 0;
  }
  i++;
}
outlet_note = note;
outlet_velocity = velo;

Privacy

© 2024 Zrna Research