aboutsummaryrefslogtreecommitdiff
path: root/BUG3/base.csd
diff options
context:
space:
mode:
Diffstat (limited to 'BUG3/base.csd')
-rw-r--r--BUG3/base.csd506
1 files changed, 0 insertions, 506 deletions
diff --git a/BUG3/base.csd b/BUG3/base.csd
deleted file mode 100644
index e7df1af..0000000
--- a/BUG3/base.csd
+++ /dev/null
@@ -1,506 +0,0 @@
-<CsoundSynthesizer>
-<CsOptions>
--g -odac
--m0
-</CsOptions>
-<CsInstruments>
-/*
- Debugger - Unfixed Bugs : BUG #3
-
- By Richard Knight 2021
- http://1bpm.net
- mailto: _@1bpm.net
-
-*/
-
-sr = 44100
-ksmps = 128
-nchnls = 2
-0dbfs = 1
-seed 0
-
-#define BUG_VERSION #1.0#
-
-
-gitempo init -1
-gSprepare[] fillarray "hat909"
-
-gSequenced[] fillarray "hat909", "clap909", "kick", "rim", "chord1", "chord2", "hat909c", "mel1", "chord3"
-
-gisectionlengths ftgen 0, 0, -64, -7, 0
-gisections[][] init 64, 64
-gisectiondataindex = 0
-gisectiondata[][] init 99, 6
-
-gichordgroups[][] init 16, 12
-gisectionchords[] init 16
-
-gipreparedfns[] init lenarray(gSprepare)
-gipreparedfnindex init 0
-
-gicurrentchordfn init -1
-gkcurrentchordlength init -1
-
-gkpump = 0
-gkreverse init 0
-
-#include "wavetables.udo"
-#include "bussing.udo"
-#include "hat909.src"
-#include "text_tools.udo"
-#include "effects.udo"
-
-gicurrentchordnum = 0
-gilastchordgroup = -1
-gilastsection = -1
-instr setcurrentchord
- isection = p4
- ichordincrement = p5
- ichordgroup = gisectionchords[isection]
- if (ichordgroup != gilastchordgroup || isection != gilastsection) then
- gicurrentchordnum = 0
- gilastchordgroup = ichordgroup
- gilastsection = isection
- elseif (ichordincrement == 1) then
- if (gicurrentchordnum + 1 < lenarray(gichordgroups, 2) - 1) then
-
- if (gichordgroups[ichordgroup][gicurrentchordnum + 1] == 0) then
- gicurrentchordnum = 0
- else
- gicurrentchordnum += 1
- endif
- else
- gicurrentchordnum = 0
- endif
- else
- gicurrentchordnum = 0
- endif
-
- ifn = gichordgroups[ichordgroup][gicurrentchordnum]
-
- gkcurrentchordlength = tab:k(0, ifn)
- gicurrentchordfn = ifn
- turnoff
-endin
-
-
-
-instr bootstrap
- iprepareindex = p4
- if (iprepareindex >= lenarray(gSprepare)) then
- notify("Parsing events")
- parsetext("/home/bargepole/bpcheckout/csTech/TechnoPieces/BUG3/source.txt"); "source.txt")
- notify("Running sequencer")
- event_i "i", "sequencer", 0, 3600
- turnoff
- else
- Sprepareinstr = gSprepare[iprepareindex]
- notify(sprintf("Preparing audio for %s", Sprepareinstr))
- Srcinstr = sprintf("src_%s", Sprepareinstr)
- ilen = 0.3
- p3 = ilen
- ifn ftgen 0, 0, sr*ilen, 7, 0
- gipreparedfns[gipreparedfnindex] = ifn
- gipreparedfnindex += 1
- ktimek timeinstk
- if (ktimek == 1) then
- kcycles = ilen * kr
- kcount init 0
-loop:
- apos phasor (1/(ftlen(ifn)/sr))
- aproc subinstr Srcinstr, 1, 0.1
- tabw aproc, apos, ifn, 1
- loop_lt kcount, 1, kcycles, loop
- elseif (ktimek == 5) then
- event "i", "bootstrap", 0, 1, iprepareindex+1
- turnoff
- endif
- endif
-endin
-
-
-opcode arrseq, 0, Skk
- Splayer, kpos, ksection xin
- idel = 0.3 ; delay for chord update
- Sinstrument = sprintf("play_%s", Splayer)
- instrindex = gettextindex(Splayer)
- kdata = gisections[ksection][instrindex] ;ksection
-
- if (kdata != -1) then ; null section
- kon = tablekt:k(kpos, gisectiondata[kdata][0])
-
- if (kon == 1) then
- kchance = tablekt:k(kpos, gisectiondata[kdata][3])
- if (random:k(0, 1) < kchance) then
- ktime = (kpos % 2 == 0) ? 0 : 0.04
- kdur = tablekt:k(kpos, gisectiondata[kdata][1])
- ;kamp = tablekt:k(kpos, gisectiondata[kdata][2])
- event "i", Sinstrument, idel+ktime, kdur, kpos, kdata
- endif
- endif
- endif
-endop
-
-
-;gintervals1[] fillarray 0, 4, 6, 7, 11
-gintervals1[] fillarray 0, 3, 7, 9, 10
-instr play_bass
- iamp = getparameter(p4, p5, 2)
- iaugment = (random(0, 1) > 0.9) ? 24 : 36
- inote = tab_i(random(1, ftlen(gicurrentchordfn) - 3), gicurrentchordfn) - iaugment
- a1 foscil 0.5, cpsmidinn(inote), 1, 2, random(0, 6), gifnSine
- a1 pareq a1, 150, 0.24, 0.9
- a1 pareq a1, 80, 1.3, 0.9
- kenv linseg 1, p3, 0
- aout = a1*kenv
- bus_mix("master", aout, aout)
-endin
-
-instr play_mel1
- iamp = getparameter(p4, p5, 2)
- ihigher = getparameter(p4, p5, 4)
- iaugment1 = (ihigher == 1 && random(0, 1) > 0.6) ? 12 : 0
- ifreq1 = cpsmidinn(tab_i(random(1, ftlen(gicurrentchordfn) - 1), gicurrentchordfn) + iaugment1)
- ifreq2 = cpsmidinn(tab_i(random(1, ftlen(gicurrentchordfn) - 1), gicurrentchordfn))
- kfreq linseg ifreq1, p3*0.4, ifreq1, p3*0.2, ifreq2, p3*04, ifreq2
- kfreq += oscil(10, 6)
- kcar = abs(oscil(4, 0.001)) + 1
- a1 foscil 0.5, kfreq, kcar, 1, random(0, 6), gifnSine
- a1 butterlp a1, 10000
- a1 butterhp a1, 600
- kenv linseg 0, p3*0.2, random(0.8, iamp), p3*0.6, random(0.8, iamp), p3*0.2, 0
- aL, aR pan2 a1*kenv*0.7, random(0.2, 0.8)
- bus_mix("reverb", aL, aR)
- bus_mix("master", aL, aR)
-endin
-
-instr play_chorditem1
- inote = p4
- kfreq1 linseg cpsmidinn(inote-36), p3*0.1, cpsmidinn(inote+12), p3*0.9, cpsmidinn(inote+12)
- kindex linseg 1, p3, 5
- aL1 foscil 0.1, kfreq1 + oscil:k(3, 10), 5, 1, kindex, gifnSquare
- aR1 foscil 0.1, kfreq1 + oscil:k(4, 6), 5, 1, kindex, gifnSquare
- aL1 butterlp aL1, abs(oscil(1000, 3)) + 500
- aR1 butterlp aR1, abs(oscil(1000, 5)) + 500
-
- kfreq2 linseg cpsmidinn(inote-12), p3*0.1, cpsmidinn(inote), p3*0.7, cpsmidinn(inote), p3*0.2, cpsmidinn(inote-36)
- aL2 foscil 0.1, kfreq2 + oscil:k(3, 7), 2, 5, 5-kindex, gifnSine
- aR2 foscil 0.1, kfreq2 + oscil:k(3, 5), 3, 3, 5-kindex, gifnSine
- kenv1 linseg 1, p3*0.8, 1, p3*0.2, 0
- kenv2 linseg 0, p3*0.3, 1, p3*0.69, 1, p3*0.01, 0
- aL butterhp (aL1*kenv1)+(aL2*kenv2), 500
- aR butterhp (aR1*kenv1)+(aR2*kenv2), 500
-
- bus_mix("reverb", aL*0.4, aR*0.4)
- aL *= 1-gkpump
- aR *= 1-gkpump
- bus_mix("master", aL, aR)
-endin
-
-
-
-instr global_reverb
- aL, aR bus_read "reverb"
- ;aL nreverb aL, 2.4, 0.3
- ;aR nreverb aR, 2.1, 0.2
- aL, aR freeverb aL, aR, 0.4, 0.3
- ;outs aL, aR
- bus_mix("master", aL, aR)
-endin
-
-
-instr play_chorditem2
- inote = p4
- a1 fmbell 0.2, cpsmidinn(inote+12), 1, 3, 0.05, 10, gifnSine, gifnSquare, gifnSine, gifnSquare, gifnSine
- a1 butterhp a1, 700
- kenv linseg 0, p3*0.5, 1, p3*0.4, 1, p3*0.1, 0
- aL, aR ensembleChorus a1*10*kenv, .07, .003, .75, 1, 12, gifnSine
-
- bus_mix("reverb", aL*0.2, aR*0.2)
- aL *= 1-gkpump
- aR *= 1-gkpump
- bus_mix("master", aL, aR)
-endin
-
-
-instr play_chorditem3
- inote = p4 - 12
- aL fmb3 0.2, cpsmidinn(inote), 1, 2, 0.07, 10, gifnSine, gifnSquare, gifnSine, gifnSquare, gifnSine
- aR fmb3 0.2, cpsmidinn(inote), 1, 1.4, 0.02, 10, gifnSine, gifnSine, gifnSine, gifnSquare, gifnSine
- aL butterhp aL, 300
- aR butterhp aR, 300
- kenv linseg 1, p3*0.5, 1, p3*0.4, 1, p3*0.1, 0
- aL *= kenv
- aR *= kenv
- bus_mix("reverb", aL*0.8, aR*0.8)
- bus_mix("master", aL, aR)
-endin
-
-
-instr play_chord1
- iamp = getparameter(p4, p5, 2)
- index = 1
- while (index < ftlen(gicurrentchordfn)) do
- event_i "i", "play_chorditem1", 0, p3, tab_i(index, gicurrentchordfn)
- index += 1
- od
-endin
-
-instr play_chord2
- iamp = getparameter(p4, p5, 2)
- index = 1
- while (index < ftlen(gicurrentchordfn)) do
- event_i "i", "play_chorditem2", 0, p3, tab_i(index, gicurrentchordfn)
- index += 1
- od
-endin
-
-instr play_chord3
- iamp = getparameter(p4, p5, 2)
- index = 1
- while (index < ftlen(gicurrentchordfn)) do
- event_i "i", "play_chorditem3", 0, p3, tab_i(index, gicurrentchordfn)
- index += 1
- od
-endin
-
-/*instr play_chord1
- index = 0
- Sinstrument = sprintf("play_chorditem%d", p4)
- while (index < lenarray(gintervals1)) do
- event_i "i", Sinstrument, 0, p3, gintervals1[index] + 52
- index += 1
- od
-endin
-*/
-
-instr global_out
- imastergain = 0.7
- aL, aR bus_read "master"
- ;aL butterhp aL, 150
- ;aR butterhp aR, 150
- ilooptime = (60/gitempo)*4
-
- kreverse delayk gkreverse, 0.
- if (kreverse == 1) then
- aL butterhp aL, 150
- aR butterhp aR, 150
- aL, krecL sndloop aL, -1, kreverse, ilooptime, 0
- aR, krecR sndloop aR, -1, kreverse, ilooptime, 0
- endif
- outs aL*imastergain, aR*imastergain
-endin
-
-instr sequencer
- isection = 1
- event_i "i", "setcurrentchord", 0, 1, isection
- event_i "i", "global_reverb", 0, p3
- event_i "i", "global_out", 0, p3
- kmetro metro (gitempo/60)*4
- kposabs init 0
- kposchord init 0
- kpos init 0
- ksection init isection
- if (kmetro == 1) then
-
-
- /*if (kpos == 0) then
- event "i", "play_chord1", 0, 2, 1
- endif
- if (kpos == 10) then
- event "i", "play_chord1", 0, 2, 2
- endif
-*/
-
- ;if (random:k(0, 1) > 0.6) then
- ; event "i", "play_bass", (kpos % 2 == 0) ? 0 : 0.04, 0.1
- ;endif
-
- if (random:k(0, 1) > 0.6) then
- ;event "i", "play_fm2", (kpos % 2 == 0) ? 0 : 0.04, 0.1
- endif
-
- arrseq "chord1", kpos, ksection
- arrseq "chord2", kpos, ksection
- arrseq "chord3", kpos, ksection
- arrseq "bass", kpos, ksection
- arrseq "hat909", kpos, ksection
- arrseq "hat909c", kpos, ksection
- arrseq "clap909", kpos, ksection
- arrseq "kick", kpos, ksection
- arrseq "rim", kpos, ksection
- arrseq "mel1", kpos, ksection
-
- if (kpos < 31) then
- kpos += 1
- else
- kpos = 0
- endif
- if (kposabs+16 > tab:k(ksection, gisectionlengths)*4) then
-
- gkreverse = 1
- endif
-
- if (kposabs < tab:k(ksection, gisectionlengths)*4) then
- kposabs += 1
- else
- gkreverse = 0
- ksection += 1
- kposabs = 0
- kposchord = 0
- event "i", "play_crash", 0, 1
- event "i", "setcurrentchord", 0, 1, ksection, 0
- endif
-
- if (kposchord < gkcurrentchordlength*4) then
- kposchord += 1
- else
- kposchord = 0
- event "i", "setcurrentchord", 0, 1, ksection, 1
- endif
-
- endif
-endin
-
-instr play_rim
- iamp = getparameter(p4, p5, 2)
- icps = 490*exp(log(2.0)*(57.0-69.0)/12.0)
- 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, gifnSine, 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("reverb", aL*0.3, aR*0.3)
- bus_mix("master", aL, aR)
-endin
-
-
-instr play_hat909
- iamp = getparameter(p4, p5, 2)
- index = 0
- ifn = gipreparedfns[index]
- apos phasor (1/(ftlen(ifn)/sr))
- aout1 table3 apos*0.4, ifn, 1
- aout2 table3 apos*0.9, ifn, 1
- aout3 table3 apos*1.1, ifn, 1
- amix1 = delay(aout1*0.6, 0.02) + delay(aout2*0.8, 0.01)
- amix2 = delay(aout1*0.8, 0.01) + delay(aout2*0.6, 0.02)
- aL = (aout3 + amix1 + (amix2 * 0.3))*0.5*iamp
- aR = (aout3 + amix2 + (amix1 * 0.3))*0.5*iamp
- bus_mix("reverb", aL*0.1, aR*0.1)
- bus_mix("master", aL, aR)
-endin
-
-
-instr play_hat909c
- iamp = getparameter(p4, p5, 2)
- index = 0
- ifn = gipreparedfns[index]
- apos phasor (1/(ftlen(ifn)/sr))
- aL table3 apos*0.65, ifn, 1
- aR table3 apos*0.76, ifn, 1
- aL *= iamp * 0.6
- aR *= iamp * 0.6
- aL *= 1-gkpump
- aR *= 1-gkpump
- bus_mix("reverb", aL*0.1, aR*0.1)
- bus_mix("master", aL, aR)
-endin
-
-
-instr play_crash
- iamp = 1
- index = 0
- ifn = gipreparedfns[index]
- apos phasor (1/(ftlen(ifn)/sr))
- aL table3 apos, ifn, 1
- aR table3 apos, ifn, 1
- aL reverb aL, 8
- aR reverb aR, 8
- kfreq line 1400, p3, 100
- aL *= oscil(0.9, kfreq) * iamp * 0.2
- aR *= oscil(0.9, kfreq) * iamp * 0.2
- ;aL *= 1-gkpump
- ;aR *= 1-gkpump
- bus_mix("reverb", aL*0.9, aR*0.9)
- bus_mix("master", aL, aR)
-endin
-
-
-instr play_clap909
- iamp = getparameter(p4, p5, 2)
- ilowpass = getparameter(p4, p5, 4)
- p3 = 0.065
- aL noise 1, 0.9
- aR noise 0.5, 0.4
- aL butterbp aL, 1200, 1100
- aR butterbp aR, 1200, 1100
- irevsend = 0.2
- if (ilowpass == 1) then
- aL butterlp aL, 900
- aR butterlp aR, 900
- irevsend = 0.6
- endif
- kamp1 linseg 1, p3*0.1, 0, p3*0.1, 1, p3*0.2, 0.1, p3*0.3, 0.5, p3*0.2, 0, p3*0.05, 0.4, p3*0.05, 0
- kamp2 linseg 1, p3*0.15, 0, p3*0.15, 1, p3*0.1, 0.1, p3*0.2, 0.5, p3*0.3, 0, p3*0.05, 0.4, p3*0.05, 0
-
- aL = aL*kamp1*9*iamp
- aR = aR*kamp2*9*iamp
-
- bus_mix("reverb", aL*irevsend, aR*irevsend)
- bus_mix("master", aL, aR)
-endin
-
-instr play_kick ; 808 style kick
- iamp = getparameter(p4, p5, 2)
- xtratim 0.1
- krelease release
- ktune init 0
- 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)
- amix distort amix, 0.4, gifnSine
- ;amix butterhp amix, 150
- bus_mix("master", amix, amix)
-endin
-
-
-</CsInstruments>
-<CsScore>
-i"bootstrap" 0 1 0
-
-</CsScore>
-</CsoundSynthesizer> \ No newline at end of file