On Feb 6, 2020, at 10:41 AM, herman verbaeten <hver...@hotmail.com> wrote:
> 
> 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 
> <mailto:chuck-users@lists.cs.princeton.edu>". 

The ChucK mailing list is probably best.


> 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:
> 
> 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.
Have you seen the miniAudicle?  That is the official IDE for ChucK

http://audicle.cs.princeton.edu/mini/ <http://audicle.cs.princeton.edu/mini/>

I personally use a mode for Emacs to provide syntax highlighting

https://github.com/heuermh/chuck-mode <https://github.com/heuermh/chuck-mode>

There is support for other editors out there; I seem to remember a wiki with 
links to such somewhere but I can't find it.

> Is there a way to debug line per line to discover logical errors?
Not that I know of.  My bit of advice is to not run a ChucK script with 
headphones on without trying it on speakers first.  I learned that the hard way 
from a mis-configured filter.

>  i discovered by accident that sometimes i can use "p.puf" but on other 
> occasions i have to write "p.buf()" why is this?
In general, to read from a function/value, use the version with params

p.buf() => float f;

To set a value, use the chuck operator into the version without params

1.0 => p.buf;

This is equivalent to making a single-argument function call (but the former is 
more ChucK-y)

p.buf(1.0);

> 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?
Yes, you can use an oscillator as an LFO modulator

SinOsc lfo => blackhole;
0.5 => lfo.freq;

//…
while (true)
{
  // ...
  lfo.next() => pan.pan;


If you want to update the pan at sample rate or at a rate independent from your 
main while loop, create a new shred

spork ~ _updateAtSampleRate();

fun void _updateAtSampleRate()
{
  while (true)
  {
    1::samp => now;
    lfo.next() => pan.pan;
  }
}

Hope this helps!

> 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;
> <<<me.sourceDir()>>>;
> 
> // 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-boun...@lists.cs.princeton.edu 
> <chuck-users-boun...@lists.cs.princeton.edu> namens Michael Heuer 
> <heue...@gmail.com>
> Verzonden: woensdag 5 februari 2020 15:42
> Aan: ChucK Users Mailing List <chuck-users@lists.cs.princeton.edu>
> 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 <hver...@hotmail.com 
>> <mailto:hver...@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.edu 
>> <mailto:chuck-users@lists.cs.princeton.edu>
>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users 
>> <https://lists.cs.princeton.edu/mailman/listinfo/chuck-users>
> _______________________________________________
> chuck-users mailing list
> chuck-users@lists.cs.princeton.edu <mailto:chuck-users@lists.cs.princeton.edu>
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users 
> <https://lists.cs.princeton.edu/mailman/listinfo/chuck-users>
_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users

Reply via email to