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("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));
// 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
Noise generator
import("stdfaust.lib");
random = +(12345)~*(1103515245);
noise = random/2147483647.0;
process = noise * vslider("Volume[style:knob][acc: 0 0 -10 0 10]", 0.5, 0, 1, 0.1);
Noise with LFO:
import("stdfaust.lib");
random = +(12345)~*(1103515245);
noise = random/2147483647.0;
lowfreq = vslider("LowFreq [style:knob]", 1000, 1, 20000, 1) : si.smoo;
lowq = vslider("LowQ [style:knob]", 1, 0.1, 5, 0.1) : si.smoo;
lfoFreq = vslider("LFO Freq[style:knob]", 10, 0, 10, 0.1) : si.smoo;
lfoAmp = vslider("Amplitude Freq[style:knob]", 100, 1, 1000, 0.1) : si.smoo;
lfo = os.osc(lfoFreq) * lfoAmp;
//process = noise * vslider("Volume[style:knob][acc: 0 0 -10 0 10]", 0.5, 0, 1, 0.1) <: filtering;
process = noise * vslider("Volume[style:knob][acc: 0 0 -10 0 10]", 0.5, 0, 1, 0.1) : fi.resonlp(lowfreq + lfo,lowq,1);
//process = lfo;
Dual oscilator
import("stdfaust.lib");
freq0 = hslider("[1] Freq0",100,10,10000,0.1) : si.smoo;
freq2 = hslider("[2] Freq2",200,10,10000,0.1) : si.smoo;
gain0 = hslider("[3] Gain0",1,0,1,0.01) : si.smoo;
gain2 = hslider("[4] Gain2",1,0,1,0.01) : si.smoo;
// freqs and gains definitions go here
process =
os.osc(freq0)*gain0,
os.osc(freq2)*gain2
:> _ // merging signals here
<: dm.zita_light; // and then splitting them for stereo in
FM Modulator
import("stdfaust.lib");
carrierFreq = hslider("[1] Carrier",100,10,2000,0.1) : si.smoo;
modulatorFreq = hslider("[2] Mod",20,0,100,0.1) : si.smoo;
index = hslider("[3] Index",10,0,100,0.01) : si.smoo;
process =
os.osc(carrierFreq+os.osc(modulatorFreq)*index)
<: dm.zita_light; // splitting signals for stereo in
Eye cat pedal
import("stdfaust.lib");
M = 1;
N = 5;
ftop = 10000;
fader(i) = vslider("Band%2i [unit:dB] [style:knob]", -10, -70, 10, 0.1) : si.smoo;
lowfreq = vslider("LowFreq [style:knob]", 10000, 1, 20000, 1) : si.smoo;
lowq = vslider("LowQ [style:knob]", 1, 0.1, 5, 0.1) : si.smoo;
highfreq = vslider("HighFreq [style:knob]", 10, 10, 5000, 1) : si.smoo;
highq = vslider("HighQ [style:knob]", 1, 0.1, 3, 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) : (fi.resonlp(lowfreq,lowq,1), fi.resonlp(lowfreq,lowq,1)) : (fi.resonhp(highfreq,highq,1), fi.resonhp(highfreq,highq,1)) : _,_;
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.