#ifndef UDO_TRANSITION_CLICK #define UDO_TRANSITION_CLICK ## #include "sequencing_scheduled.udo" #include "sequencing_melodic_portamento.udo" #include "uniqueid.udo" #include "bussing.udo" #include "sounddb.udo" gifnmt_clickfn[] sounddb_getcollection "Snare.Regular,Hihat.Closed" instr fnmt_clickplay istartbeats = p4 ; number of beats before next event point 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 Sbus = strget(p10) ; bus to send to ; defaults to "main" SonHit = strget(p11) ; instrument to call when hit point is reached if (strcmp(Sbus, "") == 0) then Sbus = "main" 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_clickplay", 0, i(gkseq_beattime) * istartbeats, iampmode, idorelease, idotune, idorandom, Sbus, SonHit turnoff endif endin instr _fnmt_clickplay imode = p4 ; 0 = linear, 1 = exponential, 2 = random (randomises each individually) idorelease = p5 idotune = p6 idorandom = p7 Sbus = p8 SonHit = p9 ichannelid = uniqueid() ibeattime = i(gkseq_beattime) itempo = i(gkseq_tempo) ireltime = (idorelease == 1) ? random(ibeattime, ibeattime*4) : 0 imtime = p3 ibeathz = itempo / 60 if (strcmp(SonHit, "") != 0) then schedule(SonHit, imtime, 1) endif 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 iminpitch = 6 imaxpitch = 20 if (imode == 0 || (imode == 2 && random(0, 1) >= 0.5)) then kpitch linsegr random(iminpitch, imaxpitch), imtime, random(iminpitch, imaxpitch), ireltime, random(iminpitch, imaxpitch) else kpitch expsegr random(iminpitch, imaxpitch), imtime, random(iminpitch, imaxpitch), ireltime, random(iminpitch, imaxpitch) endif if (imode == 0 || (imode == 2 && random(0, 1) >= 0.5)) then kpan linsegr random(0, 1), imtime, random(0, 1), ireltime, random(0, 1) else kpan expsegr random(0.0001, 1), imtime, random(0.0001, 1), ireltime, random(0.0001, 1) 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 if (idorandom == 1) then ifn = -1 ichans = -1 idur = 1 else ifileid = gifnmt_clickfn[round(random(0, lenarray(gifnmt_clickfn) - 1))] ifn = gisounddb[ifileid][0] ichans = gisounddb[ifileid][1] idur = gisounddb[ifileid][2] endif kmetro metro kfreq if (kmetro == 1) then schedulek "_fnmt_clickitem", 0, idur / kpitch, ifn, kamp, kpitch, kpan, ichannelid, ichans endif aL, aR bus_read sprintf("fnmt_click%d", ichannelid) if (idotune == 1) then aL, aR mel_tune_portamento aL, aR, 0, 2 endif bus_mix(Sbus, aL, aR) endin instr _fnmt_clickitem ifn = p4 iamp = p5 ipitch = p6 ipan = p7 ichannelid = p8 ichans = p9 if (ifn == -1) then ; random sound ifileid = gifnmt_clickfn[round(random(0, lenarray(gifnmt_clickfn) - 1))] ifn = gisounddb[ifileid][0] ichans = gisounddb[ifileid][1] p3 = gisounddb[ifileid][2] / ipitch endif if (ichans == 2) then a1, a_ loscil iamp, ipitch, ifn, 1 else a1 loscil iamp, ipitch, ifn, 1 endif aL, aR pan2 a1, ipan bus_mix(sprintf("fnmt_click%d", ichannelid), aL, aR) endin #end