Hello, has anybody implemented in ChucK or elsewhere else envelopes with the use of bezier or other spline curves? Linear is can be boring sometimes! Any efficient algorithm? I was thinking of trying De Casteljau algorithm but I would like to hear from anybody else that has already done something similar. Cheers, Dimitris ___________________________________________________________ Χρησιμοποιείτε Yahoo!; Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr
You can create N-th order polynomial curves (including splines, of course) with N discrete additions. F'rinstance, while (true) { k +=> a[0]; <<< a[0] >>>; } ... clearly generates a ramp, and: while (true) { k +=> a[1]; a[1] +=> a[0]; <<< a[0] >>>; } ... generates a parabola and: while (true) { k +=> a[2]; a[2] +=> a[1]; a[1] +=> a[0]; <<< a[0]
; } ... generates a cubic. Etc.
And it's equally clear that you can do all this at the UG level. The part left as an exercise for the reader is computing the initial values of a[n]. (This is the kind of stuff that Tom Duff has hardwired in his neocortex -- I have to re-derive it each time.) Best, - Rob On 11 Aug 2009, at 15:24, Bozelos Dimitris wrote:
Hello,
has anybody implemented in ChucK or elsewhere else envelopes with the use of bezier or other spline curves? Linear is can be boring sometimes! Any efficient algorithm? I was thinking of trying De Casteljau algorithm but I would like to hear from anybody else that has already done something similar.
Cheers,
Dimitris
Χρησιμοποιείτε Yahoo! Βαρεθήκατε τα ενοχλητικά μηνύ ματα (spam); Το Yahoo! Mail διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On Tue, 11 Aug 2009, Robert Poor wrote:
(This is the kind of stuff that Tom Duff has hardwired in his neocortex -- I have to re-derive it each time.)
I wish! In fact, I compensate for my pitiful memory by being unafraid to derive on the fly. -- Tom Duff. Because one operating system isn't enough.
On 12 Aug 2009, at 04:17, Kassen wrote:
has anybody implemented in ChucK or elsewhere else envelopes with the use of bezier or other spline curves?
Doesn't one of the Gen[n] UGens cover those? If not we might put that on the wish list.
It might be nice to have it some general functions. - I was thinking of using it for implementing scale stretch. Hans
Dimitris,
I do this all the time now:
//
// CurveTable Envelope
//
class CurveEnvelope
{
// members and default params
Phasor drive => CurveTable curvetable => Gain multiplier;
3 => multiplier.op; // this is what makes the CurveTable an envelope!
0. => multiplier.gain; // we use this to gait the output, so start at 0.
UGen source, out;
0 => drive.op; // stop the driver for now
dac @=> out;
1. => float gain;
1::second => dur length;
[0., 0., 0., 1., 1., 0., 2., 0.] => curvetable.coefs; // triangle window
// methods
fun void setEnvelopeCoefs( float _coefs[] )
{
_coefs => curvetable.coefs;
}
fun void connectSource( UGen src )
{
src @=> source;
}
fun void connectOutput( UGen destination )
{
destination @=> out;
}
fun void trigger()
{
source => multiplier => out; // connect things
gain => multiplier.gain; // open gait
1 => drive.op;
0. => drive.phase; // reset driver to beginning of envelope curve
1. / (length / second) => drive.freq; // calculate speed of driver in Hz
length => now; // let it happen...
0. => multiplier.gain; // close gait
0 => drive.op;
source =< multiplier =< out; // disconnect things
}
}
// demo
CurveEnvelope ce;
SinOsc s;
ce.connectSource( s );
ce.connectOutput( dac );
ce.trigger();
TriOsc t;
ce.connectSource( t );
ce.connectOutput( dac );
ce.trigger();
<<< "done" >>>;
---
It's fast. I use it for grain envelopes. The GenX UGens are similarly helpful.
-Mike
On Wed, Aug 12, 2009 at 3:38 AM, Hans Aberg
On 12 Aug 2009, at 04:17, Kassen wrote:
has anybody implemented in ChucK or elsewhere else envelopes with the use of bezier or other spline curves?
Doesn't one of the Gen[n] UGens cover those? If not we might put that on the wish list.
It might be nice to have it some general functions. - I was thinking of using it for implementing scale stretch.
Hans
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
participants (6)
-
Bozelos Dimitris
-
Hans Aberg
-
Kassen
-
mike clemow
-
Robert Poor
-
Tom Duff