read lissajous

Reads a table and "wraps it around a circle". Basically it draws the table content along a circular path. Can be useful for some lissajous experiments.
Author: Sputnki
License: BSD
Github: sptnk/table/read lissajous.axo

Inlets

frac32 pitch mod input

frac32 phase mod input (beginning of the table)

frac32 gain mod input (radial gain of the table)

frac32 offset mod input (radial offset of the table)

frac32 x mod input (x offset of the figure)

frac32 y mod input (y offset of the figure)

frac32buffer frequency modulation input

int32 table read multiplier (how many times the table is read in one full rotation, overrides the parameter)

int32 x coordinate multiplier (overrides parameter)

int32 y coordinate multiplier (overrides parameter)

Outlets

frac32buffer output of the x coordinate

frac32buffer output of the y coordinate

Parameters

frac32.s.map pitch of the oscillator

frac32.s.map radial offset of the table

frac32.s.map x offset of the figure

frac32.s.map y offset of the figure

frac32.u.map initial read position of the table. This rotates the figure.

frac32.u.map radial gain of the table

int32 table read multiplier (how many times the table is read in one full rotation)

int32 x coordinate multiplier

int32 y coordinate multiplier

Attributes

objref table to read

Declaration
uint32_t counter = 0;

int32_t phase;
int32_t gain;
int32_t offset;
int32_t x;
int32_t y;
int32_t tmul;
int32_t xmul;
int32_t ymul;
Control Rate
uint32_t freq;
MTOFEXTENDED(param_pitch + inlet_pitch, freq);

int32_t phase_inc = param_phase + inlet_phase - phase >>
                    4; // this stuff is needed for interpolation
int32_t gain_inc = param_gain + inlet_gain - gain >> 4;
int32_t offset_inc = param_offset + inlet_offset - offset >> 4;
int32_t x_inc = param_x + inlet_x - x >> 4;
int32_t y_inc = param_y + inlet_y - y >> 4;
tmul = inlet_tmul ? inlet_tmul : param_tmul;
xmul = inlet_xmul ? inlet_xmul : param_xmul;
ymul = inlet_ymul ? inlet_ymul : param_ymul;

for (int i = 0; i < BUFSIZE; i++) {
  counter += (freq >> 0) + inlet_fm[i]; // taken from osc/phasor.

  int32_t rx;
  int32_t ry;

  SINE2TINTERP((counter * xmul) + (1 << 30),
               rx); // this generates a couple of quadrature sines
  SINE2TINTERP((counter * ymul), ry);

  // this section of code is copied from table/read interp
  uint32_t asat = ((phase << 5) + counter * tmul >> 5);
  int index = asat >> (27 - attr_table.LENGTHPOW);
  int32_t y1 = attr_table.array[index] << attr_table.GAIN;
  int32_t y2 = attr_table.array[(index + 1) & attr_table.LENGTHMASK]
               << attr_table.GAIN;
  int frac = (asat - (index << (27 - attr_table.LENGTHPOW)))
             << (attr_table.LENGTHPOW + 3);
  int32_t rr;
  rr = ___SMMUL(y1, (1 << 30) - frac);
  rr = ___SMMLA(___SMMLA(y2, frac, rr) << 4, gain << 2,
                offset); // multiplying the table_read output by radial gain and
                         // offsetting radially

  outlet_x[i] = ___SMMLA(rx >> 2, rr << 3, x); // outputting off-set coordinates
  outlet_y[i] = ___SMMLA(ry >> 2, rr << 3, y);

  phase += phase_inc; // interpolating inlets
  gain += gain_inc;
  offset += offset_inc;
  x += x_inc;
  y += y_inc;
}

Privacy

© 2024 Zrna Research