# Lissajous study

just dialling in the alg I’ve been using to generate some Lissajous curves:

7 Likes

really enjoyed this one.
ive once worked on Vector Phase Shaping Synthesis related to this paper https://www.researchgate.net/publication/236616428_Vector_Phaseshaping_Synthesis
in chapter 4.3 you also find Lissajous Modulation.
would you like to share some code, how this is done?

``````(
var nearestEven, nearestOdd, vps;

nearestEven = {
arg val;
var val_floor, val_ceil, res, distance;
val_floor = val.floor;
val_ceil = val.ceil;
res = Select.ar(val % 2,
[ val_floor, val_ceil ],
);
distance = (val - res).abs;
[ res, distance ];
};

nearestOdd = {
arg val;
var val_floor, val_ceil, res, distance;
val_floor = val.floor;
val_ceil = val.ceil;
res = Select.ar(val + 1 % 2,
[ val_floor, val_ceil ],
);
distance = (val - res).abs;
[ res, distance ];
};

vps = { |trig, freq, horizontal, vertical|
var vertical_even = nearestEven.(vertical);
var vertical_odd = nearestOdd.(vertical);
var cos, phasor, sig;
vertical = [vertical_even[0], vertical_odd[0]];
phasor = Phasor.ar(Impulse.ar(trig), freq/2 * SampleDur.ir, horizontal.neg, 1-horizontal, horizontal.neg);
phasor = phasor.bilin(0, horizontal.neg, 1-horizontal, vertical, 0, 1);
cos = (phasor * 2pi).cos.neg;
sig = XFade2.ar(cos[0], cos[1], vertical_even[1] * 2 - 1);
sig = LeakDC.ar(sig);
sig;
};

{
var freq = \freq.kr(110);
var horizontal = MouseX.kr(0.01,0.99);
var vertical = K2A.ar(MouseY.kr(1.0,10.0));
var sig = vps.(0, freq,  horizontal, vertical);
sig!2 * 0.1;