From 9fbf91db06a6d4f4b5cd8bb45389a731bb86bf22 Mon Sep 17 00:00:00 2001 From: Richard Date: Sun, 13 Apr 2025 18:48:02 +0100 Subject: initial --- site/udo/feedback.udo | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100755 site/udo/feedback.udo (limited to 'site/udo/feedback.udo') diff --git a/site/udo/feedback.udo b/site/udo/feedback.udo new file mode 100755 index 0000000..5f4b7d8 --- /dev/null +++ b/site/udo/feedback.udo @@ -0,0 +1,164 @@ +#ifndef UDO_FEEDBACK +#define UDO_FEEDBACK ## +/* + No-input mixer modelling + + This file is part of the SONICS UDO collection by Richard Knight 2021 + License: GPL-2.0-or-later + http://1bpm.net +*/ + + +opcode _arrayfilter, a, ai[]i[]o + ain, ifreq[], igain[], index xin + aout pareq ain, ifreq[index], igain[index], 0.775, 0 + if (index < lenarray(ifreq) - 1) then + aout _arrayfilter aout, ifreq, igain, index+1 + endif + xout aout +endop + + +opcode _fbk_componentmodel, a, a + a1 xin + ifreqs[] fillarray 30, 60, 100, 300, 600, 1200, 2400, 4800, 8000, 10000, 12000, 16000 + igains[] fillarray 0.4, 0.7, 1, 0.4, 0.6, 0.96, 0.4, 0.7, 0.32, 0.7, 0.8, 0.9 + a1 _arrayfilter a1, ifreqs, igains + xout a1 +endop + +opcode _fbk_componentmodel2, a, a + a1 xin + iminfreq = 20 + + adel delayr 1/iminfreq + acomb0 deltapi 1/1000 + + delayw a1 + + aout = a1 - acomb0 + xout aout +endop + +/* + Simulated mixer channel + aout fbk_channel ain, klowcut, keqlow, keqmid, keqhigh, kcompmodel + + aout channel output + + ain channel input + klowcut low cut toggle (1 is on) + keqlow eq low (0 to 1) + keqmid eq mid (0 to 1) + keqhigh eq high (0 to 1) + kcompmodel component model (0 is off, 1 is model components) + +*/ +opcode fbk_channel, a, akkkkk + a1, klowCut, keqlow, keqmid, keqhigh, kcompmodel xin + a1 += noise(0.01, 0) + ;a1 dcblock a1 + a1 butterhp a1, 0.1 + + if (klowCut == 1) then + a1 butterhp a1, 75 + endif + + + a1 pareq a1, 80, keqlow*5, 0.7, 1 + a1 pareq a1, 2500, keqmid*5, 0.7, 0 + a1 pareq a1, 12000, keqhigh*5, 0.7, 2 + ;a1 dam a1, 0.99, 0.9, 0.9, 0.01, 0.01 + ;a1 limit a1, -0.5, 0.5 + a1 tanh a1 + /*krms rms a1 + if (krms > 1) then + a1 = a1 * (1/krms) + endif +*/ + if (kcompmodel == 1) then + a1 _fbk_componentmodel a1 + endif + xout a1 +endop + + +/* + params + 0 low cut + 1 eq low + 2 eq mid + 3 eq high + 4 component model + 5 prefade aux on/off + 6 aux 1 send + 7 aux 2 send + 8 mix level +*/ +opcode fbk_mixer2, a, k[]k[] + kparam1[], kparam2[] xin + ain1 init 0 + ain2 init 0 + aout1 fbk_channel ain1, kparam1[0], kparam1[1], kparam1[2], kparam1[3], kparam1[4] + aout2 fbk_channel ain2, kparam2[0], kparam2[1], kparam2[2], kparam2[3], kparam2[4] + ain1 = 0 + ain2 = 0 + if (kparam1[5] == 1) then + ain1 += aout1*kparam1[6] + else + ain1 += aout1*kparam1[6]*kparam1[8] + endif + ain2 += aout1*kparam1[7]*kparam1[8] + + if (kparam2[5] == 1) then + ain2 += aout1*kparam2[7] + else + ain2 += aout1*kparam2[7]*kparam2[8] + endif + ain1 += aout2*kparam2[6]*kparam2[8] + + aout = (aout1*kparam1[8]) + (aout2*kparam2[8]) + aout pareq aout, 18000, 0.4, 0.7 + xout aout +endop + + + + + +opcode fbk_mixer4, a, k[]k[]k[]k[] + kparam1[], kparam2[], kparam3[], kparam4[] xin + ain1 init 0 + ain2 init 0 + ain3 init 0 + ain4 init 0 + aout1 fbk_channel ain1, kparam1[0], kparam1[1], kparam1[2], kparam1[3], kparam1[4] + aout2 fbk_channel ain2, kparam2[0], kparam2[1], kparam2[2], kparam2[3], kparam2[4] + aout3 fbk_channel ain3, kparam3[0], kparam3[1], kparam3[2], kparam3[3], kparam3[4] + aout4 fbk_channel ain4, kparam4[0], kparam4[1], kparam4[2], kparam4[3], kparam4[4] + ain1 = 0 + ain2 = 0 + ain3 = 0 + ain4 = 0 + if (kparam1[5] == 1) then + ain1 += aout1*kparam1[6] + else + ain1 += aout1*kparam1[6]*kparam1[8] + endif + ain2 += aout1*kparam1[7]*kparam1[8] + + if (kparam2[5] == 1) then + ain2 += aout1*kparam2[7] + else + ain2 += aout1*kparam2[7]*kparam2[8] + endif + ain1 += aout2*kparam2[6]*kparam2[8] + + aout = (aout1*kparam1[8]) + (aout2*kparam2[8]) + aout pareq aout, 18000, 0.4, 2, 0.7 + xout aout +endop + + +#end + -- cgit v1.2.3