; the sample rate, samples per click and piece duration can be defined in this piece ; the direction may also be changed from left to right to right to left by using instr 2 (i2) in score below ; sample rate and control rate must be the same sr = 48000 kr = 48000 ksmps = 1 nchnls = 2 #define gr #(sqrt(5)/2+.5)# ; define samples per click, an integer ; must be at least round(.001139 / (1/sr)); the minimum note value is .001139 seconds #define spc #12000# ; define piece length in score below ; the instruments should not be modified instr 1 kres timek kn = (kres-1-sr)/$spc kn = 1+floor(kn) kv = ((kn*$gr)-floor(kn*$gr))*16 kpan table3 kv, 1 kdel table3 kv, 2 kstr table3 kv, 3 ksmpstosecs = 1/sr kdelinsmps = round((kdel/1000)/ksmpstosecs) if ((kres-sr-1)%$spc == abs(kdelinsmps) && kdelinsmps != 0 && kn > 0) goto delayed if ((kres-sr-1)%$spc == 0) goto click if ((kres-sr-1)%$spc != 0) goto silence click: if (kres+abs(kdelinsmps) > round(p3*sr+sr)) goto silence apan = a(kpan) astr = a(kstr) if (kdelinsmps == 0) goto nodelay if (kpan<.5) goto right outs 32767*apan*astr, astr*0 goto end nodelay: outs 32767*apan*astr, 32767*(1-apan)*astr goto end right: outs astr*0, 32767*(1-apan)*astr goto end delayed: apan = a(kpan) astr = a(kstr) if (kdel<0) goto right2 outs 32767*apan*astr, astr*0 goto end right2: outs astr*0, 32767*(1-apan)*astr goto end silence: asilence = 0 outs asilence, asilence end: endin instr 2 kres timek kn = (kres-1-sr)/$spc kn = 1+floor(kn) kv = ((kn*$gr)-floor(kn*$gr))*16 kpan table3 kv, 1 kdel table3 kv, 2 kstr table3 kv, 3 ksmpstosecs = 1/sr kdelinsmps = round((kdel/1000)/ksmpstosecs) if ((kres-sr-1)%$spc == abs(kdelinsmps) && kdelinsmps != 0 && kn > 0) goto delayed if ((kres-sr-1)%$spc == 0) goto click if ((kres-sr-1)%$spc != 0) goto silence click: if (kres+abs(kdelinsmps) > round(p3*sr+sr)) goto silence apan = a(kpan) astr = a(kstr) if (kdelinsmps == 0) goto nodelay if (kpan<.5) goto left outs astr*0, 32767*apan*astr goto end nodelay: outs 32767*(1-apan)*astr, 32767*apan*astr goto end left: outs 32767*(1-apan)*astr, astr*0 goto end delayed: apan = a(kpan) astr = a(kstr) if (kdel<0) goto left2 outs astr*0, 32767*apan*astr goto end left2: outs 32767*(1-apan)*astr, astr*0 goto end silence: asilence = 0 outs asilence, asilence end: endin ; these tables should not be changed ; pan in strength of left speaker f1 0 17 -2 .725 .6838 .644 .6111 .58 .554 .528 .513 .5 .487 .472 .446 .42 .3889 .356 .3162 .275 ; delay in milliseconds f2 0 17 -2 -.435 -.375 -.319 -.262 -.209 -.157 -.1041 -.051 0 .051 .1041 .157 .209 .262 .319 .375 .435 ; overall strength f3 0 17 -2 1.061 1.0842 1.108 1.1312 1.153 1.1695 1.185 1.192 1.195 1.192 1.185 1.1695 1.153 1.1312 1.108 1.0842 1.061 ; piece length in third field below ; change i1 to i2 to reverse direction to right to left i1 1 60 ; replace value to the left of semicolon