Hi Mitch & Joel, the envelope needs an input like so:
Step n => Envelope e => SinOsc c => dac; n.next(1); // you need to put something in the envelope to have a value at the output c.gain(0.1); e.value(100); e.target(1000); e.duration(1::second); hour => now; Hope this helps, Casper > On Sep 4, 2015, at 03:25, Joel Matthys <[email protected]> wrote: > > Hi Mitch. Yeah, I couldn't get sync to work for frequency either. I guess we > should file that as a bug. > > The only refinements I would make is to put the code to update the envelope > in a separate thread and spork it. > > Envelope e => blackhole; > 440 => e.value; > SinOsc s => dac; > 0.1 => s.gain; > 100::ms => e.duration; > > spork ~gliss (100::samp); > while (1) > { > Math.random2(220,880) => e.target; > second => now; > } > > fun void gliss(dur updateRate) > { > while (1) > { > e.value() => s.freq; > updateRate => now; > } > } > > //------------------------------------------------------------ > > On 09/03/2015 07:13 PM, Mitch Kaufman wrote: >> Hi list, >> >> I am a relatively new user and am enjoying exploring different areas of >> ChucK. I was trying to develop a program to create glissons or short >> particles with a moving frequency range. I came up with an approach but I >> think there may be an easier way. Here is the program: >> >> SinOsc sin => dac; >> Envelope env => blackhole; >> 500.0 => sin.freq => float x; //starting frequency >> 100::ms => dur rampTime; //ramp time period >> 0 => env.value; //starting value >> rampTime => env.duration; >> 400.0 => env.target; //ramp to target - in this case, 900 Hz >> now + rampTime => time t; >> while( now < t ) >> { >> // modulate frequency by envelope >> x+env.value() => sin.freq; >> // advance time by 100 samples >> 100::samp => now; >> } >> >> I think there may be an easier way of doing this using: >> >> Envelope env => SinOsc sin => dac; >> >> But I can't seem to get it working using a proper sin.sync value. Does >> anyone have any ideas on improving the approach? >> >> Regards, >> Mitch >> >> >> _______________________________________________ >> chuck-users mailing list >> [email protected] >> <mailto:[email protected]> >> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users >> <https://lists.cs.princeton.edu/mailman/listinfo/chuck-users> > > _______________________________________________ > chuck-users mailing list > [email protected] <mailto:[email protected]> > https://lists.cs.princeton.edu/mailman/listinfo/chuck-users > <https://lists.cs.princeton.edu/mailman/listinfo/chuck-users>
_______________________________________________ chuck-users mailing list [email protected] https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
