aboutsummaryrefslogtreecommitdiff
path: root/BUG10/BUG10.csd
diff options
context:
space:
mode:
Diffstat (limited to 'BUG10/BUG10.csd')
-rw-r--r--BUG10/BUG10.csd218
1 files changed, 218 insertions, 0 deletions
diff --git a/BUG10/BUG10.csd b/BUG10/BUG10.csd
new file mode 100644
index 0000000..2d19cf1
--- /dev/null
+++ b/BUG10/BUG10.csd
@@ -0,0 +1,218 @@
+<CsoundSynthesizer>
+<CsOptions>
+-odac
+-m0
+</CsOptions>
+<CsInstruments>
+/*
+ Debugger - Unfixed Bugs : BUG #6
+
+ 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
+
+#define NOFILEIO ## ; file IO with readfi not supported on all platforms: disables bid_loadfile
+
+gkmastergain init 1 ; master gain
+gkpump = 0 ; kick ducking control
+gksection init -1
+
+#include "wavetables.udo" ; general waveforms
+#include "bussing.udo" ; global audio bussing
+#include "bid.udo" ; Bug Infested Directive tools and parsing
+#include "instruments.udo" ; sound generators
+#include "txt_tools.udo" ; text tools
+
+instr global_delay1
+ aL, aR bus_read "delay1"
+ ifreq1 = (gibid_tempo / 60) / 4
+ kfdbkL = abs(oscil(0.8, 1.67))
+ kfdbkR = abs(oscil(0.8, 1.67))
+
+ atimeL = abs(oscil(0.2, ifreq1)) + 0.3
+ atimeR = abs(oscil(0.2, ifreq1)) + 0.3
+
+ 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)
+
+ aLdel *= 1-gkpump
+ aRdel *= 1-gkpump
+ 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)
+ ;aLdel *= 1-gkpump
+ ;aRdel *= 1-gkpump
+ bus_mix("master", aLdel, aRdel)
+endin
+
+instr global_delay3
+ aL, aR bus_read "delay3"
+ ifreq1 = (gibid_tempo / 60) / 8
+ kfdbkL = abs(oscil(0.8, 1.63))
+ kfdbkR = abs(oscil(0.8, 1.67))
+
+ atimeL = abs(oscil(0.2, ifreq1)) + 0.01
+ atimeR = abs(oscil(0.2, ifreq1)) + 0.01
+
+ 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)
+
+ aLdel *= 1-gkpump
+ aRdel *= 1-gkpump
+ bus_mix("master", aLdel, aRdel)
+endin
+
+/*
+ Master audio output
+*/
+instr global_master
+ igain = 1
+ aL, aR bus_read "master"
+
+ awindex phasor giglitchsamples/sr
+ tablew aL, awindex*giglitchsamples, giglitchbufferL
+ tablew aR, awindex*giglitchsamples, giglitchbufferR
+
+ aL limit aL*0.5, -1, 1
+ aR limit aR*0.5, -1, 1
+ outs aL*gkmastergain*igain, aR*gkmastergain*igain
+endin
+
+
+/*
+ Print notification of performance time since last notification
+ or if isection is -1, print completion notification
+*/
+gitimetrack times
+instr notify_change
+ isection = p4
+ itime times
+ if (isection == -1) then
+ tt_notify(sprintf"Complete, runtime: %s", tt_parsetime(itime)))
+ exitnow
+ else
+ isectiontime = itime - gitimetrack
+ tt_notify(sprintf("%s : section %d complete in %s", tt_parsetime(itime), isection, tt_parsetime(isectiontime)))
+ gitimetrack = itime
+ endif
+ turnoff
+endin
+
+
+/*
+ Parse BID file and run the sequencer
+*/
+instr parseandrun
+ tt_notify("Parsing events")
+
+ #include "bid_source.udo"
+ bid_loadtext(SBID)
+
+ tt_notify("Running sequencer")
+ event_i "i", "sequencer", 0, 3600
+ turnoff
+endin
+
+instr endfade
+ exitnow
+endin
+
+
+
+instr sequencer
+ isection = 1
+ event_i "i", "bid_setcurrentchord", 0, 1, isection, 0
+ event_i "i", "global_master", 0, p3
+ event_i "i", "global_delay1", 0, p3
+ event_i "i", "global_delay2", 0, p3
+ event_i "i", "global_delay3", 0, p3
+ kmetro metro (gibid_tempo / 60) * 4
+ kpos init 0
+ kposabs init 0
+ ksection init isection
+ kposchord init 0
+ gksection = ksection
+ if (kmetro == 1) then
+ if (ksection > gibid_maxsection) then
+ ;event "i", "endfade", 0, gibid_beattime*8
+ event "i", "notify_change", p3, 1, -1
+ turnoff
+ endif
+
+ bid_seq "hit1", kpos, ksection
+ bid_seq "snare", kpos, ksection
+ bid_seq "kick", kpos, ksection
+ bid_seq "hat1", kpos, ksection
+ bid_seq "bass1", kpos, ksection
+ bid_seq "melb1", kpos, ksection
+ bid_seq "hat2", kpos, ksection
+ ;bid_seq "glitchread", kpos, ksection
+ bid_seq "shaker", kpos, ksection
+
+
+ kpos = (kpos < 31) ? kpos + 1 : 0
+ ksection16ths = bid_getsectionlength(ksection) * 4
+
+ if (kposabs+1 < ksection16ths) then
+ kposabs += 1
+ else
+ event "i", "notify_change", 0, 1, ksection
+ ;event "i", "play_crash", 0, gibid_beattime*4
+ ksection += 1
+ kposchord = 0
+ kpos = 0
+ kposabs = 0
+ event "i", "bid_setcurrentchord", 0, 1, ksection, 1
+ endif
+
+
+ if (kposchord+1 < gkbid_chordlength*4) then
+ kposchord += 1
+ else
+ kposchord = 0
+ event "i", "bid_setcurrentchord", 0, 1, ksection, 1
+ endif
+
+
+ endif
+
+endin
+
+</CsInstruments>
+<CsScore>
+i"parseandrun" 0 1
+</CsScore>
+</CsoundSynthesizer> \ No newline at end of file