instr basic_sine inote init p4 ifq = mtof:i(inote) iamp = p5 kenv = expsegr(1.01, p3, 0.01) - 0.01 ao = oscili(iamp, ifq) * kenv * 0.4 chnmix(ao, "out1") chnmix(ao, "out2") endin opcode basic_sine_gen, 0, kk ktrig, kamp xin kamp = limit:k(kamp, 0, 1) ktrig = limit:k(ktrig, 0, 1) if(check_trig(ktrig) == 1) then schedulek("basic_sine", 0, random:k(0.03, 0.1), random:k(50, 80), kamp * ktrig) endif endop instr pop_impl inote init p4 ifq = mtof:i(inote) iamp = p5 kenv = expsegr(1.01, p3, 0.01) - 0.01 kmod = oscili:k(ifq / 100, 40) ao = vco2(iamp, ifq + kmod) * kenv af = K35_lpf(ao, ifq*4, 8) * 0.3 chnmix(af, "out1") chnmix(af, "out2") endin opcode pop, 0, kkkk ktrig, kamp, knote, kdur xin kamp = limit:k(kamp, 0, 1) knote = limit:k(knote, 0, 100) + 27 kdur = to_tempo_dur(limit:k(kdur, 0.01, 1)) ktrig = limit:k(ktrig, 0, 1) if(check_trig(ktrig) == 1) then schedulek("pop_impl", 0, kdur, knote, kamp * ktrig) endif endop instr basic_kick iamp init p4 $FQPERC ihi = random:i(100, 600) ; 600 ilo = random:i(100, 800) ; 20 kfq = expseg(ihi, p3, ilo) ao = vco2(1, kfq) af = K35_lpf(ao, 100, 3) amod = oscili(100, 2) acar = oscili(1, abs(amod) + 250) abnd = butterhp(acar, 400) klofq = expseg(2000, p3/4, 20) alo = K35_lpf(abnd, klofq, 5) * 0.5 aenv = expseg:a(1.01, p3/4*3, 1.01, p3/4, 0.01) - 0.01 akick = (alo + af) * aenv * iamp adist = distort1(akick, ksavage*3, 1, 1 / (abs(gklorenz_x*3) + 1), 1 - abs(gklorenz_z)) kdist_mult = isavage_mode > 0 ? 1 : 0 adelayed init 0 kfb = mirror:k(abs(gklorenz_y) + 0.5, 0, 0.9) adel = interp( ( mirror:k( lineto(abs(ksavage), 0.1) , 0.2, 0.999 ) * 1000)) adelayed = vdelay(akick + (adelayed * kfb), adel, 1500) krel = linsegr:k(1, 1, 1, 1, 0) akick += (adelayed * kdist_mult) * krel chnmix(akick, "out1") chnmix(akick, "out2") endin opcode kick, 0, kkO ktrig, kamp, ksav xin kamp = limit:k(kamp, 0, 1) ktrig = limit:k(ktrig, 0, 1) ksav = rint:i(1, 5) if(check_trig(ktrig) == 1) then schedulek("basic_kick", 0, 0.1, kamp * ktrig, 0) endif endop instr noisy_hat asig = pinker() aenv = expseg(1.01, p3, 0.01) - a(0.01) ifq init p4 iamp init p5 isavage_mode init p6 $SAVAGE(isavage_mode') kfq = ifq + (ifq * ksavage) af = K35_hpf(asig, kfq, 9) * aenv * iamp adelayed init 0 kfb = mirror:k(abs(gklorenz_y) + 0.5, 0, 0.9) adel = interp( ( mirror:k( lineto(abs(ksavage), 0.1) , 0.2, 0.999 ) * 1000)) adelayed = vdelay3(af + (adelayed * kfb), adel, 1000) krel = linsegr:k(1, 1, 1, 1, 0) ksav_mult = (isavage_mode > 0) ? 1 : 0 amix = af + (adelayed * ksav_mult) chnmix(amix, "out1") chnmix(amix, "out2") endin opcode hihat, 0, kkkkO ktrig, kamp, knote, kdur, ksav xin kamp = limit:k(kamp, 0, 1) kdur = to_tempo_dur(limit:k(kdur, 0.001, 100)) kfq = mtof(limit:k(knote, 0, 100) + 27) ktrig = limit:k(ktrig, 0, 1) if(check_trig(ktrig) == 1) then schedulek("noisy_hat", 0, kdur, kfq, kamp * ktrig, ksav) endif endop instr bass_impl iamp init p4 ifq init p5 imodspeed init p6 ao = vco2(0.8, ifq) aenv = expsegr:a(0.01, 0.05, 1.01, p3 - 0.05, 1.01, p3/16, 0.01) - a(0.01) imult = rint:i(1, 8) if(imodspeed >= 0) then imult = imodspeed endif kmodfq = gktempo * imult kcut = poscil(0.5, kmodfq) + 0.5 afilt = K35_lpf(ao, limit:k(kcut * (ifq * 20) + 20, 0, 12000), 6) asynt = afilt * aenv * iamp * 0.2 ipan = random:i(0.25, 0.75) a1, a2 pan2 asynt, ipan chnmix(a1, "out1") chnmix(a2, "out2") endin opcode wah, 0, kkkkJ ktrigger, kamp, knote, kdur, kmodspeed xin kamp = limit:k(kamp, 0, 1) kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000)) kfq = mtof(limit:k(knote, 0, 100) + 20) ktrigger = limit:k(ktrigger, 0, 1) kmodspeed = limit:k(kmodspeed, -1, 100) if(check_trig(ktrigger) == 1) then schedulek("bass_impl", 0, kdur, kamp * ktrigger, kfq, kmodspeed) endif endop instr glide_impl iamp init p4 ifqcenter init p5 isavage_mode init p6 $SAVAGE(isavage_mode') ifqstart = random:i(ifqcenter - (ifqcenter/2), ifqcenter + (ifqcenter / 2)) ifqend = random:i(ifqcenter - (ifqcenter/2), ifqcenter + (ifqcenter / 2)) kfq = expseg(ifqstart, p3, ifqend) kfq = kfq + (ksavage * kfq) ;aenv = expsegr:a(0.01, p3/8, 1.01, p3/8*7, 1.01, p3/4, 0.01) - a(0.01) aenv = expsegr:a(0.01, p3, 1.01, p3/4, 0.01) - a(0.01) ao = vco2(1, kfq) afilt = K35_lpf(ao*aenv, kfq * 2, 7) * iamp * 0.3 chnmix(afilt, "out1") chnmix(afilt, "out2") endin maxalloc("glide", 12) opcode glide, 0, kkkkO ktrig, kamp, knote, kdur, ksav xin kdensity = 4 kamp = limit:k(kamp, 0, 1) kfq = mtof(limit:k(knote, 0, 100) + 20) ktrig = limit:k(ktrig, 0, 1) if(check_trig(ktrig) == 1) then kcnt = 0 while kcnt < kdensity do schedulek("glide_impl", 0, to_tempo_dur(kdur), kamp * ktrig, kfq, ksav) kcnt += 1 od endif endop instr trumpet_impl aenv = expseg:a(1.01, p3, 0.01) - a(0.01) ;kff init p4 kff = p4 isavage_mode init p8 $SAVAGE(isavage_mode') kff = kff + (ksavage * kff) ao = vco2(p5, kff + oscili:k(3, 0.1) ) * aenv ;ao2 = vco2(p5 * 0.7, kff + oscili:k(20, 0.15) ) * aenv ;ao3 = vco2(p5, kff * 1.9 + oscili:k(20, 0.15) ) * aenv anul = a(0) irnd = random:i(0.01, 0.2) kml = (p6 == 1) ? 1 : 0 kmb = (p6 == 2) ? 1 : 0 kmh = (p6 == 3) ? 1 : 0 af = spf(ao * kml, ao * kmb, ao * kmh, aenv * 500 + 400 + abs(oscili:k(1000, irnd)), p7) af *= 0.2 kpan = rspline(0, 1, 0.1, 2) a1, a2 pan2 af, kpan chnmix(a1, "out1") chnmix(a2, "out2") endin opcode ping, 0, kkkkO ktrig, kamp, knote, kdur, ksav xin kamp = limit:k(kamp, 0, 1) kfq = mtof(limit:k(knote, 0, 100) + 20) kdur = limit:k(kdur, 0.001, 1000) if(check_trig(ktrig) == 1) then schedulek("trumpet_impl", 0, to_tempo_dur(kdur), kfq, kamp, rint:k(1, 3), random:k(1, 4), ksav) endif endop instr wave_impl ; pluck env ;ares repluck iplk, kamp, icps, kpick, krefl, axcite axcite init 1 axcite = linseg:a(1, 0.01, 0) krefl = 0.5 kpick = 0.1 icps = 400 kamp = 1 iplk = 0.8 apluck = follow2(repluck(iplk, kamp, icps, kpick, krefl, axcite), 0.01, 0.05) ; ares follow2 asig, katt, krel isavage_mode init p6 $SAVAGE(isavage_mode') ifq init p5 iamp init p4 kfq1 = ifq + oscili:k(ifq / 100, rspline:k(0.01, 5, 1, 5)) kfq1 = kfq1 + (kfq1 * ksavage) kfq2 = (ifq * 0.99) + oscili:k(ifq / 100, rspline:k(0.01, 5, 1, 5)) kfq2 = kfq2 + (kfq2 * ksavage) ao = vco2(1/2, kfq1) ao += vco2(1/2, kfq2, 12) aenv = expsegr:a(0.01, p3/2, 1.01, p3/2, 1.01, p3, 0.01) - a(0.01) kfb = 0.5 adel = a(0.02) ;adel = rspline:a(0.01, 0.2, 0.01, 0.2) af = flanger(ao * aenv, adel, kfb) * iamp * 0.2 kpan = rspline:k(0, 1, 0.1, 3) a1, a2 pan2 af, kpan chnmix(a1, "out1") chnmix(a2, "out2") endin opcode wave, 0, kkkkO ktrig, kamp, knote, kdur, ksav xin kfq = mtof(limit:k(knote, 0, 100) + 20) kamp = limit:k(kamp, 0, 1) ktrig = limit:k(ktrig, 0, 1) kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000)) if(check_trig(ktrig) == 1) then schedulek("wave_impl", 0, kdur, kamp, kfq, ksav) endif endop instr pluck_impl ; pluck env ;ares repluck iplk, kamp, icps, kpick, krefl, axcite aseg = linsegr:a(0, 0.01, 0.1, p3 - 0.01, 0.3, p3/4, 1) aenv = tablei:a(aseg, 1, 1) imult init p6 iamp init p4 inote init p5 if(imult <= 0) then imult = rint:i(1, 10) endif isavage_mode init p7 $SAVAGE(isavage_mode') ifq1 = mtof:i(inote + (imult * 0)); / ((1) * 2) ifq2 = mtof:i(inote + (imult * 1)); / ((2) * 2) ifq3 = mtof:i(inote + (imult * 2)); / ((3) * 2) ifq4 = mtof:i(inote + (imult * 3)); / ((4) * 2) kfq1 = ifq1 + (ksavage * ifq1) kfq2 = ifq2 + (ksavage * ifq2) kfq3 = ifq3 + (ksavage * ifq3) kfq4 = ifq4 + (ksavage * ifq4) imult = 1 - (inote / 100) imult *= (imult * imult) imult = (imult * 15) + 5 aosc = vco2(1/4, kfq1) + vco2(1/4, kfq2) + vco2(1/2, kfq3) + vco2(1/4, kfq4) aosc *= aenv af = K35_lpf(aosc, limit:a(aenv * ifq1 * imult, 0, 10000), 7) * iamp * 0.5 chnmix(af, "out1") chnmix(af, "out2") endin ; faire une table karplustrong ; trouver une solution pour le "mult" (random ? init ? harmonie ? ) opcode chord, 0, kkkkJO ktrig, kamp, knote, kdur, kmult, ksav xin ktrig = limit:k(ktrig, 0, 1) kamp = limit:k(kamp ,0, 1) knote = limit:k(knote, 0, 100) + 20 kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000)) kmult = limit:k(kmult, -1, 10) if(check_trig(ktrig) == 1) then schedulek("pluck_impl", 0, kdur, kamp, knote, kmult, ksav) endif endop opcode funkymod, k, kkk kamp, kfq, kduty xin ; 1 sine ; 2 tri ; 3 square ; 4 saw up ; 5 saw down ; 6 pwm iwave = rint:i(1, 6) if(iwave == 3) then iwave = 4 elseif(iwave == 6) then iwave = 5 endif klf_amp = (iwave < 6) ? 1 : 0 kpwm_amp = 1 - klf_amp klfo = lfo:k(kamp, kfq) if(iwave < 3) then klfo += kamp klfo /= 2 endif klfo *= klf_amp kpwm = vco2(kamp*0.5, kfq, 2, kduty) + (kamp * 0.5) kpwm *= kpwm_amp xout klfo + kpwm endop instr buzzy_impl iwavet[] fillarray 0, 2, 4, 12 iwavep = rint:i(0, lenarray(iwavet)-1) iwave = iwavet[iwavep] kpw = rspline(0, 1, 0.25, 4) ifq init p4 kfq = ifq + rspline:k(-(ifq/1000), ifq/1000, 0.01, 0.3) isavage_mode init p6 $SAVAGE(isavage_mode') kfq = kfq + (kfq * ksavage) ao = vco2(0.3, kfq, iwave, kpw ) * (expseg(1.01, p3, 0.01) - 0.01) ahp,alp,abp,abr svn ao, kfq, 10, 0.5 iamp init p5 ipick = rint:i(1, 4) ihp = (ipick == 1) ? 1 : 0 ilp = (ipick == 2) ? 1 : 0 ibp = (ipick == 3) ? 1 : 0 ibr = (ipick == 4) ? 1 : 0 ares = (ahp * ihp) + (alp * ilp) + (abp * ibp) + (abr * ibr) imodfq = random:i(0.5, 4) imodamp = random:i(0.2, 1) kduty = rspline:k(0, 1, 0.2, 4) kmod = funkymod(imodamp, imodfq, kduty) ares = (ares * kmod) + (ares * (1 - imodamp)) ares *= iamp ipan = random:i(0, 1) al, ar pan2 ares, ipan outs al, ar endin opcode buzzy, 0, kkkkO ktrig, kamp, knote, kdur, ksav xin ktrig = limit:k(ktrig, 0, 1) kamp = limit:k(kamp ,0, 1) knote = limit:k(knote, 0, 100) + 20 kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000)) if(check_trig(ktrig) == 1) then schedulek("buzzy_impl", 0, kdur, mtof:k(knote), kamp, ksav) endif endop instr fnoise_impl iamp init p5 ifqmult init 4 ifqoffset init p4 kcrv = expsegr:k(0.01, p3/4, 1.01, p3, 0.01) - 0.01 kres = kcrv * 0.7 kcf = kcrv * ifqmult + ifqoffset ao = noise(0.5, 0.5) * kcrv ao *= kcrv afilt = vclpf(ao, kcf, kres) asig = afilt kpan = rspline:k(0, 1, 0.01, 0.4) a1, a2 pan2 asig, kpan outs a1, a2 endin opcode noisy, 0, kkkk ktrig, kamp, knote, kdur xin ktrig = limit:k(ktrig, 0, 1) kamp = limit:k(kamp ,0, 1) knote = limit:k(knote, 0, 100) + 20 kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000)) if(check_trig(ktrig) == 1) then schedulek("fnoise_impl", 0, kdur, mtof:k(knote), kamp) endif endop #define PI #3.141592653589793# opcode audio_ltone, a, a ain xin aout init 0 kcnt = 0 while kcnt < ksmps do aout[kcnt] = (ain[kcnt] < 1) ? 1 : 0 kcnt += 1 od xout aout endop gipulsar_env = ftgen(0, 0, 16384, -16, 0, 682, -3.606, 0.99403, 4588, 3.8776, 0.47761, 11112, -6.1075, 0) instr pulsar_impl ifq init p5 iform_fq init p6 isine_cycles init p7 iamp init p4 aenv = tablei:a(linseg:a(0, p3, 1), gipulsar_env, 1) kform_fq = (iform_fq) + randomi:k(0, iform_fq / 10, 0.2) apulsaret_phase = phasor:a(ifq) * kform_fq / ifq agate = audio_ltone(apulsaret_phase) ;(apulsaret_phase < 1) ? 1 : 0 awin = pow(apulsaret_phase, 4) asine = sin:a(apulsaret_phase * 2 * $PI * isine_cycles) * awin * agate asine *= iamp * 0.7 * aenv ipan = random:i(0.25, 0.75) al, ar pan2 asine, ipan outs al, ar endin opcode pulsar, 0, kkkkkk ktrig, kamp, knote, kdur, kformant_fq, ksine_cycles xin ktrig = limit:k(ktrig, 0, 1) kamp = limit:k(kamp ,0, 1) knote = limit:k(knote, 0, 100) + 20 kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000)) kformant_fq = limit:k(kformant_fq, 0, 10) * 150 + 300 ksine_cycles = int(limit:k(ksine_cycles, 1, 10)) if(check_trig(ktrig) == 1) then schedulek("pulsar_impl", 0, kdur, kamp, mtof:k(knote), kformant_fq, ksine_cycles) endif endop gigraou_env = ftgen(0, 0, 16384, -16, 0, 185, -3.606, 1, 3125, 4.7463, 0.40746, 13072, -8.0925, 0) gaGraou[] init 2 instr graou_out afbl init 0 afbr init 0 al = gaGraou[0] ar = gaGraou[1] imaxdel init 2000 adL = randomi:a(100, 500, 0.1) adR = randomi:a(125, 525, 0.1) adelL = vdelay(al+afbl, adL, imaxdel) adelR = vdelay(ar+afbr, adR, imaxdel) ifb init 0.6 afbl = adelL * ifb afbr = adelR * ifb gaGraou[0] = 0 gaGraou[1] = 0 outs al+adelL, ar+adelR endin schedule("graou_out", 0, -1) instr graou_impl iamp init p4 ifq init p5 iQ init p6 aosc = vco2:a(1, ifq) kfilt_env = expseg:k(5000, p3, 50) afilt = K35_lpf(aosc, kfilt_env, iQ) aenv = tablei:a(linseg:a(0, p3, 1), gigraou_env, 1) afilt *= aenv * iamp * 0.4 ipan = random:i(0.25, 0.75) al, ar pan2 afilt, ipan gaGraou[0] = gaGraou[0] + al gaGraou[1] = gaGraou[1] + ar endin opcode piou, 0, kkkkk ktrig, kamp, knote, kdur, kQ xin ktrig = limit:k(ktrig, 0, 1) kamp = limit:k(kamp ,0, 1) knote = limit:k(knote, 0, 100) + 20 kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000)) kQ = limit:k(kQ, 1, 10) if(check_trig(ktrig) == 1) then schedulek("graou_impl", 0, kdur, kamp, mtof:k(knote), kQ) endif endop instr smooth_wave_instr inote init p4 iamp init p5 $FQ acrv = transeg:a(0, p3/3, 3, 1, p3/3*2, -3, 0) ;acrv = tablei:a(linseg:a(0, p3, 1), icrv, 1) * linseg:a(0, p3/100, 1, p3/100*98, 1, p3/100, 0) kvib = poscil:k( expseg:k(random:i(0, ifq/30), p3, random:i(0, ifq/30)), expseg:k(random:i(0.01, 10), p3, random:i(0.01, 10))) asig = vco2(0.8, kfq + kvib, 10) abnd = bqrez:a(asig, kfq, 50, 3) aout = balance(abnd, asig) * (acrv * iamp) ipan = random:i(0, 1) aL, aR pan2 aout * gkgain, ipan chnmix(aL, "out1") chnmix(aR, "out2") endin opcode buzzwave, 0, kkkkO ktrig, kamp, knote, kdur, ksav xin ktrig = limit:k(ktrig, 0, 1) kamp = limit:k(kamp ,0, 1) knote = limit:k(knote, 0, 100) + 20 kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000)) if(trigger:k(ktrig, 0.5, 0) == 1) then schedulek("smooth_wave_instr", 0, kdur, knote, kamp, ksav) endif endop instr smooth_noise_instr inote init p4 iamp init p5 $FQ afb init 0 acrv = transeg:a(0, p3/3, 3, 1, p3/3*2, -3, 0) kvib = oscili:k( expseg:k(random:i(0, ifq/30), p3, random:i(0, ifq/30)), expseg:k(random:i(0.1, 15), p3, random:i(0.1, 15))) asig = pinker() kfreq = kfq + kvib abnd = bqrez:a( bqrez:a(asig, kfreq, 70, 2), kfreq * 2, 70, 2) adist = distort1(abnd, 2, 1, 0.15, 0.15) aout = balance(adist, asig) * (acrv * iamp) ;adel = abs(oscili:a(200, expseg:a(random:i(0.1, 15), p3, random:i(0.1, 15)))) adelayed = vdelay3(aout + afb, a(100) , 1000) afb = adelayed * 0.2 ares = (adelayed + aout) ipan = random:i(0, 1) aL, aR pan2 ares * 5 * gkgain, ipan chnmix(aL, "out1") chnmix(aR, "out2") endin opcode noisywave, 0, kkkkO ktrig, kamp, knote, kdur, ksav xin ktrig = limit:k(ktrig, 0, 1) kamp = limit:k(kamp ,0, 1) knote = limit:k(knote, 0, 100) + 20 kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000)) if(trigger:k(ktrig, 0.5, 0) == 1) then schedulek("smooth_noise_instr", 0, kdur, knote, kamp, ksav) endif endop ; very chaotic nonlinear moving waveform & timber & modulation instr crunchy_instr inote init p4 iamp init p5 $FQ ao = vco2:a(iamp, kfq) + oscili:a(iamp * 0.5, kfq * 0.5) afilt = K35_lpf(ao, abs(galorenz_x)*2000+100, abs(galorenz_z) * 5 + 1.05 ) kshape1 = 0.1;lag(abs( gklorenz_y) * 0.1, 1) kshape2 = 0.1;lag(abs(gklorenz_z) * 0.1, 1) kpregain = mirror:k(gklorenz_x * gklorenz_y, 0.03, 1) * 500 kpostgain = 1 / limit:k(kpregain, .2, 25);0.1 adist = lag(distort1(afilt, kpregain, kpostgain, kshape1, kshape2) , 0.003) aenv = (expseg:a(1.01, p3, 0.01) - a(0.01)) adist *= aenv * iamp * 0.8 kpan = gkmirlorenz_y aL, aR pan2 adist * gkgain, kpan chnmix(aL, "out1") chnmix(aR, "out2") endin opcode crunchy, 0, kkkkO ktrig, kamp, knote, kdur, ksav xin ktrig = limit:k(ktrig, 0, 1) kamp = limit:k(kamp ,0, 1) knote = limit:k(knote, 0, 100) + 20 kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000)) if(check_trig(ktrig) == 1) then schedulek("crunchy_instr", 0, kdur, knote, kamp, ksav) endif endop instr crunchyslow_instr inote init p4 iamp init p5 $FQ ao = vco2:a(iamp, kfq) + oscili:a(iamp * 0.5, kfq * 0.5) + vco2(iamp*0.25, kfq * 3) afilt = K35_lpf(ao, mirror:a(galorenz_x, 0, 1)*5000+100, abs(galorenz_z) * 5 + 1.05 ) kshape1 = 0.1;lag(abs( gklorenz_y) * 0.1, 1) kshape2 = 0.1;lag(abs(gklorenz_z) * 0.1, 1) kpregain = mirror:k(gklorenz_x * gklorenz_y, 0.03, 1) * 350 ;kpostgain = 0.1 kpostgain = 1 / limit:k(kpregain, .2, 25);0.1 adist = lag(distort1(afilt, kpregain, kpostgain, kshape1, kshape2) , 0.003) aenv = (expseg:a(0.01, p3/2, 1.01, p3/2, 0.01) - a(0.01)) adist *= aenv * iamp ipan_base = rint:i(0, 1) kpan = gkmirlorenz_y if(ipan_base > 0) then kpan = 1 - kpan endif aL, aR pan2 adist * gkgain, kpan chnmix(aL, "out1") chnmix(aR, "out2") endin opcode crunchy_wav, 0, kkkkO ktrig, kamp, knote, kdur, ksav xin ktrig = limit:k(ktrig, 0, 1) kamp = limit:k(kamp ,0, 1) knote = limit:k(knote, 0, 100) + 20 kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000)) if(check_trig(ktrig) == 1) then schedulek("crunchyslow_instr", 0, kdur, knote, kamp, ksav) endif endop opcode darkwave, 0, kkkkO ktrig, kamp, knote, kdur, ksav xin crunchy_wav(ktrig, kamp, knote, kdur, ksav) endop instr shinywave_instr inote init p4 iamp init p5 $FQ ao = vco2:a(iamp, kfq) + oscili:a(iamp * 0.5, kfq * 0.5) + vco2(iamp*0.45, kfq * 2) + vco2(iamp*0.3, kfq*3) ;afilt = K35_lpf(ao, mirror:a(galorenz_x, 0, 1)*5000+100, abs(galorenz_z) * 5 + 1.05 ) kshape1 = 0;lag(abs( gklorenz_y) * 0.1, 1) kshape2 = 0; lag(abs(gklorenz_z) * 0.1, 1) kpregain = abs( lag( mirror:k(gklorenz_x * gklorenz_y, 0.03, 1) , 0.5) ) * 500 kpostgain = 0.1 adist = lag(distort1(ao, kpregain, kpostgain, kshape1, kshape2) , 0.003) aenv = (expsegr:a(0.01, p3, 1.01, 0.05, 0.01) - a(0.01)) adist *= aenv * iamp * 0.7 ipan_base = rint:i(0, 1) kpan = gkmirlorenz_y if(ipan_base > 0) then kpan = 1 - kpan endif aL, aR pan2 adist * gkgain, kpan chnmix(aL, "out1") chnmix(aR, "out2") endin opcode brightwave, 0, kkkkO ktrig, kamp, knote, kdur, ksav xin ktrig = limit:k(ktrig, 0, 1) kamp = limit:k(kamp ,0, 1) knote = limit:k(knote, 0, 100) + 20 kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000)) if(check_trig(ktrig) == 1) then schedulek("shinywave_instr", 0, kdur, knote, kamp, ksav) endif endop ; very chaotic nonlinear moving waveform & timber & modulation instr glide_instr inote init p4 iamp init p5 $FQ ibase = random:i(0.01, 0.4) * ifq kglide = transeg:k(ibase, p3/4, -6, ifq) + (ksavage * ifq) ao = vco2:a(iamp, kglide) + oscili:a(iamp * 0.5, kglide * 0.5) + vco2(iamp * 0.3, kglide * 2, 10) ;afilt = K35_lpf(ao, abs(galorenz_x)* 10000+500, abs(galorenz_z) * 3 + 1.05 ) kshape1 = lag(abs( gklorenz_y) * 0.1, 1) kshape2 = lag(abs(gklorenz_z) * 0.1, 1) kpregain = abs( lag( mirror:k(gklorenz_y * gklorenz_z, 0.03, 1) , 1) ) * 500 kpostgain = 0.1 adist = lag(distort1(ao, kpregain, kpostgain, kshape1, kshape2) , 0.003) aenv = (expseg:a(0.01, 0.02, 1.01, p3 - 0.02, 0.01) - a(0.01)) adist *= aenv * iamp * 0.3 kpan = gkmirlorenz_z ;mirror:a(abs(galorenz_y), 0, 1) aL, aR pan2 adist * gkgain, kpan chnmix(aL, "out1") chnmix(aR, "out2") endin opcode glidy, 0, kkkkO ktrig, kamp, knote, kdur, ksav xin ktrig = limit:k(ktrig, 0, 1) kamp = limit:k(kamp ,0, 1) knote = limit:k(knote, 0, 100) + 20 kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000)) if(check_trig(ktrig) == 1) then schedulek("glide_instr", 0, kdur, knote, kamp, ksav) endif endop instr snare_impl idur init p3 ; Duration idyn init p4 ; Amplitude ifqc init p5 ; Pitch to frequency irez init p6 ; Tone ispdec init p7 ; Spring decay ispton init p8 ; Spring tone ispmix init p9 ; Spring mix ispq init p10 ; Spring Q ipbnd init p11 ; Pitch bend ipbtm init p12 ; Pitch bend time kdclk linseg 1, idur-.002, 1, .002, 0 ; Declick envelope adyn linseg 1, .2/ifqc, 1, .2/ifqc, 0, idur-.002, 0 ; An amplitude pulse kptch linseg 1, ipbtm, ipbnd, ipbtm, 1, .1, 1 aosc1 vco 1, ifqc, 2, 1, 1, 1 ; Use a pulse of the vco to stimulate the filters aosc = -aosc1*adyn ; Multiply by the envelope pulse aosc2 butterlp aosc, 12000 ; Lowpass at 12K to take the edge off asig1 moogvcf aosc, ifqc*kptch, .9*irez ; Moof filter with high resonance for basic drum tone asig2 moogvcf aosc*.5, ifqc*2.1*kptch, .75*irez ; Sweeten with an overtone adynr expseg .1, .002, 1, .2, .005 apink1 pinkish 2, 0, 20;, iseed ; Use multi-rate pink noise apink2 pinkish 2, 0, 20;, iseed ; Use multi-rate pink noise apink1 = apink1*2*asig1 arndr1 delay apink1-apink2*.6, .01 ahp1l rezzy apink1+arndr1, 2700*ispton*kptch, 5*ispq, 1 ; High pass rezzy based at 2700 ahp2l butterbp apink1, 2000*ispton*kptch, 500/ispq ; Generate an undertone ahp3l butterbp apink1, 5400*ispton*kptch, 500/ispq ; Generate an overtone ahpl pareq ahp1l+ahp2l*.7+ahp3l*.3, 15000, .1, .707, 2 ; Attenuate the highs a bit ; Mix drum tones, pulse and noise signal & declick aoutl = (asig1+asig2+aosc2*.1+ahpl*ispmix*4)*idyn*kdclk isavage_mode init p13 $SAVAGE(isavage_mode') adelayed init 0 kfb = mirror:k(abs(gklorenz_y) + 0.5, 0, 0.9) adel = limit:a( interp( ( mirror:k( lineto(abs(ksavage), 0.1) , 0.2, 0.999 ) * 1000)), 0.01, 1000) adelayed = vdelay(aoutl + (adelayed * kfb), adel, 1500) krel = linsegr:k(1, 1, 1, 1, 0) ksav_mult = (isavage_mode > 0) ? 1 : 0 amix = (aoutl + (adelayed * ksav_mult)) * krel ;outall aoutl chnmix(amix, "out1") chnmix(amix, "out2") endin opcode snare, 0, kkO ktrig, kamp, ksav xin ktrig = limit:k(ktrig, 0, 1) kamp = limit:k(kamp ,0, 1) if(check_trig(ktrig) == 1) then ;i34 0.0 .5 30000 7.00 .5 .7 1 1 1 1 1.5 .1 idur random 1/12, 1/8 ; Duration kdyn = kamp ; random 1/9, 1/2 ; Amplitude kfqc random 500, 400 ; Pitch to frequency krez random 1/2, .95 ; Tone kspdec random 1, 2 ; Spring decay kspton random 1, 2 ; Spring tone kspmix random 1/9, 1 ; Spring mix kspq random 1/4, 2 ; Spring Q kpbnd random 1, 2 ; Pitch bend kpbtm random 1/32, 1/8 ; Pitch bend time schedulek "snare_impl", 0, idur, kdyn, kfqc, krez, kspdec, kspton, kspmix, kspq, kpbnd, kpbtm, ksav endif endop gawater[] init 2 instr water_verb a1 = gawater[0] a2 = gawater[1] aL, aR freeverb a1, a2, 0.8, 0.8, 48000 aenv = linsegr:a(0, 1, 1, 1, 0) aL *= aenv aR *= aenv aL = dcblock2(aL) aR = dcblock2(aR) outs aL*0.4, aR*0.4 gawater[0] = 0 gawater[1] = 1 endin maxalloc("water_verb", 1) schedule("water_verb", 0, -1) instr water_impl imaxshake = p4 ifreq = p5 ifreq1 = p6 ifreq2 = p7 iamp init p8 ipos init p9 ;low amplitude adrp dripwater .1, 0.09, 15, .9, imaxshake, ifreq, ifreq1, ifreq2 asig clip adrp, 2, 0.9 ; avoid drips that drip too loud ;asig = mirror(adrp, -0.9, 0.9) asig *= (0.3 * iamp) a1, a2 pan2 asig, ipos gawater[0] = gawater[0] + a1 gawater[1] = gawater[1] + a2 outs a1, a2 endin opcode water_drop, 0, kkk kamp, kspeed, kshake xin kshake = limit:k(kshake, 0, 1) ipos = random:i(0, 1) kamp = limit:k(kamp, 0, 1) kspeed = limit:k(kspeed, 0.001, 1)*15 kmet = drunk(kspeed, 0.7) if(kmet == 1) then kfq1 = random:k(380, 500) ;430 kfq2 = random:k(900, 1200) ; 1000 kfq3 = random:k(700, 880) ;800 schedulek("water_impl", 0, 0.5, kshake, kfq1, kfq2, kfq3, kamp, ipos) endif endop instr ks_impl ;ares pluck kamp, kcps, icps, ifn, imeth [, iparm1] [, iparm2] inote init p4 ;iamp init p5 kamp init p5 icps = mtof:i(inote) kcps = icps ifn init 0 imeth init 1 iparm1 = .001 iparm2 = 10 asig = pluck(kamp, kcps, icps, ifn, imeth, iparm1) imod_div = rint:i(1, 4) * 2 amod = pluck(1, kcps/imod_div, icps/imod_div, ifn, imeth, iparm1) ares = asig * (a(0.5) - amod) kpregain = 2 kpostgain = 0.25 kshape1 = 0 kshape2 = 0 imode = 3 ;adist distort1 ares, kpregain, kpostgain, kshape1, kshape2, imode adist = pdclip(ares*10, .5, 0.6) ablock = dcblock2(adist) adist = balance(adist, ares) * kamp ipan = random:i(0, 1) al, ar pan2 ablock, ipan chnmix(al, "out1") chnmix(ar, "out2") endin opcode strike, 0, kkkk ktrig, kamp, knote, kdur xin ktrig = limit:k(ktrig, 0, 1) kamp = limit:k(kamp ,0, 1) knote = limit:k(knote, 0, 100) + 20 kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000)) if(check_trig(ktrig) == 1) then schedulek("ks_impl", 0, kdur, knote, kamp) endif endop instr vibish_impl inote init p4 iamp init p5 kadd1 = rspline:k(-0.45, 0.28, 0.2, 1) kfq1 = mtof:k(inote+kadd1) kadd2 = rspline:k(-0.45, 0.35, 0.3, 1) kfq2 = mtof:k(inote+kadd2) iadd1 = random:i(.1, 6) iadd2 = random:i(.1, 8) iprop1 = random:i(0.1, 0.9) iprop1_inv = 1 - iprop1 idest1 = random:i(0.3, 0.75) kclipenv1 = cosseg:k(0, iprop1 * p3, idest1, iprop1_inv * p3, 0) iprop2 = random:i(0.1, 0.9) iprop2_inv = 1 - iprop1 idest2 = random:i(0.3, 0.75) kclipenv2 = cosseg:k(0, iprop2 * p3, idest2, iprop2_inv * p3, 0) ao1 = pdclip(oscili(iamp, kfq2) + oscili(iamp, kfq1 + iadd1), kclipenv1, -0.5) ao2 = pdclip(oscili(iamp, kfq2) + oscili(iamp, kfq2 + iadd2), kclipenv2, -0.5) aenv = cossegr:a(0, p3/2, 1, p3/2, 0.05, p3/4, 0) ao1 *= aenv * iamp ao2 *= aenv * iamp chnmix(ao1, "out1") chnmix(ao2, "out2") endin opcode smooth, 0, kkkk ktrig, kamp, knote, kdur xin ktrig = limit:k(ktrig, 0, 1) kamp = limit:k(kamp ,0, 1) knote = limit:k(knote, 0, 100) + 20 kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000)) if(check_trig(ktrig) == 1) then schedulek("vibish_impl", 0, kdur, knote, kamp) endif endop instr bounce_impl inote init p4 iamp init p5 ifq1 = mtof:i(inote) + random:i(-3, 2) ifq2 = mtof:i(inote) + random:i(-3, 2) ao1= vco2(iamp, ifq1) ao2= vco2(iamp, ifq2) ao1 *= ao2 ao2 *= ao1 kramp1 = expseg:k(random:i(0.1, 10), p3, random:i(0.1, 10)) kramp2 = expseg:k(random:i(0.1, 10), p3, random:i(0.1, 10)) kmod1 = pow(abs(lfo(0.3, kramp1, 5)), 5) kmod2 = pow(abs(lfo(0.3, kramp2, 5)), 5) ao1 *= 1 - kmod1 ao2 *= 1 - kmod2 aenv = cosseg:a(1, p3, 0) ao1 *= aenv ao2 *= aenv kphfq1 = rspline:k(100, 2000, .5, 3) kphfq2 = rspline:k(200, 1800, .6, 3.3) kphq = random:i(0.5, 0.9) kmode init 1 kord init 4 ksep init 2 kfb = 0.7 aph1 = phaser2(ao1, kphfq1, kphq, kord, kmode, ksep, kfb) * 0.4 aph2 = phaser2(ao1, kphfq2, kphq, kord, kmode, ksep, kfb) * 0.4 chnmix(aph1*iamp, "out1") chnmix(aph2*iamp, "out2") endin opcode bounce, 0, kkkk ktrig, kamp, knote, kdur xin ktrig = limit:k(ktrig, 0, 1) kamp = limit:k(kamp ,0, 1) knote = limit:k(knote, 0, 100) + 20 kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000)) if(check_trig(ktrig) == 1) then schedulek("bounce_impl", 0, kdur, knote, kamp) endif endop