blepSlave

Multi wave oscillator with sync and FM modulation Bandwith limited
Author: Remco van der Most
License: BSD
Github: sss/osc/blepSlave.axo

Inlets

int32 wave

frac32.bipolar pitch

frac32buffer sync, resets oscillator phase on rising zero-crossing

frac32buffer mod

Outlets

frac32buffer.bipolar saw wave, anti-aliased

frac32 pitch

Parameters

frac32.s.map.pitch pitch

int32.hradio wave

frac32.s.map fm

bool32.tgl snc

Attributes

objref core

Declaration
int32_t osc_p;
uint32_t uosc_p;
static const int blepvoices = 8;
const int16_t *uoscp[blepvoices];
int16_t *oscp[blepvoices];
int32_t vgain[blepvoices];
uint32_t nextvoice;
int32_t i0;
int i;
Init
int j;
for (j = 0; j < blepvoices; j++)
  oscp[j] = &blept[BLEPSIZE - 1];
nextvoice = 0;
i0 = 0;
Control Rate
for (i = 0; i < blepvoices; i++) {
  attr_core.oscp[i] = oscp[i];
  attr_core.uoscp[i] = uoscp[i];
  attr_core.vgain[i] = vgain[i];
}
for (i = 0; i < BUFSIZE; i++) {
  attr_core.sync[i] = param_snc > 0 ? inlet_sync[i] : 0;
  attr_core.mod[i] = ___SMMUL(inlet_mod[i] << 2, param_fm << 3);
}
attr_core.i0 = i0;
attr_core.osc_p = osc_p;
attr_core.uosc_p = uosc_p;
attr_core.nextvoice = nextvoice;
int wave = (param_wave + inlet_wave) & 3;
switch (wave) {
case 0:
  attr_core.OSC_SIN(param_pitch + inlet_pitch);
  break;
case 1:
  attr_core.OSC_TRI(param_pitch + inlet_pitch);
  break;
case 2:
  attr_core.OSC_SAW(param_pitch + inlet_pitch);
  break;
case 3:
  attr_core.OSC_SQR(param_pitch + inlet_pitch);
  break;
}
for (i = 0; i < BUFSIZE; i++) {
  outlet_wave[i] = attr_core.wave[i];
}
for (i = 0; i < blepvoices; i++) {
  oscp[i] = attr_core.oscp[i];
  uoscp[i] = attr_core.uoscp[i];
  vgain[i] = attr_core.vgain[i];
}
i0 = attr_core.i0;
osc_p = attr_core.osc_p;
uosc_p = attr_core.uosc_p;
nextvoice = attr_core.nextvoice;

outlet_pitch = param_pitch + inlet_pitch;

Privacy

© 2024 Zrna Research