Hello ,

Thanks a lot for your help.  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)
Thanks !!

Herman 


---------------------------------------------------- program ------------------------------------------------------------------
// 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