Equalizer
import("stdfaust.lib");
M = 1;
N = 4;
ftop = 10000;
fader(i) = vslider("Band%2i [unit:dB] [style:knob]", -10, -70, 10, 0.1) : si.smoo;
// Function to apply the filter bank and gains
eq_channel(input) = input : fi.mth_octave_filterbank_default(M, ftop, N)
: sum(i, N, (*(ba.db2linear(fader(N-i)))));
// Apply equalization to left and right channels separately
process = _,_ : (eq_channel, eq_channel);
Echo effect
import("stdfaust.lib");
maxDelay_s = 10;
feedbackGain = hslider("FeedbackGain", 0.5, 0, 1, 0.01);
delay_s = hslider("Delay_s", 0.5, 0.01, maxDelay_s, 0.1);
fline = vgroup("Feedback line", de.delay(ba.sec2samp(maxDelay_s), ba.sec2samp(delay_s)) * feedbackGain);
process = +~fline;
Reverb demo
declare name "zitaRev";
declare version "0.0";
declare author "JOS, Revised by RM";
declare description "Example GUI for `zita_rev1_stereo` (mostly following the Linux `zita-rev1` GUI).";
import("stdfaust.lib");
process = dm.zita_light;
declare name "zitaRev";
declare version "0.0";
declare author "JOS, Revised by RM";
declare description "Example GUI for `zita_rev1_stereo` (mostly following the Linux `zita-rev1` GUI).";
import("stdfaust.lib");
process = dm.zita_rev1;
import("stdfaust.lib");
fb1 = hslider("Freeverb/Feedback Comb (fb1)", 0.5, 0, 1, 0.01);
fb2 = hslider("Freeverb/Allpass Comb (fb2)", 0.5, 0, 1, 0.01);
damp = hslider("Freeverb/Damping", 0.5, 0, 1, 0.01);
spread = ba.sec2samp(hslider("Freeverb/Spread (s)", 0.1, 0, 2, 0.01));
// Processing
process = re.mono_freeverb(fb1, fb2, damp, spread);
import("stdfaust.lib");
fb1 = hslider("Freev+´`erb/Feedback Comb (fb1)", 0.5, 0, 1, 0.01);
fb2 = hslider("Freeverb/Allpass Comb (fb2)", 0.5, 0, 1, 0.01);
damp = hslider("Freeverb/Damping", 0.5, 0, 1, 0.01);
spread = ba.sec2samp(hslider("Freeverb/Spread (s)", 0.1, 0, 2, 0.01));
// Mix control: 0 = dry only, 1 = wet only
mix = hslider("Freeverb/Mix (Dry↔Wet)", 0.5, 0, 1, 0.01);
// Processing
wetSignal = re.mono_freeverb(fb1, fb2, damp, spread);
// Dry/Wet Mix Section
drywet = vslider("[1] Wet/Dry Mix [style:knob] [tooltip: Ratio of dry and wet signal. -1 = fully wet, +1 = fully dry]",
0, -1.0, 1.0, 0.01) : si.smoo;
wet = 0.5 * (drywet + 1.0);
dry = 1.0 - wet;
dry_wet(x) = *(wet) + dry * x;
process = _ <: (wetSignal), _ : dry_wet;
import("stdfaust.lib");
process = zita_light;
zita_light = hgroup("Zita Light", (_,_ <: re.zita_rev1_stereo(rdel,f1,f2,t60dc,t60m,fsmax),_,_ :
out_eq,_,_ : dry_wet : out_level))
with {
fsmax = 48000.0; // highest sampling rate that will be used
rdel = 60;
f1 = 200;
t60dc = 3;
t60m = 2;
f2 = 6000;
// Stereo parametric EQ applied to the output
out_eq = pareq_stereo(eq1f, eq1l, eq1q) : pareq_stereo(eq2f, eq2l, eq2q);
pareq_stereo(eqf, eql, Q) = fi.peak_eq_rm(eql, eqf, tpbt), fi.peak_eq_rm(eql, eqf, tpbt)
with {
tpbt = wcT / sqrt(max(0.0001, g)); // tan(PI*B/SR), B bandwidth in Hz (Q^2 ~ g/4)
wcT = 2 * ma.PI * eqf / ma.SR; // peak frequency in rad/sample
g = ba.db2linear(eql); // peak gain
};
// EQ bands
eq1f = 315;
eq1l = 0;
eq1q = 3;
eq2f = 1500;
eq2l = 0;
eq2q = 3;
// Dry/Wet mix control
dry_wet(x, y) = *(wet) + dry * x, *(wet) + dry * y
with {
wet = 0.5 * (drywet + 1.0);
dry = 1.0 - wet;
};
drywet = vslider("[1] DryWet [style:knob] [tooltip:Ratio of dry and wet signal. -1 = fully wet, +1 = fully dry]",
0, -1.0, 1.0, 0.01) : si.smoo;
// Output gain control
gain = vslider("[2] Level [unit:dB] [style:knob] [tooltip:Output scale factor]",
-6, -70, 40, 0.1) : ba.db2linear : si.smoo;
out_level = *(gain), *(gain);
};
The previous I got it to work, but I deleted. Tried to reproduce and didnt work >.< fml
Memory allocation
I should make mallocs for memory allocation. I was able to change dsp to mydsp on the header, and then I can inject some code. It is not working, but seems to be close.