looper_OD_mono

a looper with overdub,has sync outputs for playback position and loop length (in samples)
Author: Robert Schirmer
License: who cares
Github: rbrt/old/looper_OD_mono.axo

Inlets

frac32buffer audio in

bool32.risingfalling record

bool32.risingfalling play (should be set to '1' normally)

bool32.risingfalling overdub

Outlets

int32 playback position

int32 loop length

frac32buffer audio out

Attributes

objref table

Declaration
bool rec;
bool play;
bool play_logic;
bool dub;
int playpos;
int recpos;
int length;
Init
playpos = 0;
recpos = 0;
rec = 0;
play = 0;
dub = 0;
length = 0;
Control Rate
// I guess this  ((inlet_rec>0) && !rec)
// resets pos to 0 everytime rec goes from 0 to 1

// record
if ((inlet_rec > 0) && !rec) {
  rec = 1;
  recpos = 0;
  length = 0;
} else if (!(inlet_rec > 0)) {
  rec = 0;
  length = recpos;
}

// play
play_logic = (!inlet_rec && inlet_play);
if ((play_logic > 0) && !play) {
  play = 1;
  playpos = 0;
} else if (!(play_logic > 0)) {
  play = 0;
}

// dub
dub = (play_logic && inlet_dub);

outlet_pos = playpos;
outlet_length = length;
Audio Rate
// record
if (rec) {
  if (recpos < attr_table.LENGTH)
    attr_table.array[recpos++] = __SSAT(inlet_wave, 28) >> attr_table.GAIN;
}

// play
if (play) {
  if (!(playpos == length))
    playpos == playpos++;
  else
    playpos = 0;
  if (!(playpos == length))
    outlet_wave = attr_table.array[playpos] << attr_table.GAIN;
  else
    outlet_wave = 0;
}

else
  outlet_wave = 0;

// overdub
if (dub) {

  attr_table.array[playpos] = (attr_table.array[playpos] << attr_table.GAIN) +
                              (__SSAT(inlet_wave, 28) >> attr_table.GAIN);
}

Privacy

© 2024 Zrna Research