record speed

Record 4 tracks of audio into a 32bit table. Each track occupies 8bit in size. This implementation allows stretched playback.
Author: Sputnki
License: BSD
Github: sptnk/looper/record speed.axo

Inlets

frac32buffer audio in for track 1

frac32buffer audio in for track 2

frac32buffer audio in for track 3

frac32buffer audio in for track 4

frac32buffer.positive use looper/pos to drive this input

int32.positive use looper/protect to protect specific bits (or you could use this to distort the signal)

int32.positive 0 = idle, 1 = erase, 2 = overwrite, 3 = overdub, 4 = halving overdub, 5.. idle

int32 startpos

int32 endpos

Outlets

None

Attributes

objref the 32b table in which storing tracks

Declaration
uint32_t pos = 0;
uint32_t pos_old = 0;

uint32_t bitmask1 = 0b11111111000000000000000000000000;
uint32_t bitmask2 = 0b00000000111111110000000000000000;
uint32_t bitmask3 = 0b00000000000000001111111100000000;
uint32_t bitmask4 = 0b00000000000000000000000011111111;

int state = 0; // 0 = do nothing; 1 = erase;  2 = overwrite; 3 = overdub; 4 =
               // halving overdub;
Control Rate
uint32_t protected_bits = inlet_protect;

state = inlet_mode; // 0= idle; 1=overwrite; 2=overdub; 3= halving overdub
Audio Rate
pos = __USAT(inlet_pos, 28);

if (pos > attr_table.LENGTH)
  pos = attr_table.LENGTH;

uint32_t table_pos = attr_table.array[pos];

uint32_t input = ((__SSAT(inlet_w1 >> 1, 27) << 5) & bitmask1) |
                 ((__SSAT(inlet_w2 >> 1, 27) >> 3) & bitmask2) |
                 ((__SSAT(inlet_w3 >> 1, 27) >> 11) & bitmask3) |
                 ((__SSAT(inlet_w4 >> 1, 27) >> 19) & bitmask4);
uint32_t temp_out;

switch (state) {
case 1:
  temp_out = 0;
  break; // erasing table
case 2:
  temp_out = input;
  break; // overwriting table
case 3:
  temp_out = __SADD8(table_pos, input);
  break; // overdubbing table
case 4:
  temp_out = __SHADD8(table_pos, input);
  break; // halving overdub
default:
  temp_out = table_pos;
  break; // idle, do nothing
}

while (pos != pos_old) {
  attr_table.array[pos_old++] =
      (temp_out & (~protected_bits)) | (table_pos & protected_bits);
  if (pos_old > inlet_endpos)
    pos_old = inlet_startpos;
}

pos_old = pos;

Privacy

© 2024 Zrna Research