Plays a spline along one dimension for use in automation and control rate modulation. This is the equivalent of EnvGen
This technique interpolates the spline along one dimension (usually X) producing values for Y that are then passed to a LocalBuf and embeded in the SynthDef and played with a BufRd.
A SplineInterpolator class is planned that will allow live updating from the gui to a buffer on the server. At present I am using SplineFr (frame rate device) and playing the spline in the language, messaging control changes to the server. This allows relocating and live editing and patching. The cost is more communication with the server. I run it at 24/fps.
spline |
any Spline subclass. |
dimension |
The dimension that represents time. Usually 0 |
loop |
boolean: can loop the control back to the beginning |
(returnvalue)
get/set spline
(returnvalue)
get/set the dimension that represents time. Usually 0. The value dimension is then considered to be 1.
Integer
get/set loop
Boolean
(describe method here)
(returnvalue)
Total time length of the spline. Using the default values for the play methods kr etc. then time will be in seconds.
float
Returns a LocalBuf with the spline as an interpolated lookup table. Must be called from within a SynthDef
divisions |
Number of interpolated values in the Buffer. |
a LocalBuf
Like EnvGen.kr(env), this plays the spline.
timeScale |
If timeScale is tempo then the x values are beats. eg. Tempo.tempo |
doneAction |
Like EnvGen etc. |
divisions |
Total number of points in the interpolation |
control rate (a BufRd.kr)
s.boot; // BSpline ( b = BSpline([ [ 0, 2.275 ], [ 1, 1 ], [ 2.5102880658436, 3.1 ], [ 4, 4 ] ], 2.0, false); b.gui(nil,1000@300); ) ( { PinkNoise.ar * SplineGen(b).kr(doneAction:2) }.play ) // Linear ( b = LinearSpline( Array.fill(60,{ arg i; [ i,1.0.rand ] }) ); b.gui(nil,1200@300); ) ( { PinkNoise.ar * SplineGen(b).kr(doneAction:2) }.play )
Plays the spline with a modulatable position input.
position |
kr modulator in X units (seconds) |
timeScale |
Default 1.0 means that x units are seconds. If timeScale is tempo (bps) then the x values are beats. eg. Tempo.tempo |
divisions |
Total number of points in the interpolation |
control rate (a BufRd.kr)
Returns an array of kr following each dimension. Returns as many dimensions as your spline have, not just xy as the name implies.
Time is the path along the spine of the spline. The total tangent length along spline could be summed to figure out the length of time needed for one oscillation, but that would only be calculatable if it is 2 dimensions. So just crank the speed up until you like it.
speed |
float. how fast. range ? that depends |
divisions |
Total number of points in the interpolation |
rate |
'kr' or 'ar' see also SplineOsc |
control or audio rate BufRd
( b = BSpline( Array.fill(8,{ arg i; [ exprand(40,500),1.0.rand ] }), 3.0,false ); b.gui(nil,1200@300); ) ( { # f , w = SplineGen(b,0,loop:true).xyKr(MouseY.kr(0.1,20),32); Pulse.ar(f.clip(40,500),w.clip(0.0,1.0),0.4).dup }.play ) b.interpolate(32).flop.plot
( //Its not the spline that loops (that would be a loop in 2 dimensional space) but the SplineGen that is set to loop. // the spline does NOT loop, b = BSpline( Array.fill(16,{ arg i; [ i * 0.25,1.0.rand ] }), 3.0,false ); b.gui(nil,1200@300); ) ( // the SplineGen loops { Saw.ar(SplineGen(b,loop:true).kr.linexp(0.0,1.0,40,500).clip(40,500)).dup * 0.4 }.play )