Hello Michael,
Thanks a lot for your help. I don't know if i can reply to you with other questions or if i should use "chuck-users@lists.cs.princeton.edu".
In the meantime i found a solution for my "pause" problem in the use of ADSR. But i still have some general questions and some about the program that follows:
1. Where can i find a chuck editor with the possibility to find words and replace them (all) and that also gives the colors for reserved words etc.
2. Is there a way to debug line per line to discover logical errors?
3. i discovered by accident that sometimes i can use "p.puf" but on other occasions i have to write "p.buf()" why is this?
4. in the program hereby, is there a way to have the pan do it's job independantely from the note-envelope-flow? to go faster or slower?
5. When i run this program it does what i want but i can't figure out why it says 2 times "p.pan = 1.000000" and 2 times "p.pan= -1.000000" (see below)
Please let me know if i have to address all my questions to the general email address. thanks a lot !!
Herman
// sound file
me.sourceDir() + "wavefile.wav" => string filename;
if( me.args() ) me.arg(0) => filename;
<<>>;
// the patch
SndBuf buf => ADSR e => Pan2 p => dac;
// set attack time, decay time, release time and pause time
dur attack; dur decay ; dur release; dur pauze;
12::ms => attack ; 90::ms => decay ; 100::ms => release ; 5::ms => pauze ;
// load file in buf
filename => buf.read;
// set gain
.5 => buf.gain;
// set a, d, s and r
e.set( attack, decay, 0.001, release );
// switch is needed to stay in the "else" step untill p.pan = -1
0 => int switch;
// begin pan extreme left
-1 => p.pan;
// time loop
while( true )
{
Math.random2(0,900000) => buf.pos;
Math.random2f(1.0,1.2) => buf.rate;
if( p.pan() < 1.0 && switch == 0)
{
p.pan() + .10 => p.pan;
<<<"if p.pan = ",p.pan()>>>;
}
else
{
p.pan() - .10 => p.pan;
<<<"else p.pan = ", p.pan()>>>;
1 => switch;
if (p.pan() == -1)
{
0 => switch;
}
}
// key on - start attack
e.keyOn();
attack + decay => dur ontime;
ontime => now;
// key off - start release
e.keyOff();
// advance time by releasetime + pausetime
release + pauze => now;
}
---------------------------------------------------------console result print----------------------------------------------------
if p.pan = -0.900000
if p.pan = -0.800000
if p.pan = -0.700000
if p.pan = -0.600000
if p.pan = -0.500000
if p.pan = -0.400000
if p.pan = -0.300000
if p.pan = -0.200000
if p.pan = -0.100000
if p.pan = -0.000000
if p.pan = 0.100000
if p.pan = 0.200000
if p.pan = 0.300000
if p.pan = 0.400000
if p.pan = 0.500000
if p.pan = 0.600000
if p.pan = 0.700000
if p.pan = 0.800000
if p.pan = 0.900000
if p.pan = 1.000000
if p.pan = 1.000000
else p.pan = 0.900000
else p.pan = 0.800000
else p.pan = 0.700000
else p.pan = 0.600000
else p.pan = 0.500000
else p.pan = 0.400000
else p.pan = 0.300000
else p.pan = 0.200000
else p.pan = 0.100000
else p.pan = 0.000000
else p.pan = -0.100000
else p.pan = -0.200000
else p.pan = -0.300000
else p.pan = -0.400000
else p.pan = -0.500000
else p.pan = -0.600000
else p.pan = -0.700000
else p.pan = -0.800000
else p.pan = -0.900000
else p.pan = -1.000000
else p.pan = -1.000000
if p.pan = -0.900000
if p.pan = -0.800000
if p.pan = -0.700000
if p.pan = -0.600000
if p.pan = -0.500000
if p.pan = -0.400000
________________________________
Van: chuck-users-bounces@lists.cs.princeton.edu namens Michael Heuer
Verzonden: woensdag 5 februari 2020 15:42
Aan: ChucK Users Mailing List
Onderwerp: Re: [chuck-users] Create a pause of e.g. 2 seconds between notes or samples to be played
Hello Herman,
ChucK supports advancing time by chucking a duration to now, e.g.
note.play();
2::second => now;
note.play();
LiCK (a Library for ChucK)https://github.com/heuermh/lick has a TimeSignature class, which provides static durations
TimeSignature.common(120) @=> TimeSignature ts;
note.play();
ts.q => now;
note.play();
and those that are dynamic to tempo changes, with anticipation and delay humanization
TimeSignature.common(120) @=> TimeSignature ts;
ts.quarterProvider() @=> QuarterProvider q;
0.1 => q.anticipation;
0.0 => q.delay;
while (true)
{
note.play();
q.get() => now;
ts.tempo() - 1 => ts.tempo;
}
Cheers!
michael
On Feb 5, 2020, at 9:24 AM, herman verbaeten mailto:hverb54@hotmail.com> wrote:
Hi,
I've only recentely started studiing ChucK and i'm looking for an easy way to integrate a pause between notes to be played in a "while()" loop. Could someone tell me in what direction to look for a solution? thanks in advance!
Herman
_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edumailto:chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users