From 9fbf91db06a6d4f4b5cd8bb45389a731bb86bf22 Mon Sep 17 00:00:00 2001 From: Richard Date: Sun, 13 Apr 2025 18:48:02 +0100 Subject: initial --- site/udo/scss/mixer/_effects.udo | 247 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 247 insertions(+) create mode 100755 site/udo/scss/mixer/_effects.udo (limited to 'site/udo/scss/mixer/_effects.udo') diff --git a/site/udo/scss/mixer/_effects.udo b/site/udo/scss/mixer/_effects.udo new file mode 100755 index 0000000..bc29661 --- /dev/null +++ b/site/udo/scss/mixer/_effects.udo @@ -0,0 +1,247 @@ +#ifndef UDO_SCSS_MIXER_EFFECTS +#define UDO_SCSS_MIXER_EFFECTS ## + +#include "/frequency_tools.udo" +#include "/wavetables.udo" + +opcode _fxi_control, Sk, ii + ichannelindex, ieffectindex xin + SchanAppend = sprintf("_%d_%d", ichannelindex, ieffectindex) + kon = chnget:k(strcat("fxi_on", SchanAppend)) + xout SchanAppend, kon +endop + +opcode fxi_param, k, SS + SchanAppend, Sname xin + xout chnget:k(strcat(strcat("fxi_", Sname), SchanAppend)) +endop + +opcode fxi_param, i, SS + SchanAppend, Sname xin + xout chnget:i(strcat(strcat("fxi_", Sname), SchanAppend)) +endop + +gSeffectDefs = {{ + { + "effects": [ + { + "name": "Reverb", + "opcode": "fxi_reverb", + "parameters": [ + {"name": "roomsize", "description": "Room size", "default": 0.3, "max": 1, "min": 0}, + {"name": "hfdamp", "description": "High frequency damping", "default": 0.5, "max": 1, "min": 0} + ] + }, + { + "name": "Frequency shifter 1", + "opcode": "fxi_freqshift1", + "parameters": [ + {"name": "shift", "description": "Shift frequency", "default": 0, "max": 2000, "min": -2000} + ] + }, + { + "name": "Frequency shifter 2", + "opcode": "fxi_freqshift2", + "parameters": [ + {"name": "shift", "description": "Shift frequency", "default": 0, "max": 2000, "min": -2000} + ] + }, + { + "name": "Ring modulator", + "opcode": "fxi_ringmod", + "parameters": [ + {"name": "freq", "description": "Frequency", "default": 440, "max": 10000, "min": 20} + ] + + }, + { + "name": "Bit crusher", + "opcode": "fxi_bitcrush", + "parameters": [ + {"name": "crush", "description": "Bits", "default": 8, "max": 64, "min": 2, "type": "int"} + ] + }, + { + "name": "Delay tuner", + "opcode": "fxi_delaytuner", + "parameters": [ + {"name": "freq", "description": "Frequency", "default": 110, "max": 4000, "min": 50}, + {"name": "feedback", "description": "Feedback", "default": 0.4, "max": 0.9, "min": 0} + ] + }, + { + "name": "Low pass filter", + "opcode": "fxi_lowpass", + "parameters": [ + {"name": "freq", "description": "Frequency", "default": 10000, "max": 20000, "min": 20} + ] + }, + { + "name": "Highpass filter", + "opcode": "fxi_highpass", + "parameters": [ + {"name": "freq", "description": "Frequency", "default": 1000, "max": 20000, "min": 20} + ] + }, + { + "name": "Simple chorus", + "opcode": "fxi_simplechorus", + "parameters": [ + {"name": "rateL", "description": "Rate (Left)", "default": 0.01, "max": 0.1, "min": 0.001}, + {"name": "rateR", "description": "Rate (Right)", "default": 0.01, "max": 0.1, "min": 0.001} + ] + }, + { + "name": "Simple delay", + "opcode": "fxi_simpledelay", + "parameters": [ + {"name": "time", "description": "Delay time", "default": 1000, "max": 4000, "min": 1} + ] + }, + { + "name": "Waveshaping distortion", + "opcode": "fxi_distort", + "parameters": [ + {"name": "distortion", "description": "Amount", "default": 0.1, "max": 2, "min": 0.001}, + {"name": "wave", "description": "Wave shape", "options": [ + {"name": "Sine", "value": 0}, + {"name": "Square", "value": 1}, + {"name": "Saw", "value": 2} + ]} + ] + } + ] + } +}} +giJinsertDefs = jsonloads(gSeffectDefs) + + + +opcode fxi_reverb, aa, aaii + aL, aR, ichannelindex, ieffectindex xin + SchanAppend, kon _fxi_control ichannelindex, ieffectindex + if (kon == 1) then + kroomsize = fxi_param:k(SchanAppend, "roomsize") + khfdamp = fxi_param:k(SchanAppend, "hfdamp") + aL, aR freeverb aL, aR, kroomsize, khfdamp + endif + xout aL, aR +endop + + +opcode fxi_simpledelay, aa, aaii ; TODO have beats delay option + aL, aR, ichannelindex, ieffectindex xin + SchanAppend, kon _fxi_control ichannelindex, ieffectindex + if (kon == 1) then + ktime = fxi_param:k(SchanAppend, "time") + aL vdelay aL, ktime, 4000 + aR vdelay aR, ktime, 4000 + endif + xout aL, aR +endop + +opcode fxi_distort, aa, aaii + aL, aR, ichannelindex, ieffectindex xin + SchanAppend, kon _fxi_control ichannelindex, ieffectindex + if (kon == 1) then + kdist = fxi_param:k(SchanAppend, "distortion") + kwave = fxi_param:k(SchanAppend, "wave") ; TODO k to i... reinit?? + aL distort aL, kdist, gifnSine ;ifn + aR distort aR, kdist, gifnSine ;ifn + endif + xout aL, aR +endop + + +opcode fxi_freqshift1, aa, aaii + aL, aR, ichannelindex, ieffectindex xin + SchanAppend, kon _fxi_control ichannelindex, ieffectindex + if (kon == 1) then + kshift = fxi_param:k(SchanAppend, "shift") + aL, aR freqshift1 aL, aR, kshift + endif + xout aL, aR +endop + + +opcode fxi_freqshift2, aa, aaii + aL, aR, ichannelindex, ieffectindex xin + SchanAppend, kon _fxi_control ichannelindex, ieffectindex + if (kon == 1) then + kshift = fxi_param:k(SchanAppend, "shift") + aL, aR freqshift2 aL, aR, kshift + endif + xout aL, aR +endop + + +opcode fxi_ringmod, aa, aaii + aL, aR, ichannelindex, ieffectindex xin + SchanAppend, kon _fxi_control ichannelindex, ieffectindex + if (kon == 1) then + kfreq = fxi_param:k(SchanAppend, "freq") + aL, aR ringmod1 aL, aR, kfreq + endif + xout aL, aR +endop + + +opcode fxi_bitcrush, aa, aaii + aL, aR, ichannelindex, ieffectindex xin + SchanAppend, kon _fxi_control ichannelindex, ieffectindex + if (kon == 1) then + kcrush = fxi_param:k(SchanAppend, "crush") + aL, aR bitcrush aL, aR, kcrush + endif + xout aL, aR +endop + + +opcode fxi_delaytuner, aa, aaii + aL, aR, ichannelindex, ieffectindex xin + SchanAppend, kon _fxi_control ichannelindex, ieffectindex + if (kon == 1) then + kfreq = fxi_param:k(SchanAppend, "freq") + kfeedback = fxi_param:k(SchanAppend, "feedback") + aL, aR delaytuner aL, aR, kfreq, kfeedback + + endif + xout aL, aR +endop + + +opcode fxi_lowpass, aa, aaii + aL, aR, ichannelindex, ieffectindex xin + SchanAppend, kon _fxi_control ichannelindex, ieffectindex + if (kon == 1) then + kfreq = fxi_param:k(SchanAppend, "freq") + aL butterlp aL, kfreq + aR butterlp aR, kfreq + endif + xout aL, aR +endop + + +opcode fxi_highpass, aa, aaii + aL, aR, ichannelindex, ieffectindex xin + SchanAppend, kon _fxi_control ichannelindex, ieffectindex + if (kon == 1) then + kfreq = fxi_param:k(SchanAppend, "freq") + aL butterhp aL, kfreq + aR butterhp aR, kfreq + endif + xout aL, aR +endop + +opcode fxi_simplechorus, aa, aaii + aL, aR, ichannelindex, ieffectindex xin + SchanAppend, kon _fxi_control ichannelindex, ieffectindex + if (kon == 1) then + krateL = fxi_param:k(SchanAppend, "rateL") + krateR = fxi_param:k(SchanAppend, "rateR") + aL, aR simplechorus aL, aR, krateL, krateR + endif + xout aL, aR +endop + +#end -- cgit v1.2.3