aboutsummaryrefslogtreecommitdiff
path: root/BUG4/BUG4.csd
diff options
context:
space:
mode:
Diffstat (limited to 'BUG4/BUG4.csd')
-rw-r--r--BUG4/BUG4.csd181
1 files changed, 134 insertions, 47 deletions
diff --git a/BUG4/BUG4.csd b/BUG4/BUG4.csd
index fbeefa3..a506e53 100644
--- a/BUG4/BUG4.csd
+++ b/BUG4/BUG4.csd
@@ -1,6 +1,7 @@
<CsoundSynthesizer>
<CsOptions>
-odac
+-m0
</CsOptions>
<CsInstruments>
/*
@@ -8,36 +9,42 @@
http://git.1bpm.net/csd-unfixedbugs1/about/
- By Richard Knight 2021
+ By Richard Knight 2022
http://1bpm.net
q@1bpm.net
*/
sr = 44100
-ksmps = 10
+ksmps = 100
nchnls = 2
0dbfs = 1
seed 0
-gitempo = 118
+#define NOFILEIO ## ; file IO with readfi not supported on all platforms: disables bid_loadfile
+
gkmastergain init 1 ; master gain
gkpump = 0 ; kick ducking control
-gkreverse init 0 ; global reverse
+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
+/*
+ Global delay instrument 1
+*/
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))
+ ifreq1 = (gibid_tempo / 60) / 8
+ kfdbkL = abs(oscil(0.8, 1.63))
+ kfdbkR = abs(oscil(0.8, 1.67))
- atimeL = abs(oscil(0.3, ifreq1))
- atimeR = abs(oscil(0.3, ifreq1))
+ atimeL = abs(oscil(0.2, ifreq1)) + 0.01
+ atimeR = abs(oscil(0.2, ifreq1)) + 0.01
aLdlr delayr 1
aLdel deltapi atimeL
@@ -49,10 +56,15 @@ instr global_delay1
aRdel butterhp aRdel, 130
delayw aR + (aRdel * kfdbkR)
-
+ aLdel *= 1-gkpump
+ aRdel *= 1-gkpump
bus_mix("master", aLdel, aRdel)
endin
+
+/*
+ Global delay instrument 2
+*/
instr global_delay2
aL, aR bus_read "delay2"
aLdlr delayr 0.2
@@ -65,64 +77,139 @@ instr global_delay2
bus_mix("master", aLdel, aRdel)
endin
+
/*
Master audio output
*/
instr global_master
- igain = 0.4
+ igain = 1
aL, aR bus_read "master"
- ;aL limit aL*0.8, 0, 1
- ;aR limit aR*0.8, 0, 1
+
+ awindex phasor giglitchsamples/sr
+ tablew aL, awindex*giglitchsamples, giglitchbufferL
+ tablew aR, awindex*giglitchsamples, giglitchbufferR
+
+ if (gksection == 1 || gksection == 2) then
+ aL butterhp aL, 100
+ aR butterhp aR, 100
+ elseif (gksection == 8) then
+ islen = tab_i(8, gibid_sectionlengths)*gibid_beattime
+ khpf linseg 0, islen*0.5, 0, islen*0.2, 30, islen*0.2, 60, islen*0.1, 1000
+ aL butterhp aL, khpf
+ aR butterhp aR, khpf
+ endif
+
+
+ aL limit aL*0.5, -1, 1
+ aR limit aR*0.5, -1, 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
+/*
+ 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
- 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
+/*
+ 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
- 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
+
+/*
+ Sequence BID elements
+*/
+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
+ 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", "notify_change", p3, 1, -1
+ turnoff
endif
- if (kpos % 8 == 0) then
- event "i", "play_clap", 0, 0.02
+ ; sequence BID elements
+ bid_seq "kick", kpos, ksection
+ bid_seq "kick2", kpos, ksection
+ bid_seq "clap", kpos, ksection
+ bid_seq "blip", kpos, ksection
+ bid_seq "303", kpos, ksection
+ bid_seq "hat1", kpos, ksection
+ bid_seq "chord1", kpos, ksection
+ bid_seq "chord2", kpos, ksection
+ bid_seq "chord3", kpos, ksection
+ bid_seq "snare", kpos, ksection
+ bid_seq "mel1", kpos, ksection
+ bid_seq "hat2", kpos, ksection
+ bid_seq "303b", kpos, ksection
+ bid_seq "shaker", kpos, ksection
+ bid_seq "glitchread", 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
+ 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
+
- kpos += 1
endif
+
endin
</CsInstruments>
<CsScore>
-i"seq" 0 400
-
+i"parseandrun" 0 1
</CsScore>
</CsoundSynthesizer> \ No newline at end of file