1 shot

drives a phasor (saw-wave) for reading/writing data
Author: robert schirmer
License: BSD
Github: rbrt/sdrive/1 shot.axo

Inlets

frac32.bipolar speed modulation

bool32.rising trigger playback

bool32.rising stop playback

frac32.positive offset inside the table

frac32.positive length of the area to index,or loop end

frac32.positive tansposition in semi-notes

Outlets

bool32 playback-state

frac32buffer.positive position inside table

Attributes

spinner forward or reverse

objref table to index

Declaration
uint8_t shift;
uint8_t scale;

uint32_t lrange;

int32_t t_speed;
uint32_t inc;
int32_t index;

bool play;
bool stop;
bool trig;
Init
shift = (27 - attr_wave.LENGTHPOW);
scale = (attr_wave.LENGTHPOW < 6) ? 0 : 4;
Control Rate
MTOFEXTENDED(inlet_transpose + (1 << 22) + 512000, inc);
t_speed = ((___SMMUL(inc, inlet_direction + (attr_direction << 21))) << 5) >>
          (attr_wave.LENGTHPOW - (scale + 2));
lrange = inlet_range << scale;

if (inlet_trigger && (!trig)) {
  play = 1;
  index = (t_speed > 0) ? 0 : lrange;
  trig = 1;
}
if (!inlet_trigger)
  trig = 0;

if (inlet_stop && !stop) {
  play = 0;
  stop = 1;
}
if (!inlet_stop)
  stop = 0;

outlet_play = play;
Audio Rate
if (t_speed > 0) {
  if (index >= lrange)
    play = 0;
} else if (index <= 0)
  play = 0;

outlet_phase = __USAT(((index >> scale) + inlet_offset), 27) * play;
index += t_speed;

Privacy

© 2024 Zrna Research