diff options
author | Richard <richard@1bpm.net> | 2025-02-28 02:08:19 +0000 |
---|---|---|
committer | Richard <richard@1bpm.net> | 2025-02-28 02:08:19 +0000 |
commit | 0f09f0882ed87bea9ff3e745c73f5d4743854fbb (patch) | |
tree | 62d04024200a4942ce4e012227822fdaae6a2e25 /BUG10 | |
parent | 6a8342a78bb65afbec9eac5693438a3107ff1dd3 (diff) | |
download | csd-unfixedbugs1-0f09f0882ed87bea9ff3e745c73f5d4743854fbb.tar.gz csd-unfixedbugs1-0f09f0882ed87bea9ff3e745c73f5d4743854fbb.tar.bz2 csd-unfixedbugs1-0f09f0882ed87bea9ff3e745c73f5d4743854fbb.zip |
Diffstat (limited to 'BUG10')
-rw-r--r-- | BUG10/BUG10.csd | 92 | ||||
-rw-r--r-- | BUG10/bid.udo | 154 | ||||
-rw-r--r-- | BUG10/bid_source.udo | 31 | ||||
-rw-r--r-- | BUG10/instruments.udo | 69 |
4 files changed, 185 insertions, 161 deletions
diff --git a/BUG10/BUG10.csd b/BUG10/BUG10.csd index 2d19cf1..45d9314 100644 --- a/BUG10/BUG10.csd +++ b/BUG10/BUG10.csd @@ -5,11 +5,11 @@ </CsOptions> <CsInstruments> /* - Debugger - Unfixed Bugs : BUG #6 + Debugger - Unfixed Bugs : BUG #10 http://git.1bpm.net/csd-unfixedbugs1/about/ - By Richard Knight 2021 + By Richard Knight 2023, 2024 http://1bpm.net q@1bpm.net @@ -21,7 +21,7 @@ nchnls = 2 0dbfs = 1 seed 0 -#define NOFILEIO ## ; file IO with readfi not supported on all platforms: disables bid_loadfile +#define NOFILEIO ## ; file IO with readfi not supported on all platforms: disables bid_loadfile gkmastergain init 1 ; master gain gkpump = 0 ; kick ducking control @@ -29,7 +29,7 @@ gksection init -1 #include "wavetables.udo" ; general waveforms #include "bussing.udo" ; global audio bussing -#include "bid.udo" ; Bug Infested Directive tools and parsing +#include "bid.udo" ; Bug Infested Directive tools and parsing #include "instruments.udo" ; sound generators #include "txt_tools.udo" ; text tools @@ -112,25 +112,6 @@ instr global_master 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 @@ -142,7 +123,7 @@ instr parseandrun bid_loadtext(SBID) tt_notify("Running sequencer") - event_i "i", "sequencer", 0, 3600 + schedule "sequencer", 0, 3600 turnoff endin @@ -151,66 +132,17 @@ instr endfade 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 - + schedule "bid_setcurrentchord", 0, 1, isection, 0 + schedule "global_master", 0, p3 + schedule "global_delay1", 0, p3 + schedule "global_delay2", 0, p3 + schedule "global_delay3", 0, p3 + gksection bid_seq_all isection endin + </CsInstruments> <CsScore> i"parseandrun" 0 1 diff --git a/BUG10/bid.udo b/BUG10/bid.udo index 17e9be2..3c96bdc 100644 --- a/BUG10/bid.udo +++ b/BUG10/bid.udo @@ -1,15 +1,15 @@ #ifndef UDO_BID #define UDO_BID ## /* - Debugger - Unfixed Bugs : BUG #5 + Debugger - Unfixed Bugs : BUG #10 - Bug Infested Directive file parser v1 and tools + Bug Infested Directive file parser v1.2 and tools Designed to create a reusable loop based score format in the Unfixed Bugs project and beyond. */ -#define BID_VERSION #1.1# +#define BID_VERSION #1.2# #include "txt_tools.udo" @@ -118,37 +118,6 @@ opcode _bid_parserowitems, i, Siii endop -/* - Read BID data for specified element and trigger accordingly. - - bid_seq Splayer, kposition, ksection - - Splayer name of BID element - kposition position in pattern provided by master sequencer - ksection section in composition provided by master sequencer - -*/ -opcode bid_seq, 0, Skk - Splayer, kpos, ksection xin - Sinstrument = sprintf("play_%s", Splayer) - instrindex = _bid_gettextindex(Splayer) - kdata = gibid_sections[ksection][instrindex] - - if (kdata != -1) then ; null section - kon = tablekt:k(kpos, gibid_sectiondata[kdata][0]) - - if (kon == 1) then - kchance = tablekt:k(kpos, gibid_sectiondata[kdata][3]) - if (random:k(0, 1) < kchance) then - ktime = (kpos % 2 == 0) ? 0 : gibid_swingtime - kdur = tablekt:k(kpos, gibid_sectiondata[kdata][1]) * gibid_beattime - ;kamp = tablekt:k(kpos, gisectiondata[kdata][2]) - event "i", Sinstrument, ktime, kdur, kpos, kdata - endif - endif - endif -endop - /* Get a parameter for the specified pattern position. @@ -345,6 +314,123 @@ complete: endop + +/* + Read BID data for specified element and trigger accordingly. + + bid_seq Splayer, kposition, ksection + + Splayer name of BID element + kposition position in pattern provided by master sequencer + ksection section in composition provided by master sequencer + +*/ +opcode bid_seq, 0, Skk + Splayer, kpos, ksection xin + Sinstrument = sprintf("play_%s", Splayer) + instrindex = _bid_gettextindex(Splayer) + kdata = gibid_sections[ksection][instrindex] + + if (kdata != -1) then ; null section + kon = tablekt:k(kpos, gibid_sectiondata[kdata][0]) + + if (kon == 1) then + kchance = tablekt:k(kpos, gibid_sectiondata[kdata][3]) + if (random:k(0, 1) < kchance) then + ktime = (kpos % 2 == 0) ? 0 : gibid_swingtime + kdur = tablekt:k(kpos, gibid_sectiondata[kdata][1]) * gibid_beattime + ;kamp = tablekt:k(kpos, gisectiondata[kdata][2]) + event "i", Sinstrument, ktime, kdur, kpos, kdata + endif + endif + endif +endop + + +instr _bid_exit + exitnow +endin + +/* + Print notification of performance time since last notification + or if isection is -1, print completion notification +*/ +gibid_timetrack times +instr bid_notify_change + isection = p4 + itime times + if (isection == -1) then + tt_notify(sprintf"Complete, runtime: %s", tt_parsetime(itime))) + exitnow + else + isectiontime = itime - gibid_timetrack + tt_notify(sprintf("%s : section %d complete in %s", tt_parsetime(itime), isection, tt_parsetime(isectiontime))) + gibid_timetrack = itime + endif + turnoff +endin + + +opcode bid_seq_all, k, oo + istartsection, index xin + ksection init istartsection + kpos init 0 + kposabs init 0 + kposchord init 0 + imaxinstruments = lenarray(gSbid_sequenced) + + kmetro metro (gibid_tempo / 60) * 4 + + if (kmetro == 1) then + if (ksection > gibid_maxsection) then + schedulek("bid_notify_change", 0, 1, -1) + endif + + kindex = 0 + while (kindex < imaxinstruments) do + kdata = gibid_sections[ksection][kindex] + if (kdata != -1) then ; null section + kon = tablekt:k(kpos, gibid_sectiondata[kdata][0]) + + if (kon == 1) then + kchance = tablekt:k(kpos, gibid_sectiondata[kdata][3]) + if (random:k(0, 1) < kchance) then + ktime = (kpos % 2 == 0) ? 0 : gibid_swingtime + kdur = tablekt:k(kpos, gibid_sectiondata[kdata][1]) * gibid_beattime + ;kamp = tablekt:k(kpos, gisectiondata[kdata][2]) + schedulek(sprintfk("play_%s", gSbid_sequenced[kindex]), ktime, kdur, kpos, kdata) + endif + endif + endif + kindex += 1 + od + + kpos = (kpos < 31) ? kpos + 1 : 0 + ksection16ths = bid_getsectionlength(ksection) * 4 + + if (kposabs + 1 < ksection16ths) then + kposabs += 1 + else + schedulek("bid_notify_change", 0, 1, ksection) + ksection += 1 + kposchord = 0 + kpos = 0 + kposabs = 0 + schedulek("bid_setcurrentchord", 0, 1, ksection, 1) + endif + + if (kposchord + 1 < gkbid_chordlength * 4) then + kposchord += 1 + else + kposchord = 0 + schedulek("bid_setcurrentchord", 0, 1, ksection, 1) + endif + endif + xout ksection +endop + + + /* Parse a Bug Infested Directive Format string to global arrays, ftables and variables. Handles patterns, tempo, chord groups and sections etc accordingly. diff --git a/BUG10/bid_source.udo b/BUG10/bid_source.udo index e55c5f5..5eb5768 100644 --- a/BUG10/bid_source.udo +++ b/BUG10/bid_source.udo @@ -8,7 +8,7 @@ SBID = {{ ; Bug Infested Directives : Debugger - Unfixed Bugs : BUG #10 -v 1.1 +v 1.2 ; tempo, swing percent b 131, 33 @@ -57,11 +57,17 @@ i hat2, 5, 2 i bass1, 1 ; 1 - - - 2 - - - 3 - - - 4 - - - 5 - - - 6 - - - 7 - - - 8 - - - 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 - 1, 1, 1,.1, 1, 1, 1,.1, 1, 1, 1,.1, 1, 1, 1,.1, 1, 1, 1,.1, 1, 1, 1,.1, 1, 1, 1,.1, 1, 1, 1,.1 + .1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0 + .1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.4,.1,.1,.1,.1,.1 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,.2, 1, 1, 1, 1, 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 -i hit1, 2, 1 -i hit1, 3, 1 -i hit1, 4, 1 -i hit1, 5, 1 - + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +i clap, 2, 1 +i clap, 3, 1 i shaker, 1 ; 1 - - - 2 - - - 3 - - - 4 - - - 5 - - - 6 - - - 7 - - - 8 - - - diff --git a/BUG10/instruments.udo b/BUG10/instruments.udo index dcb4ba3..6e08099 100644 --- a/BUG10/instruments.udo +++ b/BUG10/instruments.udo @@ -13,40 +13,25 @@ #include "bid.udo" instr play_bass1 - ifreq = cpsmidinn(table(1, gibid_chordfn) - 24) + + iamp = bid_getparameter(p4, p5, 2) * random(0.4, 1) + ifreqmode = bid_getparameter(p4, p5, 4) + + if (ifreqmode != 0) then + ifreq = cpsmidinn(table(ifreqmode, gibid_chordfn) - 24) + else + ifreq = cpsmidinn(table(1, gibid_chordfn) - 24) + endif kindex1 line 4, p3, 1 kindex2 line 5, p3, 1 kamp linseg 1, p3*0.9, 1, p3*0.1, 0 - aL foscil 1, ifreq, 8, 1.5, kindex1, gifnSine - aR foscil 1, ifreq, 8, 1.5, kindex2, gifnSine - aL *= kamp * 0.88 - aR *= kamp * 0.88 + aL foscil iamp, ifreq, 8, 1.5, kindex1, gifnSine + aR foscil iamp, ifreq, 8, 1.5, kindex2, gifnSine + aL *= kamp * 0.75 + aR *= kamp * 0.75 bus_mix("master", aL, aR) endin -instr play_hit1 - kfreq line cpsmidinn(table(2, gibid_chordfn) - 24), p3, cpsmidinn(table(1, gibid_chordfn) - 24) - kindex1 line 4, p3, 1 - kindex2 line 5, p3, 1 - kamp linseg 1, p3*0.9, 1, p3*0.1, 0 - aL1 foscil 1, kfreq, 1, 1.5, kindex1, gifnSquare - aR1 foscil 1, kfreq, 1, 1.5, kindex2, gifnSquare - aL2 foscil 1, kfreq, 2, 2.5, kindex2, gifnSine - aR2 foscil 1, kfreq, 2, 2.5, kindex1, gifnSine - aL = (aL1 + aL2) * kamp * 0.88 - aR = (aL1 + aL2) * kamp * 0.88 - aL distort aL, 0.6, gifnSine - aR distort aR, 0.6, gifnSine - - knoiseenv line 3, p3, 0.1 - aLn unirand knoiseenv - aRn unirand knoiseenv - aLn butterlp aLn, 5000 - aRn butterlp aRn, 5000 - aL = aLn * aL * 0.1 - aR = aRn * aR * 0.1 - bus_mix("master", aL, aR) -endin instr play_melb1 ifreq = cpsmidinn(table(1, gibid_chordfn)) * 1 @@ -63,9 +48,9 @@ endin instr play_hat1 - iamp = bid_getparameter(p4, p5, 2) - p3 = 0.05 - kfreq line 300, p3, 100 + iamp = bid_getparameter(p4, p5, 2) * 0.9 + p3 = 0.1 + kfreq line 600, p3, 400 aenv expsega .1, .0005, 1, p3 - .0005, .01 asqr1 oscil 1, kfreq, gifnSquare, -1 asqr2 oscil 1, kfreq*1.4471, gifnSaw, -1 @@ -76,7 +61,7 @@ instr play_hat1 a808 sum asqr1, asqr2, asqr3, asqr4, asqr5, asqr6 a808 butterhp a808, 4270 a808 butterhp a808, 4270 - aout = a808 * aenv * iamp * 2 + aout = a808 * aenv * iamp bus_mix("master", aout, aout) endin @@ -87,7 +72,7 @@ instr play_hat2 idel2 = random(0.005, 0.01) xtratim(max(idel1, idel2)) - kfreq line 400, p3, 100 + kfreq line 200, p3, 100 aenv expsega .1, .0005, 1, p3 - .0005, .01 asqr1 oscil 1, kfreq, gifnSquare, -1 asqr2 oscil 1, kfreq*1.4471, gifnSine, -1 @@ -98,13 +83,29 @@ instr play_hat2 a808 sum asqr1, asqr2, asqr3, asqr4, asqr5, asqr6 a808 butterhp a808, 3270 a808 butterhp a808, 3270 - aout = a808 * aenv * iamp * 1.1 + aout = a808 * aenv * iamp * 1.5 aL delay aout, idel1 aR delay aout, idel2 bus_mix("master", aL, aR) endin +instr play_clap + iamp = bid_getparameter(p4, p5, 2) * random(0.4, 1) * 0.8 + aL noise 1, 0.6 + aR noise 1, 0.7 + aL butterbp aL, random(1000, 1500), random(800, 1200) + aR butterbp aR, random(1000, 1500), random(800, 1200) + aL taninv aL*2 + aR taninv aR*2 + + kamp linseg 2, p3*0.1, 0, p3*0.1, 2, p3*0.1, 0, p3*0.1, 1.5, p3*0.1, 0, p3*0.1, 1, p3*0.4, 0 + aL *= kamp * iamp * 4 + aR *= kamp * iamp * 4 + bus_mix("master", aL, aR) + +endin + instr play_kick ; 808 style kick iamp = bid_getparameter(p4, p5, 2) |