livePlayer

live sample player to be used with the liveRecord module. -play triggers the selected splice to play -splice selects the splice to play -when repeat is on, repeats selected splice -octave offsets the play-rate in octaves -pitch offsets the playrate in normal semitone pitch -reverse inverses play direction -"demix" parameter ducks the "thru" when play goes high
Author: Remco van der Most
License: BSD
Github: sss/sampler/livePlayer.axo

Inlets

frac32buffer delay time (fraction of total delayline size)

bool32 when high, plays the selected splice till it ends or till repeat and gate go low

bool32 when high, will repeat the slice while gate is high

bool32 when high, reverses the play direction of the splice

int32 selects splice

int32 offsets the playrate in octaves

frac32 normal semitone control to control sample playrate

Outlets

frac32buffer wave

Parameters

frac32.s.map offsets the playrate of the splice (0=normal rate)

frac32.u.map.gain when high, mixes out the dry signal when play goes high

Attributes

objref this should refer to a 16bit table allocator (sdram)

objref this should refer to a 32bit table allocator

Declaration
int splice;
int32_t phs;
bool play;
uint32_t width;
uint32_t offset;
uint32_t frq;
uint32_t base;
float32_t r1;
Control Rate
int spls = attr_starts.array[0];
if (spls > 0) {
  splice = inlet_splice;
  splice = splice - splice / spls * spls;
  splice += (splice < 0 ? spls : 0) + 1;

  if ((inlet_play > 0) && !play) {
    play = 1;
    phs = 0;
  } else if (inlet_play == 0) {
    play = 0;
  }

  width = attr_starts.array[splice] -
              (splice > 1 ? attr_starts.array[splice - 1] : 0)
          << 1;
  offset = (splice > 1 ? attr_starts.array[splice - 1] : 0);

  MTOFEXTENDED(param_pitch + inlet_pitch, frq)

  MTOFEXTENDED(0, base)

  r1 = (float32_t)frq / base;

  frq = ((int64_t)1 << 32) / width * r1;
  frq = inlet_octave > 0 ? frq << inlet_octave : frq >> -inlet_octave;
}
Audio Rate
if (spls > 0) {
  int32_t tmp_r = 0;
  if ((inlet_play > 0) && (phs >= 0)) {
    phs += frq;
    uint32_t pos =
        ___SMMUL(inlet_reverse > 0 ? (1 << 31) - phs : phs, width) + offset;
    tmp_r = attr_samples.array[pos & attr_samples.LENGTHMASK] << 14;
    if (inlet_repeat > 0) {
      phs = phs < 0 ? 0 : phs;
    }
  }

  outlet_out =
      inlet_in +
      (___SMMUL(inlet_play << 30, tmp_r - ___SMMUL(inlet_in << 1, param_demix))
       << 2);
} else {
  outlet_out = inlet_in;
}

Privacy

© 2024 Zrna Research