Tuesday, 28 February 2017

InstrSeq2

// Instr [i-3], Gain [i-2], FreqX [i-1], Period [i],
//      so to get array position first element is 0 so 
//                                                     for Instr you need i (which moves from the start pos 3) to be -3 to be 1st or [i-3]
//                                                     for Gain you need i (which moves from the start pos 3) to be -2 to be 2nd or [i-2]
//                                                     for Freakwency you need i (which moves from the start pos 3) to be -1 to be 3rd or [i-1]
//                                                     for Period you need i (which increments from the start pos 3) to be -0 to be 4th item or [i]
// Instr [i-3], Gain [i-2], FreqX [i-1], Period [i],


//Instr, Gain, FreqX, Period

3,  50, 50,  16,       7,  80, 120, 1,
                       7,  70, 75,  15,       3,  50, 100, 16,       4,  70, 100, 16,  




3,  50, 100, 16,       7,  50, 200, 16,       4,  50, 100, 16,       4,  70, 200, 16,  




2,  50, 100, 16,       7,  70, 100, 16,       2,  50, 75,  16,       1,  50, 100, 16,  



2,  70, 75,  8,        
0,   0, 100, 8,        0,  0,  100, 8,        
                       2,  80, 100, 8,        2,  50, 400, 16,       2,  70, 100, 16 


] @=> int Perc1Array[]; //sequence data
//800::ms => dur wait => dur the_wait;
1 => int i;
Gain g => dac;
.1 => g.gain;
SndBuf Perc1[8];
me.dir() + "data/snare-chili.wav" => Perc1[1].read;
me.dir() + "data/kick.wav" => Perc1[2].read;
me.dir() + "data/snare-hop.wav" => Perc1[3].read;
me.dir() + "data/snare.wav" => Perc1[4].read;
me.dir() + "data/hihat-open.wav" => Perc1[5].read;
me.dir() + "data/hihat.wav" => Perc1[6].read;
me.dir() + "data/Menupopup.wav" => Perc1[7].read;





while (true){
    for( 3 => int i; i < Perc1Array.cap(); i+4 => i)
    
    {
Perc1Array[i-3] => int ThisPerc1Instr;
Perc1Array[i-2] => int ThisPerc1Gain;
Perc1Array[i-1] => int ThisPerc1FreqX;
Perc1Array[i] => int ThisPerc1Period;
        
        // Instr [i-3], Gain [i-2], FreqX [i-1], Period [i],


//***   Set Frequency Multiplier on SndBuf for the instrument   
        ThisPerc1FreqX *0.01=> Perc1[ThisPerc1Instr].rate;
        
//***  Set Period and play it
//***   Set Gain on Instrument
        Perc1[ThisPerc1Instr] => g;
        1 => Perc1[ThisPerc1Instr].pos;
        ThisPerc1Gain*.001  =>  Perc1[ThisPerc1Instr].gain;  // turn on SndBuf

            <<< "i=",i >>>;
            <<<"Instr Perc1Array[i-3]=", ThisPerc1Instr,",  Gain Perc1Array[i-2]=", ThisPerc1Gain>>>;
            <<< "FreqX  Perc1Array[i-1]=", ThisPerc1FreqX, ",  Period  Perc1Array[i]=", ThisPerc1Period >>>;
         
         
         
         
         Perc1[ThisPerc1Instr].gain() => float currentPerc1GainGain;
         g.gain() => float currentGainGain;
         dac.gain() => float currentDacGain;
         Perc1[0].gain() => float currentPerc10Gain;
         Perc1[1].gain() => float currentPerc11Gain;
         Perc1[2].gain() => float currentPerc12Gain;
         Perc1[3].gain() => float currentPerc13Gain;
         Perc1[4].gain() => float currentPerc14Gain;
         Perc1[5].gain() => float currentPerc15Gain;
         Perc1[6].gain() => float currentPerc16Gain;
         Perc1[7].gain() => float currentPerc17Gain;
         Perc1[ThisPerc1Instr].rate() => float currentPerc1FreqX;
         <<<"GainGain", currentGainGain,",  InstrGain", currentPerc1GainGain >>>;
         <<<"DacGain", currentDacGain  >>>;
           <<<"SB0Gain", currentPerc10Gain >>>;
           <<<"SB1Gain", currentPerc11Gain >>>;
           <<<"SB2Gain", currentPerc12Gain >>>;
           <<<"SB3Gain", currentPerc13Gain >>>;
           <<<"SB4Gain", currentPerc14Gain >>>;
           <<<"SB5Gain", currentPerc15Gain >>>;
           <<<"SB6Gain", currentPerc16Gain >>>;
           <<<"SB7Gain", currentPerc17Gain >>>;
            
            
            
  //    <<< "FreqX  SndArray[i-1]=", currentFreqX, ",  Period  SndArray[i]=", instr[ThisPeriod] >>>;

        ThisPerc1Period*14::ms  => now;
  // 2::second => now;
    0.0 => Perc1[ThisPerc1Instr].gain;                          // turn off SndBuf

  //  0.04 :: second => now;                  // hang out a bit

    }  //end for loop
} //end while true

  
 //   0.04 :: second => now;                  // hang out a bit

// let time pass for reverb to go...

No comments:

Post a Comment