clds

a clouds-like effect, based on open source DSP code from mutable instruments. any bugs/issues you find are our own, report on the axoloti forum. Thanks to Olivier Gillet from Mutable Instruments for open sourcing their code. http://mutable-instruments.com
Author: Mark Harris
License: GPL
Github: fx/clds/clds.axo

Inlets

frac32buffer l

frac32buffer r

bool32 freeze

bool32 mono

bool32 lofi

bool32 silence

bool32 bypass

bool32.rising trig

frac32.bipolar position

frac32.bipolar size

frac32.bipolar pitch

frac32.bipolar density

frac32.bipolar texture

frac32.bipolar mix

frac32.bipolar spread

frac32.bipolar feedback

frac32.bipolar reverb

int32.positive mode

Outlets

frac32buffer l

frac32buffer r

Parameters

frac32.u.map position

frac32.u.map size

frac32.u.map density

frac32.u.map texture

frac32.u.map mix

frac32.u.map spread

frac32.u.map feedback

frac32.u.map reverb

frac32.s.map.pitch pitch

int32.hradio playmode

bool32.tgl mono

bool32.tgl lofi

bool32.tgl silence

bool32.tgl bypass

Attributes

combo large buffer

combo small buffer

Declaration
clouds::GranularProcessor processor;
bool ltrig = false;

inline float constrainQ27(int32_t v, float vMin, float vMax) {
  return std::max<float>(vMin, std::min<float>(vMax, q27_to_float(v)));
}

inline float constrain(float v, float vMin, float vMax) {
  return std::max<float>(vMin, std::min<float>(vMax, v));
}
Init
const int LARGE_BUF = attr_large_space_buffer;
const int SMALL_BUF = attr_small_space_buffer;

uint8_t *large_buff = (uint8_t *)sdram_malloc(LARGE_BUF);
if (!large_buff)
  return;
uint8_t *small_buff = (uint8_t *)sdram_malloc(SMALL_BUF); // ccm usually
if (!small_buff)
  return;

processor.Init(large_buff, LARGE_BUF, small_buff, SMALL_BUF);
ltrig = false;
Control Rate
static clouds::ShortFrame input[BUFSIZE];
static clouds::ShortFrame output[BUFSIZE];

int i;

// for now restrict playback mode to working modes (granular and looping)
// clouds::PlaybackMode mode  = (clouds::PlaybackMode) ((param_playmode +
// inlet_mode) % 4) );
clouds::PlaybackMode mode = (((param_playmode + inlet_mode) % 2) == 0)
                                ? clouds::PLAYBACK_MODE_GRANULAR
                                : clouds::PLAYBACK_MODE_LOOPING_DELAY;
processor.set_playback_mode(mode);

processor.mutable_parameters()->position = constrainQ27(param_position +
                                                            inlet_position,
                                                        0.0f, 1.0f);
processor.mutable_parameters()->size = constrainQ27(param_size + inlet_size,
                                                    0.0f, 1.0f);
processor.mutable_parameters()->texture = constrainQ27(param_texture +
                                                           inlet_texture,
                                                       0.0f, 1.0f);
processor.mutable_parameters()->dry_wet = constrainQ27(param_mix + inlet_mix,
                                                       0.0f, 1.0f);
processor.mutable_parameters()->stereo_spread = constrainQ27(param_spread +
                                                                 inlet_spread,
                                                             0.0f, 1.0f);
processor.mutable_parameters()->feedback = constrainQ27(param_feedback +
                                                            inlet_feedback,
                                                        0.0f, 1.0f);
processor.mutable_parameters()->reverb = constrainQ27(param_reverb +
                                                          inlet_reverb,
                                                      0.0f, 1.0f);

processor.mutable_parameters()->pitch =
    constrain(q27_to_float(param_pitch + inlet_pitch) * 64.0f, -64.0f, 64.0f);

// restrict density to .2 to .8 for granular mode, outside this breaks up
float density = q27_to_float(param_density + inlet_density);
density =
    (mode == clouds::PLAYBACK_MODE_GRANULAR) ? (density * .6) + 0.2 : density;
processor.mutable_parameters()->density = constrain(density, 0.0f, 1.0f);

processor.mutable_parameters()->freeze = inlet_freeze;

// note the trig input is really a gate... which then feeds the trig
processor.mutable_parameters()->gate = inlet_trig;

bool trig = false;
if (inlet_trig && !ltrig) {
  ltrig = true;
  trig = true;
} else if (!inlet_trig) {
  ltrig = false;
}
processor.mutable_parameters()->trigger = trig;

processor.set_bypass(param_bypass || inlet_bypass);
processor.set_silence(param_silence || inlet_silence);
processor.set_num_channels((param_mono || inlet_mono) ? 1 : 2);
processor.set_low_fidelity(param_lofi || inlet_lofi);

for (i = 0; i < BUFSIZE; i++) {
  input[i].l = inlet_l[i] >> 17;
  input[i].r = inlet_r[i] >> 17;
}

processor.Prepare();
processor.Process(input, output, BUFSIZE);

for (i = 0; i < BUFSIZE; i++) {
  outlet_l[i] = output[i].l << 17;
  outlet_r[i] = output[i].r << 17;
}

Privacy

© 2024 Zrna Research