aboutsummaryrefslogtreecommitdiff
path: root/site/udo/fnml/transition_snare_preSOUNDDB.udo
diff options
context:
space:
mode:
Diffstat (limited to 'site/udo/fnml/transition_snare_preSOUNDDB.udo')
-rwxr-xr-xsite/udo/fnml/transition_snare_preSOUNDDB.udo133
1 files changed, 133 insertions, 0 deletions
diff --git a/site/udo/fnml/transition_snare_preSOUNDDB.udo b/site/udo/fnml/transition_snare_preSOUNDDB.udo
new file mode 100755
index 0000000..70df4e2
--- /dev/null
+++ b/site/udo/fnml/transition_snare_preSOUNDDB.udo
@@ -0,0 +1,133 @@
+#ifndef UDO_TRANSITION_SNARE
+#define UDO_TRANSITION_SNARE ##
+
+#include "sequencing_scheduled.udo"
+#include "sequencing_melodic_portamento.udo"
+#include "uniqueid.udo"
+#include "bussing.udo"
+#include "sound_sdb.udo"
+
+gifnmt_rollfndamp[][] sdb_getcollection "Snare.Dampened"
+gifnmt_rollfnregular[][] sdb_getcollection "Snare.Regular"
+gifnmt_rollfnrimhard[][] sdb_getcollection "Snare.Rim.Hard"
+gifnmt_rollfnrimsoft[][] sdb_getcollection "Snare.Rim.Soft"
+gifnmt_rollfnunrestrained[][] sdb_getcollection "Snare.Unrestrained"
+
+
+instr fnmt_rollplay
+ istartbeats = p4 ; number of beats before next event as specified in iwaitmode
+ iwaitmode = p5 ; -1 = start of next bar, -2 = start of next bargroup , any other = number of total beats before event point
+ iampmode = p6 ; 0 = linear, 1 = exponential, 2 = random (randomises each individually)
+ idorelease = p7 ; do release, 0 or 1
+ idotune = p8 ; do tuning, 0 or 1
+ idorandom = p9 ; do random sound selection for each click
+
+ if (p10 == 0) then
+ Sbus = "main"
+ else
+ Sbus = p10
+ endif
+
+ p3 = 600
+
+ if (iwaitmode == -1) then
+ kwaittrig = bar_lastbeatxof(istartbeats)
+ elseif (iwaitmode == -2) then
+ kwaittrig = bargroup_lastbeatxof(istartbeats)
+ else
+ kwaittrig = lastbeatxof(iwaitmode, istartbeats)
+ endif
+
+ if (kwaittrig == 1) then
+ schedulek "_fnmt_rollplay1", 0, i(gkseq_beattime) * istartbeats, iampmode, idorelease, idotune, idorandom, Sbus
+ turnoff
+ endif
+endin
+
+
+
+instr _fnmt_rollplay1
+ imode = p4 ; 0 = linear, 1 = exponential, 2 = random (randomises each individually)
+ idorelease = p5
+ idotune = p6
+ idorandom = p7
+ Sbus = p8
+
+ ichannelid = uniqueid()
+ if (idotune == 1) then ; TODO: separate channel for tuned ones
+ ichannelidtuned = uniqueid()
+ endif
+
+ ibeattime = i(gkseq_beattime)
+ itempo = i(gkseq_tempo)
+ ibeathz = itempo / 60
+ ireltime = (idorelease == 1) ? random(ibeattime, ibeattime*4) : 0
+ imtime = p3
+
+ krelease release
+
+ if (imode == 0 || (imode == 2 && random(0, 1) >= 0.5)) then
+ kfreq linsegr ibeathz * round(random(4, 16)), imtime, ibeathz * round(random(4, 16)), ireltime, ibeathz * round(random(4, 16))
+ else
+ kfreq expsegr ibeathz * round(random(4, 16)), imtime, ibeathz * round(random(4, 16)), ireltime, ibeathz * round(random(4, 16))
+ endif
+
+ if (imode == 0 || (imode == 2 && random(0, 1) >= 0.5)) then
+ kamp linsegr 0, p3, 1, ireltime, 0
+ else
+ kamp expsegr 0.0001, imtime, 1, ireltime, 0.0001
+ endif
+
+ ichancepercent = 100
+
+ kmetro metro kfreq
+ ktrig = (kmetro == 1 && random:k(0, 100) < ichancepercent) ? 1: 0
+
+ ksampleset = 1
+ if (krelease == 1) then
+ ksampleset = 0
+ endif
+
+ if (ktrig == 1) then
+ event "i", "_fnmt_rollitem", 0, 1, ksampleset, kamp, ichannelid
+ endif
+
+ aL, aR bus_read sprintf("fnmt_roll%d", ichannelid)
+
+ if (idotune == 1) then
+ aL, aR mel_tune_portamento aL, aR, 0, 16
+ aL butterhp aL, 120
+ aR butterhp aR, 120
+ endif
+
+ bus_mix(Sbus, aL, aR)
+endin
+
+
+
+instr _fnmt_rollitem
+ isampleset = p4
+ iamp = p5
+ ichannelid = p6
+ if (isampleset == 0) then
+ isound[] get_sound gifnmt_rollfndamp[round(random(0, lenarray(gifnmt_rollfndamp) - 1))][0]
+ elseif (isampleset == 1) then
+ isound[] get_sound gifnmt_rollfnrimhard[round(random(0, lenarray(gifnmt_rollfnrimhard) - 1))][0]
+ endif
+
+ ;index = round(random(0, gimaxes[isampleset] - 1))
+ ;ifn = gisamples[isampleset][index]
+ ;p3 = (ftlen(ifn) / ftsr(ifn)) + 0.1
+
+ p3 = isound[3]
+ ifn = isound[0]
+ if (isound[2] == 2) then
+ aL, aR loscil iamp, 1, ifn, 1
+ else
+ aL loscil iamp, 1, ifn, 1
+ aR = aL
+ endif
+ bus_mix(sprintf("fnmt_roll%d", ichannelid), aL, aR)
+endin
+
+#end