ldub_NEW

adds data to the content of a table,at inlet pos (in fraction of the table's size).feedback controls feedback amount. set the length of the fade-out period with 'release', the length of the fade-in of the recording with 'attack'.
Author: robert schirmer
License: BSD
Github: rbrt/testing/ldub_NEW.axo

Inlets

frac32buffer.positive index in fraction of table size

frac32buffer audio in

bool32.risingfalling overdub

frac32.positive feedback amount

frac32.positive recording fade-in time

frac32.positive recording fade-out time

Outlets

bool32 recording state with fade-out

Parameters

frac32.u.map feedback

frac32.s.map.kdecaytime.exp attack

frac32.s.map.kdecaytime.exp release

bool32.tgl hard

bool32.tgl nofade

Attributes

objref table

Declaration
uint32_t csample;
uint32_t dub;

uint8_t shift;

int32_t env;
bool dubstate;
uint32_t attack;
uint32_t release;
Init
shift = 27 - attr_table.LENGTHPOW;
Control Rate
attack = inlet_attack + param_attack;
release = inlet_release + param_release;

if (!param_nofade) {
  if (inlet_overdub)
    env = (param_hard) ? -(1 << 27)
                       : (1 << 27) - (___SMMUL((1 << 27) - env, attack) << 1);
  else
    env = ___SMMUL(env, release) << 1;
  dubstate = env;
} else {
  dubstate = inlet_overdub;
  env = 1 << 27;
}

outlet_state = dubstate;
Audio Rate
if (dubstate) {

  csample = (__USAT(inlet_pos, 27) >> shift);
  dub = (___SMMUL((attr_table.array[csample] << attr_table.GAIN),
                  (inlet_feedback + param_feedback))
         << 5);

  attr_table.array[csample] =
      (__SSAT((___SMMUL((inlet_wave), env) << 5) + dub, 28)) >> attr_table.GAIN;
}

Privacy

© 2024 Zrna Research