[Csnd] DrumSequencerVariableLength.csd

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Csnd] DrumSequencerVariableLength.csd

jpff

Here is a version t--9.Oct.2017mysteryboxofun
Content-Type: text/plain; charset=us-ascii; name="DrumSequencerVariableLength.csd"
Content-Description: ~/Sourceforge/csound/Mccurdy/RealtimeScoreGeneration/DrumSequencerVariableLength.csd
Content-Transfer-Encoding: quoted-printable

DrumSequencerVariableLength.csd=0D
Written by Iain McCurdy, 2008=0D
=0D
<CsoundSynthesizer>=0D
=0D
<CsOptions>=0D
-odevaudio -dm0=0D
</CsOptions>=0D
=0D
<CsInstruments>=0D
=0D
sr =3D 44100 ;SAMPLE RATE=0D
ksmps =3D 8 ;NUMBER OF AUDIO SAMPLES IN EACH CONTROL CYCLE=0D
nchnls =3D 2 ;NUMBER OF CHANNELS (2=3DSTEREO)=0D
0dbfs =3D 1 ;MAXIMUM AMPLITUDE REGARDLESS OF BIT DEPTH=0D
=0D
;FLTK INTERFACE CODE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;=
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;=0D
FLcolor 255,255,255,0,0,0=0D
                FLpanel " ",1045, 335, 0, 0=0D
=0D
;BUTTONS                                             ON | OFF | TYPE |=
 WIDTH | HEIGHT | X | Y | OPCODE |  I  | STARTTIM | IDUR |  p4=0D
gkOnOff,ihOnOff FLbutton "On/Off", 1,    0,     2,    100,     30,    =
0,  0,   0,        1,     0,       -1=0D
FLsetColor2 255, 255, 50, ihOnOff ;SET SECONDARY COLOUR TO YELLOW=0D
gkRndPitches,ihRndPitches FLbutton "Randomize!", 1,    0,     1,    100,=
     30,  200,  0,   0,      102,     0,       0.001=0D
=0D
;COUNTERS MIN | MAX | STEP1 | STEP2 | TYPE | WIDTH | HEIGHT | POS_X =
| POS_Y | IOPCODE=0D
gkTempo,ihTempo FLcount "Tempo", 1,    999,    1,     10,     21,   100=
,     20,     100,      0,      -1=0D
=0D
;BORDERS ITYPE, IFONT, ISIZE, IWIDTH, IHEIGHT, IX, IY=0D
ih FLbox   " ", 5,        9,    15,    80,    183,     0, 48 ;DRAW A=
 BOX AROUND EACH GROUP OF 4 BUTTONS=0D
ih FLbox   " ", 5,        9,    15,    80,    183,    80, 48         =
   ;DRAW A BOX AROUND EACH GROUP OF 4 BUTTONS=0D
ih FLbox   " ", 5,        9,    15,    80,    183,   160, 48         =
   ;DRAW A BOX AROUND EACH GROUP OF 4 BUTTONS=0D
ih FLbox   " ", 5,        9,    15,    80,    183,   240, 48         =
   ;DRAW A BOX AROUND EACH GROUP OF 4 BUTTONS=0D
ih FLbox   " ", 5,        9,    15,    80,    183,   320, 48         =
   ;DRAW A BOX AROUND EACH GROUP OF 4 BUTTONS=0D
ih FLbox   " ", 5,        9,    15,    80,    183,   400, 48         =
   ;DRAW A BOX AROUND EACH GROUP OF 4 BUTTONS=0D
ih FLbox   " ", 5,        9,    15,    80,    183,   480, 48         =
   ;DRAW A BOX AROUND EACH GROUP OF 4 BUTTONS=0D
ih FLbox   " ", 5,        9,    15,    80,    183,   560, 48         =
   ;DRAW A BOX AROUND EACH GROUP OF 4 BUTTONS=0D
=0D
;TEXT BOXES TYPE | FONT | SIZE | WIDTH | HEIGHT | X | Y=0D
ih FLbox   "Gain", 1,      5,     13,     90,     12,   648,  7=0D
ih FLbox   "Transpose", 1,      5,     13,     90,     12,   848, 35=0D=

ih FLbox   "Delay (0-0.1 s.)", 1,      5,     13,     90,     12,   94=
8, 30=0D
ih FLbox   "Cycle Range", 1,      5,     13,     90,     12,   748, 3=
5=0D
ih FLbox   "1", 1,      5,     13,      4,     12,     4, 35=0D
ih FLbox   "2", 1,      5,     13,      4,     12,    84, 35=0D
ih FLbox   "3", 1,      5,     13,      4,     12,   164, 35=0D
ih FLbox   "4", 1,      5,     13,      4,     12,   244, 35=0D
ih FLbox   "5", 1,      5,     13,      4,     12,   324, 35=0D
ih FLbox   "6", 1,      5,     13,      4,     12,   404, 35=0D
ih FLbox   "7", 1,      5,     13,      4,     12,   484, 35=0D
ih FLbox   "8", 1,      5,     13,      4,     12,   564, 35=0D
=0D
;             MIN  | MAX | EXP | TYPE | DISP | WIDTH | HEIGHT | X |=
 Y=0D
gkMasterGain, ihMasterGain FLslider "Master", 0,      1,    0,    3,    =
 -1,   100,      12,  642,  24=0D
=0D
iy init 50=0D
=0D
#define ROW(COUNT) =0D
#=0D
gk$COUNT,gih$COUNT._1 FLbutton " ", 1,    0,      4,     20,     20,   =
   2, iy,  0,     9+$COUNT,    0,        0,     1=0D
gk$COUNT,gih$COUNT._2 FLbutton " ", 1,    0,      4,     20,     20,   =
  22, iy,  0,     9+$COUNT,    0,        0,     2=0D
gk$COUNT,gih$COUNT._3 FLbutton " ", 1,    0,      4,     20,     20,   =
  42, iy,  0,     9+$COUNT,    0,        0,     3=0D
gk$COUNT,gih$COUNT._4 FLbutton " ", 1,    0,      4,     20,     20,   =
  62, iy,  0,     9+$COUNT,    0,        0,     4=0D
gk$COUNT,gih$COUNT._5 FLbutton " ", 1,    0,      4,     20,     20,   =
  82, iy,  0,     9+$COUNT,    0,        0,     5=0D
gk$COUNT,gih$COUNT._6 FLbutton " ", 1,    0,      4,     20,     20,   =
 102, iy,  0,     9+$COUNT,    0,        0,     6=0D
gk$COUNT,gih$COUNT._7 FLbutton " ", 1,    0,      4,     20,     20,   =
 122, iy,  0,     9+$COUNT,    0,        0,     7=0D
gk$COUNT,gih$COUNT._8 FLbutton " ", 1,    0,      4,     20,     20,   =
 142, iy,  0,     9+$COUNT,    0,        0,     8=0D
gk$COUNT,gih$COUNT._9 FLbutton " ", 1,    0,      4,     20,     20,   =
 162, iy,  0,     9+$COUNT,    0,        0,     9=0D
gk$COUNT,gih$COUNT._10 FLbutton " ", 1,    0,      4,     20,     20,  =
  182, iy,  0,     9+$COUNT,    0,        0,    10=0D
gk$COUNT,gih$COUNT._11 FLbutton " ", 1,    0,      4,     20,     20,  =
  202, iy,  0,     9+$COUNT,    0,        0,    11=0D
gk$COUNT,gih$COUNT._12 FLbutton " ", 1,    0,      4,     20,     20,  =
  222, iy,  0,     9+$COUNT,    0,        0,    12=0D
gk$COUNT,gih$COUNT._13 FLbutton " ", 1,    0,      4,     20,     20,  =
  242, iy,  0,     9+$COUNT,    0,        0,    13=0D
gk$COUNT,gih$COUNT._14 FLbutton " ", 1,    0,      4,     20,     20,  =
  262, iy,  0,     9+$COUNT,    0,        0,    14=0D
gk$COUNT,gih$COUNT._15 FLbutton " ", 1,    0,      4,     20,     20,  =
  282, iy,  0,     9+$COUNT,    0,        0,    15=0D
gk$COUNT,gih$COUNT._16 FLbutton " ", 1,    0,      4,     20,     20,  =
  302, iy,  0,     9+$COUNT,    0,        0,    16=0D
gk$COUNT,gih$COUNT._17 FLbutton " ", 1,    0,      4,     20,     20,  =
  322, iy,  0,     9+$COUNT,    0,        0,    17=0D
gk$COUNT,gih$COUNT._18 FLbutton " ", 1,    0,      4,     20,     20,  =
  342, iy,  0,     9+$COUNT,    0,        0,    18=0D
gk$COUNT,gih$COUNT._19 FLbutton " ", 1,    0,      4,     20,     20,  =
  362, iy,  0,     9+$COUNT,    0,        0,    19=0D
gk$COUNT,gih$COUNT._20 FLbutton " ", 1,    0,      4,     20,     20,  =
  382, iy,  0,     9+$COUNT,    0,        0,    20=0D
gk$COUNT,gih$COUNT._21 FLbutton " ", 1,    0,      4,     20,     20,  =
  402, iy,  0,     9+$COUNT,    0,        0,    21=0D
gk$COUNT,gih$COUNT._22 FLbutton " ", 1,    0,      4,     20,     20,  =
  422, iy,  0,     9+$COUNT,    0,        0,    22=0D
gk$COUNT,gih$COUNT._23 FLbutton " ", 1,    0,      4,     20,     20,  =
  442, iy,  0,     9+$COUNT,    0,        0,    23=0D
gk$COUNT,gih$COUNT._24 FLbutton " ", 1,    0,      4,     20,     20,  =
  462, iy,  0,     9+$COUNT,    0,        0,    24=0D
gk$COUNT,gih$COUNT._25 FLbutton " ", 1,    0,      4,     20,     20,  =
  482, iy,  0,     9+$COUNT,    0,        0,    25=0D
gk$COUNT,gih$COUNT._26 FLbutton " ", 1,    0,      4,     20,     20,  =
  502, iy,  0,     9+$COUNT,    0,        0,    26=0D
gk$COUNT,gih$COUNT._27 FLbutton " ", 1,    0,      4,     20,     20,  =
  522, iy,  0,     9+$COUNT,    0,        0,    27=0D
gk$COUNT,gih$COUNT._28 FLbutton " ", 1,    0,      4,     20,     20,  =
  542, iy,  0,     9+$COUNT,    0,        0,    28=0D
gk$COUNT,gih$COUNT._29 FLbutton " ", 1,    0,      4,     20,     20,  =
  562, iy,  0,     9+$COUNT,    0,        0,    29=0D
gk$COUNT,gih$COUNT._30 FLbutton " ", 1,    0,      4,     20,     20,  =
  582, iy,  0,     9+$COUNT,    0,        0,    30=0D
gk$COUNT,gih$COUNT._31 FLbutton " ", 1,    0,      4,     20,     20,  =
  602, iy,  0,     9+$COUNT,    0,        0,    31=0D
gk$COUNT,gih$COUNT._32 FLbutton " ", 1,    0,      4,     20,     20,  =
  622, iy,  0,     9+$COUNT,    0,        0,    32=0D
gk$COUNT.Gain, gih$COUNT.Gain FLslider "", 0,      1,    0,    3,     -=
1,    100,      12,  642, iy+4=0D
gk$COUNT.Pch, gih$COUNT.Pch FLslider "", 25,   300,    0,    3,     -1,=
    100,      12,  842, iy+4=0D
gk$COUNT.Dly, gih$COUNT.Dly FLslider "", 0,     .1,    0,    3,     -1,=
    100,      12,  942, iy+4=0D
;COUNTERS MIN | MAX | STEP1 | STEP2 | TYPE | WIDTH | HEIGHT | POS_X=
 | POS_Y | IOPCODE=0D
gkLen$COUNT,gihLen$COUNT FLcount "", 0,      8, 0.25,      1,     21, =
   100,     20,     742,    iy,      -1=0D
gkphs$COUNT, gihtimpnt$COUNT FLslider "", 0,      8,    0,      1,     =
-1,    625,      9,       8,    iy+18=0D
FLsetColor2 0,255,0,gihtimpnt$COUNT=0D
=0D
                FLsetVal_i 100, gih$COUNT.Pch=0D
                FLsetVal_i 1, gih$COUNT.Gain=0D
                FLsetVal_i 8, gihLen$COUNT=0D
                iy =3D iy+30=0D
#=0D
FLcolor2 255,0,0=0D
$ROW(1)=0D
$ROW(2)=0D
$ROW(3)=0D
$ROW(4)=0D
$ROW(5)=0D
$ROW(6)=0D
=0D
;VALUE DISPLAY BOXES=0D
idRvbSnd FLvalue " ",      50,    15,     0, 255=0D
idfblvl FLvalue " ",      50,    15,     0, 285=0D
idfco FLvalue " ",      50,    15,     0, 315=0D
idDlySnd FLvalue " ",      50,    15,   240, 255=0D
idDlyFB FLvalue " ",      50,    15,   240, 285=0D
gkRvbSnd, ihRvbSnd FLslider "Reverb Send", 0,        1,   0,    3,     =
idRvbSnd,   235,    15,     0, 240=0D
gkfblvl, ihfblvl FLslider "Reverb Time", 0,        1,   0,    3,      i=
dfblvl,   235,    15,     0, 270=0D
gkfco, ihfco FLslider "Reverb Filter Cutoff", 20,   20000,   0,    3,  =
      idfco,   235,    15,     0, 300=0D
gkDlySnd, ihDlySnd FLslider "Delay Send", 0,        1,   0,    3,     i=
dDlySnd,   235,    15,   240, 240=0D
gkDlyFB, ihDlyFB FLslider "Delay Feedback", 0,        1,   0,    3,     =
 idDlyFB,   235,    15,   240, 270=0D
;COUNTERS MIN | MAX | STEP1 | STEP2 | TYPE | WIDTH | HEIGHT | POS_X=
 | POS_Y | IOPCODE=0D
gkDelTim1,ihDelTim1 FLcount "Delay L", 1,    32,     1,      1,      2=
,    100,     18,     240,   300,      -1=0D
gkDelTim2,ihDelTim2 FLcount "Delay R", 1,    32,     1,      1,      2=
,    100,     18,     350,   300,      -1=0D
=0D
                FLsetVal_i 0.4, ihRvbSnd=0D
                FLsetVal_i .7, ihfblvl=0D
                FLsetVal_i 10000, ihfco=0D
                FLsetVal_i 0.2, ihDlySnd=0D
                FLsetVal_i .4, ihDlyFB=0D
                FLsetVal_i 12, ihDelTim1=0D
                FLsetVal_i 20, ihDelTim2=0D
                FLsetVal_i 220, ihTempo=0D
                FLsetVal_i .5, ihMasterGain=0D
                FLpanel_end ;END OF PANEL CONTENTS=0D
=0D
;INSTRUCTIONS AND INFO PANEL=0D
                                FLpanel " ",1045, 310, 0, 385=0D
;TEXT BOXES TYPE | FONT | SIZE | WIDTH | HEIGHT | X | =
Y=0D
ih FLbox   "                                   Looping Sequencer With =
Individually Variable Length Loops                                      "=
, 1,       5,    14,    1040,    20,    5,   0=0D
ih FLbox   "----------------------------------------------------------=
------------------------------------------------------------------------"=
, 1,       5,    14,    1040,    20,    5,  20=0D
ih FLbox   "This example expands on the design from the 'Simple Drum S=
equencer' example. Besides expanding the basic loop length to 8 beats   "=
, 1,       5,    14,    1040,    20,    5,  40=0D
ih FLbox   "(32 semiquavers) the principle innovation is that the user=
 can shorten the range of the loop for each sound. The moving green bars"=
, 1,       5,    14,    1040,    20,    5,  60=0D
ih FLbox   "representing current loop position for each sound should h=
elp clarify exactly what is happening. Each beat is divided into four   "=
, 1,       5,    14,    1040,    20,    5,  80=0D
ih FLbox   "semiquavers so that 0.25 in the 'Cycle Length' value repre=
sents 1 semiquaver, a value of 1 represents 1 beat.                     "=
, 1,       5,    14,    1040,    20,    5, 100=0D
ih FLbox   "If changes are made to cycle lengths, all loops will resta=
rt in order to resync.                                                  "=
, 1,       5,    14,    1040,    20,    5, 120=0D
ih FLbox   "Notes that are outside the range of the loop for that soun=
d will not be played.                                                   "=
, 1,       5,    14,    1040,    20,    5, 140=0D
ih FLbox   "The sounds produced are kalimba-like sounds produced using=
 Stefan Bilbao's 'barmodel' physical model. The pitch of each of the six"=
, 1,       5,    14,    1040,    20,    5, 160=0D
ih FLbox   "sounds can be modified using the transpose sliders, they c=
an be randomised on mass using the 'Randomize!' button and are in fact  "=
, 1,       5,    14,    1040,    20,    5, 180=0D
ih FLbox   "randomised automatically upon startup.                    =
                                                                        "=
, 1,       5,    14,    1040,    20,    5, 200=0D
ih FLbox   "The 'Delay' sliders allow each sound to be individually de=
layed by a small amount with respect to the others. This is intended to "=
, 1,       5,    14,    1040,    20,    5, 220=0D
ih FLbox   "allow the creation of 'flam'-like gestures.               =
                                                                        "=
, 1,       5,    14,    1040,    20,    5, 240=0D
ih FLbox   "A reverb effect (making use of the 'reverbsc' opcode) is i=
ncluded.                                                                "=
, 1,       5,    14,    1040,    20,    5, 260=0D
ih FLbox   "A tempo synced delay effect is also included. Reverb times=
 for the left and right channel are defined separately in semiquavers.  "=
, 1,       5,    14,    1040,    20,    5, 280=0D
=0D
                                FLpanel_end=0D
=0D
                FLrun ;RUN THE WIDGET THREAD!=0D
=0D
=0D
;FUNCTION TABLE FOR STORAGE OF SEQUENCE DATA FOR SOUND 1=0D
gi1 ftgen 0,0,256,-2, 0, 0.25, .001, 0,\=0D
                                                0, 0.5, .001, 0,\=0D
                                                0, 0.75, .001, 0,\=0D
                                                0, 1, .001, 0,\=0D
                                                0, 1.25, .001, 0,\=0D
                                                0, 1.5, .001, 0,\=0D
                                                0, 1.75, .001, 0,\=0D
                                                0, 2, .001, 0,\=0D
                                                0, 2.25, .001, 0,\=0D
                                                0, 2.5, .001, 0,\=0D
                                                0, 2.75, .001, 0,\=0D
                                                0, 3, .001, 0,\=0D
                                                0, 3.25, .001, 0,\=0D
                                                0, 3.5, .001, 0,\=0D
                                                0, 3.75, .001, 0,\=0D
                                                0, 4, .001, 0,\=0D
                                                0, 4.25, .001, 0,\=0D
                                                0, 4.5, .001, 0,\=0D
                                                0, 4.75, .001, 0,\=0D
                                                0, 5, .001, 0,\=0D
                                                0, 5.25, .001, 0,\=0D
                                                0, 5.5, .001, 0,\=0D
                                                0, 5.75, .001, 0,\=0D
                                                0, 6, .001, 0,\=0D
                                                0, 6.25, .001, 0,\=0D
                                                0, 6.5, .001, 0,\=0D
                                                0, 6.75, .001, 0,\=0D
                                                0, 7, .001, 0,\=0D
                                                0, 7.25, .001, 0,\=0D
                                                0, 7.5, .001, 0,\=0D
                                                0, 7.75, .001, 0,\=0D
                                                0, 8, .001, 0,\=0D
                                                -1, 8, -1, -1=0D
=0D
gi2 ftgen 0,0,256,-2,0 ;EMPTY TABLES INITIALLY. CONTENTS WILL BE COPIED=
 FROM TABLE gi1=0D
gi3 ftgen 0,0,256,-2,0 ;EMPTY TABLES INITIALLY. CONTENTS WILL BE COPIED=
 FROM TABLE gi1=0D
gi4 ftgen 0,0,256,-2,0 ;EMPTY TABLES INITIALLY. CONTENTS WILL BE COPIED=
 FROM TABLE gi1=0D
gi5 ftgen 0,0,256,-2,0 ;EMPTY TABLES INITIALLY. CONTENTS WILL BE COPIED=
 FROM TABLE gi1=0D
gi6 ftgen 0,0,256,-2,0 ;EMPTY TABLES INITIALLY. CONTENTS WILL BE COPIED=
 FROM TABLE gi1=0D
=0D
zakinit 8,8 ;INITIALISE ZAK SPACE (8 A-RATE, 8 K-RATE)=0D
giRvbSndChn =3D 1 ;ZAK CHANNEL NUMBER USED FOR REVERB SEND=0D
giDlySndChn =3D 3 ;ZAK CHANNEL NUMBER USED FOR REVERB SEND=0D
=0D
seed 0=0D
=0D
instr 1 ; NOTE TRIGGERING INSTRUMENT=0D
        if gkOnOff=3D0 then=0D
                turnoff=0D
        endif=0D
        kSwitch changed gkLen1, gkLen2, gkLen3, gkLen4, gkLen5, gkLen6 ;GENER=
ATE A MOMENTARY '1' PULSE IN OUTPUT 'kSwitch' IF ANY OF THE SCANNED INPUT=
 VARIABLES CHANGE. (OUTPUT 'kSwitch' IS NORMALLY ZERO)=0D
        if kSwitch=3D1 then ;IF kSwitch=3D1, I.E. IF ANY OF THE ABOVE LISTED PA=
RAMETERS HAVE CHANGED...=0D
                reinit START ;...PERFORM AN I-RATE PASS BEGINNING FROM THE GIVEN LABE=
L=0D
        endif ;END OF CONDITIONAL BRANCHING=0D
        START: ;A LABEL =0D
        kTempoRatio =3D gkTempo/60=0D
        =0D
        kp1 init 0=0D
        kp2 init 0=0D
        kp3 init 0=0D
        kp4 init 0=0D
#define LOOP(COUNT) =0D
        #=0D
        kphs$COUNT     phasor  (kTempoRatio)/gkLen$COUNT=0D
        gktimpnt$COUNT =3D        kphs$COUNT * gkLen$COUNT=0D
        ktrig   timedseq gktimpnt$COUNT,gi$COUNT, kp1, kp2,kp3, kp4=0D
        ; schedkwhen ktrigger, kmintim, kmaxnum, kinsnum,    kwhen,      kdur   =
 p4    p5=0D
                schedkwhen ktrig,       0,        0,     2,     gk$COUNT.Dly,   kp3,   =
kp4, $COUNT#=0D
        =0D
        $LOOP(1)=0D
        $LOOP(2)=0D
        $LOOP(3)=0D
        $LOOP(4)=0D
        $LOOP(5)=0D
        $LOOP(6)=0D
        rireturn=0D
endin=0D
=0D
instr 2=0D
        if p4=3D1 then=0D
        event_i "i", p1+p5, 0, p3=0D
endif=0D
        endin=0D
=0D
#define KALIMBA(I'COUNT)=0D
        #=0D
instr $I=0D
        p3 =3D 2.6 ;DEFINE DURATION FOR THIS SOUND=0D
        ivel random 0.2,1=0D
        asig barmodel 1, 1, i(gk$COUNT.Pch), 1, 0, 2.6, 0.5, 1000*ivel, 0.07 ;K=
ALIMBA SOUND CREATED USING barmodel OPCODE (SEE CSOUND MANUAL FOR MORE IN=
FO.)=0D
        asigL =3D asig*i(gk$COUNT.Gain)*i(gkMasterGain)*2 ;DEFINE LEFT CHANNEL A=
UDIO=0D
        asigR =3D asig*i(gk$COUNT.Gain)*i(gkMasterGain)*2 ;DEFINE RIGHT CHANNEL =
AUDIO=0D
                outs asigL, asigR ;SEND AUDIO TO OUTPUTS=0D
        zawm asigL*gkRvbSnd, giRvbSndChn=0D
        zawm asigR*gkRvbSnd, giRvbSndChn+1=0D
        zawm asigL*gkDlySnd, giDlySndChn=0D
        zawm asigR*gkDlySnd, giDlySndChn+1=0D
endin=0D
        # =0D
=0D
$KALIMBA(3'1)=0D
$KALIMBA(4'2)=0D
$KALIMBA(5'3)=0D
$KALIMBA(6'4)=0D
$KALIMBA(7'5)=0D
$KALIMBA(8'6)=0D
=0D
;;; WRITE CHANGED FL-GRID VALUES TO TABLE=0D
#define WRITE_VAL(I'COUNT)=0D
#=0D
instr $I=0D
        tableiw i(gk$COUNT), ((p4-1)*4)+3, gi$COUNT =0D
endin=0D
#=0D
=0D
$WRITE_VAL(10'1)=0D
$WRITE_VAL(11'2)=0D
$WRITE_VAL(12'3)=0D
$WRITE_VAL(13'4)=0D
$WRITE_VAL(14'5)=0D
$WRITE_VAL(15'6)=0D
=0D
instr 100 ;COPY TABLE 1 TO ALL OTHER TABLES AND SET RANDOM INITIAL VALUES=
 FOR SOME VALUATORS (PERFORMED ONCE AT THE BEGINNING OF THE PERFORMANCE)=0D=

        tableicopy gi2, gi1=0D
        tableicopy gi3, gi1=0D
        tableicopy gi4, gi1=0D
        tableicopy gi5, gi1=0D
        tableicopy gi6, gi1=0D
        event_i "i", 102, 0,0.001 ;RANDOMISE SLIDERS=0D
endin=0D
=0D
instr 102 ;RANDOMISE SLIDERS=0D
#define RANDOMIZE_SLIDERS(COUNT)=0D
        #=0D
        iPch$COUNT random 25,300 ;DEFINE RANDOM INITIAL VALUES FOR 'TRANSPOSE'=
 SLIDERS=0D
        FLsetVal_i iPch$COUNT, gih$COUNT.Pch ;SEND RANDOM 'TRANSPOSE' VALUES TO =
SLIDERS=0D
        iLen$COUNT.Dec random 1,3 ;DEFINE RANDOM INITIAL VALUES FOR 'RANGE=
' COUNTERS=0D
        iLen$COUNT.Int random 4,8                                     ;DEFINE =
RANDOM INITIAL VALUES FOR 'RANGE' COUNTERS=0D
        iLen$COUNT. =3D (int(iLen$COUNT.Dec)*0.5)+int(iLen$COUNT.Int) ;DEFINE =
RANDOM INITIAL VALUES FOR 'RANGE' COUNTERS=0D
        FLsetVal_i iLen$COUNT, gihLen$COUNT ;SEND RANDOM 'RANGE' VALUES TO CO=
UNTERS=0D
        iDly$COUNT random 0, 0.03 ;DEFINE RANDOM INITIAL VALUES FOR 'TRANSPOSE=
' SLIDERS=0D
        FLsetVal_i iDly$COUNT, gih$COUNT.Dly ;SEND RANDOM 'DELAY' VALUES TO SLID=
ERS=0D
        #=0D
        $RANDOMIZE_SLIDERS(1)=0D
        $RANDOMIZE_SLIDERS(2)=0D
        $RANDOMIZE_SLIDERS(3)=0D
        $RANDOMIZE_SLIDERS(4)=0D
        $RANDOMIZE_SLIDERS(5)=0D
        $RANDOMIZE_SLIDERS(6)=0D
endin =0D
=0D
instr 998 ;DUAL TEMPO DELAY=0D
        aL zar giDlySndChn=0D
        aR zar giDlySndChn+1=0D
        kSwitch changed gkTempo, gkDelTim1, gkDelTim2 ;GENERATE A MOMENTARY '=
1' PULSE IN OUTPUT 'kSwitch' IF ANY OF THE SCANNED INPUT VARIABLES CHANGE=
=2E (OUTPUT 'kSwitch' IS NORMALLY ZERO)=0D
        if kSwitch=3D1 then ;IF kSwitch=3D1, I.E. IF ANY OF THE ABOVE LISTED PA=
RAMETERS HAVE CHANGED...=0D
                reinit START ;...PERFORM AN I-RATE PASS BEGINNING FROM THE GIVEN LABE=
L=0D
        endif ;END OF CONDITIONAL BRANCHING=0D
        START: ;A LABEL =0D
        ideltimL =3D (15*i(gkDelTim1))/i(gkTempo)=0D
        ideltimR =3D (15*i(gkDelTim2))/i(gkTempo)=0D
        abuffer delayr ideltimL=0D
        atapL deltap ideltimL=0D
                delayw aL + (atapL*gkDlyFB)=0D
        abuffer delayr ideltimR=0D
        atapR deltap ideltimR=0D
                delayw aR + (atapR*gkDlyFB)=0D
        outs atapL, atapR=0D
endin=0D
=0D
instr 999 ;REVERB=0D
        aL zar giRvbSndChn=0D
        aR zar giRvbSndChn+1=0D
        denorm aL, aR ;DENORMALIZE BOTH CHANNELS OF AUDIO SIGNAL=0D
        arvbL, arvbR reverbsc aL, aR, gkfblvl, gkfco, sr;, i(gkpitchm), i(gksk=
ip) =0D
        outs arvbL, arvbR=0D
        zacl 1,8=0D
endin=0D
        =0D
instr 1000 ;UPDATE LOOP INDICATORS=0D
        ktrigger metro 20 ;IF PERFORMANCE ISSUES ARISE REDUCING THIS VALUE MIGHT=
 HELP=0D
        FLsetVal ktrigger, gktimpnt1, gihtimpnt1=0D
        FLsetVal ktrigger, gktimpnt2, gihtimpnt2=0D
        FLsetVal ktrigger, gktimpnt3, gihtimpnt3=0D
        FLsetVal ktrigger, gktimpnt4, gihtimpnt4=0D
        FLsetVal ktrigger, gktimpnt5, gihtimpnt5=0D
        FLsetVal ktrigger, gktimpnt6, gihtimpnt6=0D
endin=0D
=0D
instr 1001 ;SET INITIAL PATTERN=0D
        FLsetVal_i 1, gih1_1=0D
        FLsetVal_i 1, gih5_3=0D
        FLsetVal_i 1, gih2_5=0D
        FLsetVal_i 1, gih6_7=0D
        FLsetVal_i 1, gih3_9=0D
        FLsetVal_i 1, gih1_11=0D
        FLsetVal_i 1, gih4_13=0D
        FLsetVal_i 1, gih2_15=0D
        FLsetVal_i 1, gih4_17=0D
        FLsetVal_i 1, gih5_19=0D
        FLsetVal_i 1, gih2_21=0D
        FLsetVal_i 1, gih6_23=0D
        FLsetVal_i 1, gih1_25=0D
        FLsetVal_i 1, gih3_27=0D
        FLsetVal_i 1, gih2_29=0D
        FLsetVal_i 1, gih5_31=0D
endin=0D
=0D
</CsInstruments>=0D
=0D
<CsScore>=0D
f 0 3600=0D
i 100 0 0=0D
i 998 0 3600 ;DELAY=0D
i 999 0 3600 ;REVERB=0D
i 1000 0 3600 ;LOOP INDICATORS=0D
i 1001 0.01 0.01 ;SET INITIAL PATTERN=0D
</CsScore>=0D
=0D
</CsoundSynthesizer>=
hat runs OK

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here


==John ffitch


Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here