;;;; JAMTASTIC 1.0 Dylan Menzies 2003 ;; ;;;; Midi looping performance instrument for csoundAV 0.0431 ;;;; Use midi note control to record / modify / mute / unmute loops fluidly on the fly. ;;;; Exact latency compensation. ;;;; Echo effect included. ;; ;;;; Offered under the GNU License, as 'charity ware': If you enjoy using this please ;;;; consider making a donation to a charity of your choosing. ;; ;;;; Use: ;;;; Modify flags to suit audio system. ;;;; Each loop has 3 switches. Mute, replace-record, overdub-record. ;;;; The midinotes that operate these switches can be found in instr 1 ;;;; Record a beat first by holding down replace-record, then playing a beat, then ;;;; releasing replace-record soon as the beat is played. The beat will repeat. ;;;; To mute/unmute the beat hit the mute switch. Now do the same with other loops, ;;;; remembering how many beats are in each. Overdub-record can be used to add more ;;;; to an existing loop. The echo switch adds echo when held. ;;;; gidc should be modifed so that all the repeats are spaced by the same amount. ;; ;;;; Hints: ;;;; Can use organ-style midi pedals, or modify a old/cheap without-velocity ;;;; keyboard to make floor switches. ;;;; Midi notes can be easily reassigned, or more loops added. ;;;; There will be a tiny amount of sync creep due to delays not being exact multiples. ;;;; This could be noticeable after a few hours.. -+P -+I -i2 -B512 -b512 -+K0 -+O ;; -+P -+I -i1 -B512 -b512 -+K0 -+O sr = 48000 kr = 480 ksmps = 100 nchnls = 2 ;====== edit these ======= ;; total io latency delay ;gidc = 0.15 ;; direct sound gidc = 0.043 ;;46 asio direct 512 sample mode ;gidc = 0.026 ;;28 asio direct 256 sample mode ; Delay buffer lengths gid1 = 0.7 ; beat length gid2 = gid1*4 gid3 = gid1*4 gid4 = gid1*8 gid5 = gid1*8 gid6 = gid1*16 ; Echo gie1 = gid1 *(2/3) giefb1 = 0.5 ; feedback ;=========================== gidb = 1/kr ;; delay due to block processing gadc1 init 0 gadc2 init 0 gadc3 init 0 gadc4 init 0 gadc5 init 0 gadc6 init 0 gaec1 init 0 gkdr1 init 0 ; dub record gkrr1 init 0 ; replace record gkm1 init 1 ; mute gkdr2 init 0 gkrr2 init 0 gkm2 init 1 gkdr3 init 0 gkrr3 init 0 gkm3 init 1 gkdr4 init 0 gkrr4 init 0 gkm4 init 1 gkdr5 init 0 gkrr5 init 0 gkm5 init 1 gkdr6 init 0 gkrr6 init 0 gkm6 init 1 gke1 init 1 ; echo ;;;; Collect midi data on channel 1 instr 1 inote notnum ;1 ; dub record if (inote != 48) kgoto dr1 gkdr1 = 1 gkm1 = 1 ; Switch on if off dr1: ; mute toggle if (inote != 49) igoto m1 gkm1 init 1-i(gkm1) m1: ; replace record if (inote != 50) kgoto rr1 gkrr1 = 1 gkm1 = 1 rr1: ;2 ; dub record if (inote != 53) kgoto dr2 gkdr2 = 1 gkm2 = 1 dr2: ; mute toggle if (inote != 54) igoto m2 gkm2 init 1-i(gkm2) m2: ; replace record if (inote != 55) kgoto rr2 gkrr2 = 1 gkm2 = 1 rr2: ;3 ; dub record if (inote != 57) kgoto dr3 gkdr3 = 1 gkm3 = 1 dr3: ; mute toggle if (inote != 58) igoto m3 gkm3 init 1-i(gkm3) m3: ; replace record if (inote != 59) kgoto rr3 gkrr3 = 1 gkm3 = 1 rr3: ;4 ; dub record if (inote != 60) kgoto dr4 gkdr4 = 1 gkm4 = 1 dr4: ; mute toggle if (inote != 61) igoto m4 gkm4 init 1-i(gkm4) m4: ; replace record if (inote != 62) kgoto rr4 gkrr4 = 1 gkm4 = 1 rr4: ;5 ; dub record if (inote != 65) kgoto dr5 gkdr5 = 1 gkm5 = 1 dr5: ; mute toggle if (inote != 66) igoto m5 gkm5 init 1-i(gkm5) m5: ; replace record if (inote != 67) kgoto rr5 gkrr5 = 1 gkm5 = 1 rr5: ;6 ; dub record if (inote != 69) kgoto dr6 gkdr6 = 1 gkm6 = 1 dr6: ; mute toggle if (inote != 70) igoto m6 gkm6 init 1-i(gkm6) m6: ; replace record if (inote != 71) kgoto rr6 gkrr6 = 1 gkm6 = 1 rr6: ;echo 1 if (inote != 72) kgoto e1 gke1 = 1 e1: endin ;;;; IO and delay processing: instr 100 ;display gkrr2, 1 ; Audio input ain1 inch 1 ain2 inch 2 ; 1 ; Interpolate control signals to avoid glitching agin1 interp (gkdr1+gkrr1) agfb1 interp (1-gkrr1) agout1 interp (1-gkrr1)*gkm1 ; Feedback-delay gad1 delay agin1*ain1 + agfb1*gadc1, gid1-gidc-gidb ; feedin and feedback control gadc1 delay gad1, gidc ; io delay compensation gad1 = agout1*gad1 ; mute control ; 2 ; Interpolate control signals to avoid glitching agin2 interp (gkdr2+gkrr2) agfb2 interp (1-gkrr2) agout2 interp (1-gkrr2)*gkm2 ; Feedback-delay gad2 delay agin2*ain1 + agfb2*gadc2, gid2-gidc-gidb ; feedin and feedback control gadc2 delay gad2, gidc ; io delay compensation gad2 = agout2*gad2 ; mute control ; 3 ; Interpolate control signals to avoid glitching agin3 interp (gkdr3+gkrr3) agfb3 interp (1-gkrr3) agout3 interp (1-gkrr3)*gkm3 ; Feedback-delay gad3 delay agin3*ain1 + agfb3*gadc3, gid3-gidc-gidb ; feedin and feedback control gadc3 delay gad3, gidc ; io delay compensation gad3 = agout3*gad3 ; mute control ; 4 ; Interpolate control signals to avoid glitching agin4 interp (gkdr4+gkrr4) agfb4 interp (1-gkrr4) agout4 interp (1-gkrr4)*gkm4 ; Feedback-delay gad4 delay agin4*ain1 + agfb4*gadc4, gid4-gidc-gidb ; feedin and feedback control gadc4 delay gad4, gidc ; io delay compensation gad4 = agout4*gad4 ; mute control ; 5 ; Interpolate control signals to avoid glitching agin5 interp (gkdr5+gkrr5) agfb5 interp (1-gkrr5) agout5 interp (1-gkrr5)*gkm5 ; Feedback-delay gad5 delay agin5*ain1 + agfb5*gadc5, gid5-gidc-gidb ; feedin and feedback control gadc5 delay gad5, gidc ; io delay compensation gad5 = agout5*gad5 ; mute control ; 6 ; Interpolate control signals to avoid glitching agin6 interp (gkdr6+gkrr6) agfb6 interp (1-gkrr6) agout6 interp (1-gkrr6)*gkm6 ; Feedback-delay gad6 delay agin6*ain1 + agfb6*gadc6, gid6-gidc-gidb ; feedin and feedback control gadc6 delay gad6, gidc ; io delay compensation gad6 = agout6*gad6 ; mute control ;Echo 1 ke1 port gke1, .5 agoute1 interp ke1 gae1 delay ain1 + giefb1*gaec1, gie1-gidc-gidb ; feedin and feedback control gaec1 delay gae1, gidc ; io delay compensation gae1 = agoute1*gae1 ; mute control outs (gad1+gad2+gad3+gad4+gad5+gad6+gae1), (gad1+gad2+gad3+gad4+gad5+gad6+gae1) ; Balance output against analog direct signal. ; reset controls (for note off) gkdr1 = 0 gkrr1 = 0 gkdr2 = 0 gkrr2 = 0 gkdr3 = 0 gkrr3 = 0 gkdr4 = 0 gkrr4 = 0 gkdr5 = 0 gkrr5 = 0 gkdr6 = 0 gkrr6 = 0 gke1 = 0 endin i100 0 36000 ; turn on audio processing e