/usr/share/SuperCollider/HelpSource/Classes/Spring.schelp is in supercollider-common 1:3.8.0~repack-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | class:: Spring
summary:: physical model of resonating spring
categories:: UGens>Filters>Nonlinear, UGens>Generators>PhysicalModels
related:: Classes/Ball, Classes/TBall
description::
models the force of a resonating spring
classmethods::
method:: ar, kr
argument::in
modulated input force
argument::spring
spring constant (incl. mass)
argument::damp
damping
examples::
code::
// trigger gate is mouse button
// spring constant is mouse x
// mouse y controls damping
(
{
var inforce, outforce, freq, k, d;
inforce = K2A.ar(MouseButton.kr(0,1,0)) > 0;
k = MouseY.kr(0.1, 20, 1);
d = MouseX.kr(0.00001, 0.1, 1);
outforce = Spring.ar(inforce, k, d);
freq = outforce * 400 + 500; // modulate frequency with the force
SinOsc.ar(freq, 0, 0.2)
}.play;
)
// several springs in series.
// trigger gate is mouse button
// spring constant is mouse x
// mouse y controls damping
(
{ var m0, m1, m2, m3, d, k, inforce;
d = MouseY.kr(0.00001, 0.01, 1);
k = MouseX.kr(0.1, 20, 1);
inforce = K2A.ar(MouseButton.kr(0,1,0)) > 0;
m0 = Spring.ar(inforce, k, 0.01);
m1 = Spring.ar(m0, 0.5 * k, d);
m2 = Spring.ar(m0, 0.6 * k + 0.2, d);
m3 = Spring.ar(m1 - m2, 0.4, d);
SinOsc.ar(m3 * 200 + 500, 0, 0.2) // modulate frequency with the force
}.play;
)
// modulating a resonating string with the force
// spring constant is mouse x
// mouse y controls damping
(
{ var m0, m1, m2, m3, m4, d, k, t;
k = MouseX.kr(0.5, 100, 1);
d = MouseY.kr(0.0001, 0.01, 1);
t = Dust.ar(2);
m0 = Spring.ar(ToggleFF.ar(t), 1 * k, 0.01);
m1 = Spring.ar(m0, 0.5 * k, d);
m2 = Spring.ar(m0, 0.6 * k, d);
m3 = Spring.ar([m1,m2], 0.4 * k, d);
m4 = Spring.ar(m3 - m1 + m2, 0.1 * k, d);
CombL.ar(t, 0.1, LinLin.ar(m4, -10, 10, 1/8000, 1/100), 12)
}.play;
)
::
|