-
-
Save zeffii/7850336 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CurveTable: flexible Curve/Line Segment table generator | |
// make one | |
CurveTable c; | |
// coeffs are all FLOATS, specifying proportional times, values, and curvature: | |
// [time0, value0, curvature to next, time1, value1, curvature,.. | |
// timeN-1, valueN-1, curvaturen-1, timeN, valueN] | |
// times => ascending unitless values (NOT Chuck Time values) | |
// values => whatever | |
// curvature(0) => linear | |
// curvature(<0) => convex | |
// curvature(>0) => concave | |
// see: | |
// http://www.music.columbia.edu/cmc/Rtcmix/docs/scorefile/maketable.html#curve | |
// for more documentation | |
// set | |
[0., 110, -.98, 1.0, 1.] => c.coefs; | |
// create an envelope to scan through the table values | |
ADSR e => blackhole; | |
e.set( 0::ms, 431::ms, 0.0, 135::ms ); //a, d, s, r | |
e.keyOn(1); //ramp to 1 in 10 seconds | |
//e.keyOff(); //ramp to 1 in 10 seconds | |
ADSR volE; | |
volE.set( 0::ms, 371::ms, 0.0, 65::ms ); //a, d, s, r | |
volE.keyOn(); | |
// patch | |
c => blackhole; | |
SinOsc form => volE => HPF boom => dac; | |
// set | |
now => time start; | |
// ready | |
while (true) | |
{ | |
//<<< e.value(), c.lookup(e.value()) >>>; | |
<<< c.lookup(1/e.value()) >>>; | |
c.lookup(1/e.value()) $ int => form.freq; | |
//Math.fabs(c.lookup(1/e.value()))*100 $ int => boom.freq; | |
// advance time | |
boom.Q(1.2); | |
41::samp => now; | |
if (now > (start + 170::ms)){ | |
e.keyOff(); | |
volE.keyOff(); | |
break; | |
} | |
} | |
3::second => now; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment