diff options
Diffstat (limited to 'BUG4')
-rw-r--r-- | BUG4/BUG4.csd | 128 | ||||
-rw-r--r-- | BUG4/bussing.udo | 62 | ||||
-rw-r--r-- | BUG4/instruments.udo | 134 | ||||
-rw-r--r-- | BUG4/wavetables.udo | 16 |
4 files changed, 340 insertions, 0 deletions
diff --git a/BUG4/BUG4.csd b/BUG4/BUG4.csd new file mode 100644 index 0000000..fbeefa3 --- /dev/null +++ b/BUG4/BUG4.csd @@ -0,0 +1,128 @@ +<CsoundSynthesizer> +<CsOptions> +-odac +</CsOptions> +<CsInstruments> +/* + Debugger - Unfixed Bugs : BUG #4 + + http://git.1bpm.net/csd-unfixedbugs1/about/ + + By Richard Knight 2021 + http://1bpm.net + q@1bpm.net + +*/ + +sr = 44100 +ksmps = 10 +nchnls = 2 +0dbfs = 1 +seed 0 + +gitempo = 118 +gkmastergain init 1 ; master gain +gkpump = 0 ; kick ducking control +gkreverse init 0 ; global reverse + +#include "wavetables.udo" ; general waveforms +#include "bussing.udo" ; global audio bussing +#include "instruments.udo" ; sound generators + + +instr global_delay1 + aL, aR bus_read "delay1" + ifreq1 = (118 / 60) / 2 + kfdbkL = abs(oscil(0.6, 1.63)) + kfdbkR = abs(oscil(0.6, 1.67)) + + atimeL = abs(oscil(0.3, ifreq1)) + atimeR = abs(oscil(0.3, ifreq1)) + + aLdlr delayr 1 + aLdel deltapi atimeL + aLdel butterhp aLdel, 130 + delayw aL + (aLdel * kfdbkL) + + aRdlr delayr 1 + aRdel deltapi atimeR + aRdel butterhp aRdel, 130 + delayw aR + (aRdel * kfdbkR) + + + bus_mix("master", aLdel, aRdel) +endin + +instr global_delay2 + aL, aR bus_read "delay2" + aLdlr delayr 0.2 + kdeltime = abs(oscil(0.02, 0.04)) + 0.01 + aLdel deltapi kdeltime + 0.002 + delayw aL + (aLdel * 0.7) + aRdlr delayr 0.2 + aRdel deltapi kdeltime + 0.001 + delayw aR + (aRdel * 0.7) + bus_mix("master", aLdel, aRdel) +endin + +/* + Master audio output +*/ +instr global_master + igain = 0.4 + aL, aR bus_read "master" + ;aL limit aL*0.8, 0, 1 + ;aR limit aR*0.8, 0, 1 + outs aL*gkmastergain*igain, aR*gkmastergain*igain +endin + +instr seq + event_i "i", "global_master", 0, p3 + event_i "i", "global_delay1", 0, p3 + event_i "i", "global_delay2", 0, p3 + kbeat metro (gitempo / 60) * 4 + kpos init 0 + if (kbeat == 1) then + if (kpos % 3 == 0) then + event "i", "play_rim", 0, 1 + endif + + if ((kpos+1) % 2 == 0 && random:k(0, 1) > 0.8) then + event "i", "play_303", 0, 0.01, 106, 106, 90, 1 + endif + + km8m init 0 + if ((kpos+1) % 8 == 0) then + kstart = (km8m == 0) ? 40 : 45 + kend = (km8m == 0) ? 43 : 38 + event "i", "play_303", 0, 0.3, kstart, kend, 40, 0 + km8m = 1- km8m + endif + + + if (kpos % 9 == 0) then + ;event "i", "play_blip", 0, 0.01 + endif + + if (kpos % 4 == 0) then + event "i", "play_kick", 0, 0.2, 0 + endif + + if ((kpos+2) % 16 == 0) then + event "i", "play_kick", 0, 0.4, 1 + endif + + if (kpos % 8 == 0) then + event "i", "play_clap", 0, 0.02 + endif + + kpos += 1 + endif +endin + +</CsInstruments> +<CsScore> +i"seq" 0 400 + +</CsScore> +</CsoundSynthesizer>
\ No newline at end of file diff --git a/BUG4/bussing.udo b/BUG4/bussing.udo new file mode 100644 index 0000000..78755ce --- /dev/null +++ b/BUG4/bussing.udo @@ -0,0 +1,62 @@ +#ifndef UDO_BUSSING +#define UDO_BUSSING ## + + +/* + Get the stereo L and R names for a singular bus name + + SnameL, SnameR bus_name Sbus + + SnameL left bus identifier + SnameR right bus identifier + + Sbus bus name +*/ +opcode bus_name, SS, S + Sbus xin + xout sprintf("%sL", Sbus), sprintf("%sR", Sbus) +endop + + +/* + Mix to a stereo bus + + bus_mix Sbus, aL, aR + + Sbus bus name + aL left channel + aR right channel +*/ +opcode bus_mix, 0, Saa + Sbus, aL, aR xin + SbusL, SbusR bus_name Sbus + chnmix aL, SbusL + chnmix aR, SbusR +endop + + + +/* + Read from a stereo bus, and then clear the bus + + aL, aR bus_read Sbus + + aL left channel + aR right channel + + Sbus bus name +*/ +opcode bus_read, aa, S + Sbus xin + SbusL, SbusR bus_name Sbus + aL chnget SbusL + aR chnget SbusR + chnclear SbusL + chnclear SbusR + xout aL, aR +endop + + + + +#end diff --git a/BUG4/instruments.udo b/BUG4/instruments.udo new file mode 100644 index 0000000..e8f85d3 --- /dev/null +++ b/BUG4/instruments.udo @@ -0,0 +1,134 @@ +#ifndef UDO_INSTRUMENTS +#define UDO_INSTRUMENTS ## +/* + Debugger - Unfixed Bugs : BUG #4 + + Sound generators + Names should correspond to those used in BID file, prepended with play_ +*/ + + +#include "wavetables.udo" +#include "bussing.udo" + + +instr play_303 + iamp = 1.2 ;getparameter(p4, p5, 2) + + inote1 = p4 + inote2 = p5 + ifilter = p6 + + ifrq1 = 440 * exp(log(2) * (ifilter - 69) / 12) ; filter start freq. + kamp linseg 1, p3*0.8, 1, p3*0.2, 0 + kcps line cpsmidinn(inote1), p3, cpsmidinn(inote2) + kffrq port 0, 60/150, ifrq1 ; filter frequency + a1 phasor kcps ; oscillator + a1 = 1 - 2 * a1 + + a1x butterbp a1, kffrq, kcps * 1.0 ; filters + a1x = a1x * (2 + kffrq / kcps) ; correct amplitude + a1 = a1x + a1 * 0.25 ; 0.5 + a1 butterlp a1, kffrq + + a1 = taninv(a1 * 4 * iamp) ; distortion ; 2.5 + + keqf limit kffrq * 4, 10, sr * 0.48 ; EQ frequency + a1 pareq a1 * 0.4, keqf, 4.0, 1.0, 2 + a1 butterhp a1, 50 + a1 = a1 * kamp + aL, aR pan2 a1, random(0.3, 0.7) + if (p7 == 1 && random(0, 1) > 0.6) then + bus_mix("delay2", aL, aR) + endif + bus_mix("master", aL, aR) +endin + + +/* + Istvan Varga +*/ +instr play_rim + iamp = 1 + icps = 220 + acps expon icps, 0.0025, icps * 0.5 + acps = acps + icps + iamp = 1 + a1a phasor acps, 0.0 + a1b phasor acps, 0.5 + afmenv expon 1.0, 0.02, 0.5 + a1 = (a1a-a1b)*6.0*afmenv + acps = acps*(1.0+a1) + a0 oscil3 1.0, acps + a1 unirand 2.0 + a1 tone a1-1.0, 2000 + a0 = a0 + a1*0.1 + aenv expon 1.0, 0.005, 0.5 + a0 limit 4.0*iamp*a0*aenv, -1.0, 1.0 + a0 table3 a0*4096.0, gifnSaw, 0, 0, 1 + kffrq expseg 2000, 0.07, 100, 1, 100 + a0x tone a0, 10000 + a0y = a0 - a0x + a0x delay a0y, 0.0002 + a0 = a0 - a0x*4.0 + a0 pareq a0, kffrq, 0, 0.7071, 2 + a_ linseg 1, p3-0.1, 1, 0.025, 0, 1, 0 + a0 = a0*a_ + aL, aR pan2 a0*iamp, random(0.3, 0.8) + + bus_mix("delay1", aL, aR) + bus_mix("master", aL, aR) +endin + +instr play_blip + a1 oscil 0.6, 4400 + kamp line 1, p3, 0 + a1 *= kamp + + bus_mix("delay2", a1, a1) +endin + + +instr play_clap + aL noise 1, 0.3 + aR noise 1, 0.4 + aL butterbp aL, 1200, 700 + aR butterbp aR, 1200, 700 + aL taninv aL*7 + aR taninv aR*7 + + kamp linseg 2, p3, 0 + aL *= kamp + aR *= kamp + bus_mix("delay2", aL, aR) + bus_mix("master", aL, aR) + +endin + + +instr play_kick ; 808 style kick + iamp = 1 + xtratim 0.1 + krelease release + ktune init -1.1 + kmul transeg 0.2, p3*0.5, -15, 0.01, p3*0.5, 0, 0 + kbend transeg 0.5, 1.2, -4, 0, 1, 0, 0 + asig gbuzz 0.5, 50*octave(ktune)*semitone(kbend), 20, 1, kmul, gifnCosine + aenv transeg 1, p3-0.004, -6, 0 + gkpump = k(aenv) + aatt linseg 0, 0.004, 1 + asig = asig*aenv*aatt + aenv linseg 1, 0.07, 0 + acps expsega 400, 0.07, 0.001, 1, 0.001 + aimp oscili aenv, acps*octave(ktune*0.25) + amix = ((asig*0.7)+(aimp*0.35))*2*iamp + gkpump = min(rms(amix) * 7, 1) + aout1 pareq amix, 100, 0.01, 0.6 + aout1 distort aout1, 0.25, (p4 == 1 && random(0, 1) > 0.6) ? gifnSaw : gifnSine + aout1 pareq aout1, 100, 0.01, 0.6 + aout1 *= 3 + bus_mix("master", aout1, aout1) +endin + + +#end diff --git a/BUG4/wavetables.udo b/BUG4/wavetables.udo new file mode 100644 index 0000000..e81f075 --- /dev/null +++ b/BUG4/wavetables.udo @@ -0,0 +1,16 @@ +#ifndef UDO_WAVETABLES +#define UDO_WAVETABLES ## +/* + Debugger - Unfixed Bugs : BUG #3 + + General waveforms +*/ + +ipoints = 16384 +gifnCosine ftgen 0, 0, ipoints, 9, 1, 1, 90 +gifnSine ftgen 0, 0, ipoints, 10, 1 +gifnSquare ftgen 0, 0, ipoints, 10, 1, 0, 0.3, 0, 0.2, 0, 0.14, 0, .111 +gifnSaw ftgen 0, 0, ipoints, 10, 0, .2, 0, .4, 0, .6, 0, .8, 0, 1, 0, .8, 0, .6, 0, .4, 0, .2 + +#end + |