songsetup

(USE WITH THE MODULE: patt/songtracker) a songtracker to create songs a song is divided into parts where each part is divided in bars, bars in measures and measures in steps. Each part has it's own settings for: -nominator (steps in measure) -denominator (rate within the measure based on main tempo) -amount of measures within a bar -amount of bars within the part -whether the part loops back to another part (repeating several parts as a whole) -which part to loop back to -how many times this loop has to be performed before going further to the next part after the loop. (don't loop back within another loop, otherwise it will loop endlessly) the remaining controls set the last part of the song and whether the song will repeat after the last part has been played These two modules should be able to setup whole songs (hopefully)
Author: Remco van der Most
License: BSD
Github: sss/patt/songsetup.axo

Inlets

int32 selects the part to copy from

bool32 copies the current part to the next part (useful for quick polyrhythmic variations)

bool32 copies the part selected with the "from" input to the current input.

bool32 when triggered, updates the controls to the internal array (eg. when you load a song from SDcard->connect load button to this input)

Outlets

None

Parameters

int32 selects part in the song to edit

int32 selects a preset for this part

int32 selects the amount of steps per measure for this part

int32 selects the rate of the measure for this part (measure can be understood as the "beat", denominator sets division of this "beat")

int32 selects the amount of measures per bar for this part

int32 selects the amount of bars for this part

int32 selects the part to which the song has to return when this part has ended

int32 selects how many times the parts must loop before continuing to the next part

int32 selects the last part of the song

bool32.tgl when high and the loopmax hasn't been reach yet, sends the song back to the selected part

bool32.tgl when high, restarts the song at start position. When low, song stops playing after the last part has been played

Attributes

combo size

Displays

int32.label length

Declaration
static const uint32_t LENGTHPOW = (attr_size);
static const uint32_t LENGTH = (1 << attr_size);
static const uint32_t LENGTHMASK = ((1 << attr_size) - 1);
static const uint32_t BITS = 8;
static const uint32_t GAIN = 20;
int8_t *array;
int part, i, max;
bool upd, DO, loop, copy, from;
int32_t total, ptotal;
Init
static int8_t _array[LENGTH << 3] __attribute__((section(".sdram")));
array = &_array[0];

//  for(i=0;i<LENGTH<<3;i++){ array[i]=0;
//}

part = 8;
DO = 0;
Control Rate
if (inlet_update && !upd) {
  upd = 1;
  DO = 1;
} else if (upd && !inlet_update) {
  upd = 0;
}

if ((!((param_part - 1 << 3) == part)) || DO) {
  part = param_part - 1 << 3;
  for (i = 0; i < 8; i++) {
    PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_preset + i],
                       array[part + i] + (!(i == 5) ? 1 : 0), 0xFFFD);
  }
  if (DO) {
    DO = 0;
  }
}

if (inlet_copy2next && !copy) {
  copy = 1;
  for (i = 0; i < 8; i++) {
    array[part + i + 8] = array[part + i];
  }
} else if (copy && !inlet_copy2next) {
  copy = 0;
}

if (inlet_copyfrom && !from) {
  from = 1;
  for (i = 0; i < 8; i++) {
    array[part + i] = array[i + (inlet_from << 3)];
  }
} else if (from && !inlet_copyfrom) {
  from = 0;
}

loop = param_loopparts;
max = param_lastpart - 1;
array[part] = param_preset - 1;
array[part + 1] = param_nominator - 1;
array[part + 2] = param_denominator - 1;
array[part + 3] = param_measures - 1;
array[part + 4] = param_bars - 1;
array[part + 5] = param_loopback;
array[part + 6] = param_loop2part - 1;
array[part + 7] = param_loops - 1;
total = 0;
for (i = 0; i < 8; i++) {
  total += array[part + i];
}
if ((!(ptotal == total)) && (param_part > param_lastpart)) {
  PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_lastpart],
                     param_part, 0xFFFD);
}

ptotal = total;

Privacy

© 2024 Zrna Research