for sampling (grey) values from a function I use a circle. In the first Def I “drive the circle” with SinOsc. That works fine.
But what if I want to do it without SinOsc? In the second example, what should I take for phi? Is there a tick or phase value generated by SuperCollider that can be plugged in for phi?
(
SynthDef.new(\contour1, {
/*:the countour function is sampled on a circle with
given radius and centre coordinates.
Contour function from:
http://www.physics.emory.edu/~weeks/ideas/tplot.html*/
arg a=1,b=1,c=1,d=1,e=1,f=1,i=1,j=1,k=1,l=1 /*:(float) contour function variables)*/
, radius=1, centreX=0, centreY=0 /*:(float) defaults to unit circle at <0,0>*/
, phi /*:(float) phase to sample at*/
, circlefreq=440 /*:(float) speed at which the data on the cirkle is sampled*/
;
var x, y, grey;
x = MouseX.kr(0,100) + (radius * SinOsc.ar(circlefreq));
y = MouseY.kr(0,100) + (radius * SinOsc.ar(circlefreq, pi/2));
grey = e*(a*sin(i*x).sin + b*(j*y).cos) + f*(c*(k*x).cos+d*sin(l*y).sin).cos;
grey = (grey - 0.5) * 0.1;
Out.ar(0, grey!2);
}).add;
)
c = Synth.new(\contour1,[\radius, 10, \circlefreq, 60.0]);
//c = Synth.new(\contour1,[\radius, 10, \circlefreq, 60.0, \b, 4, \i,3]);
(
SynthDef.new(\contour2, {
arg a=1,b=1,c=1,d=1,e=1,f=1,i=1,j=1,k=1,l=1
, radius=1, centreX=0, centreY=0
, phi
;
var x, y, grey;
x = centreX + radius * phi.cos .....? // 1/SampleRate*circlefreq
y = centreY + radius * phi.sin .....?
grey = e*(a*sin(i*x).sin + b*(j*y).cos) + f*(c*(k*x).cos+d*sin(l*y).sin).cos;
}).add;
)
TIA