BPMctrl

BPM LFO controller outputs a pitch-offset corresponding to the BPM-ratio of the BPM-control to the BPM-base. Slow down your synthesizing sequence tapestyle!
Author: Remco van der Most
License: BSD
Github: sss/lfo/BPMctrl.axo

Inlets

None

Outlets

frac32 pitch

int32 BPM

Parameters

int32 BPMbase

int32 BPMctrl

bool32.tgl link

Declaration
int32_t out;
int32_t LOG(int32_t in) {
  Float_t f;
  f.f = in;
  int32_t r1 = ((f.parts.exponent & 0x7F) - 18) << 24;
  int32_t r3 = logt[f.parts.mantissa >> 15] << 10;
  out = r1 + r3;
}

int32_t FTOM(int32_t freq) {
  int32_t ptch;
  int32_t mid;
  MTOFEXTENDED(0, mid);
  LOG(mid);
  mid = out;

  int32_t to;
  LOG(freq);
  to = out;
  return ptch = (to - mid >> 1) * 3;
};
Control Rate
int32_t pitch;

int32_t freq;
MTOFEXTENDED(0, freq)
float32_t ratio;
ratio = (float32_t)param_BPMctrl / param_BPMbase;
if (param_link > 0) {
  freq = freq * ratio;
} else {
  PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_BPMbase],
                     param_BPMctrl, 0xFFFD);
}
outlet_pitch = FTOM(freq);
outlet_BPM = param_BPMctrl;

Privacy

© 2024 Zrna Research