lissajous

Lissajous oscillator: generates a pair of x/y coordinates based on sinusoidal signals.
Author: Sputnki
License: BSD
Github: sptnk/osc/lissajous.axo

Inlets

int32.positive multiplier for the x coordinate (override param)

int32.positive multiplier for the y coordinate (override param)

frac32 the pitch of the oscillator

frac32 x offset for the figure

frac32 y offset for the figure

frac32 radius of the figure

frac32buffer fm input

Outlets

frac32buffer x coordinate output

frac32buffer y coordinate output

Parameters

frac32.s.map x offset of the figure

frac32.s.map y offset of the figure

frac32.u.map radius of the figure

int32 multiplier for the x coordinate oscillator

int32 multiplier for the y coordinate oscillator

int32 phase difference between oscs. By default 0 corresponds to a 90 degree difference

frac32.s.map.pitch pitch of the oscillator

Declaration
uint32_t Phase;

int32_t x = 0;
int32_t y = 0;
int32_t radius = 0;
Init
Phase = 0;
Control Rate
uint32_t freq;
MTOFEXTENDED(param_pitch + inlet_pitch, freq);

int32_t increment_x = inlet_x + param_x - x >> 4;
int32_t increment_y = inlet_y + param_y - y >> 4;
int32_t increment_radius = param_radius + inlet_radius - radius >> 4;

int32_t angle = (1 << 30) - param_phase * ((1 << 30) / 90);

int32_t xmul = inlet_xmul ? inlet_xmul : param_xmul;
int32_t ymul = inlet_ymul ? inlet_ymul : param_ymul;

for (int i = 0; i < BUFSIZE; i++) {
  Phase += (freq >> 0) + inlet_freq[i];

  int32_t rx;
  int32_t ry;

  SINE2TINTERP((xmul * Phase) + angle, rx);
  SINE2TINTERP((ymul * Phase), ry);
  outlet_x[i] = ___SMMLA(rx >> 2, radius << 3, x);
  outlet_y[i] = ___SMMLA(ry >> 2, radius << 3, y);

  x += increment_x;
  y += increment_y;
  radius += increment_radius;
}

Privacy

© 2024 Zrna Research