This is just a super simple stereo dropout effect, but I hope it can be of help to someone to get an idea on how to do it. If you have any ideas to improve it let me know!
import("stdfaust.lib");
import("noises.lib");
process = signalL, signalR;
//======================================================= dropouts
clamp(nmin, nmax) = min(nmax) : max(nmin);
dropout_noiseL(rate) =
lfnoise(rate+0.6) + lfnoise(rate) : clamp(0, 1);
dropout_noiseR(rate) =
lfnoise(rate+0.5) + lfnoise(rate) : clamp(0, 1);
//dropout_curve, number between 1.2 and 10
dropout_nonlinear(rate, intensity, dropout_curve, phase) =
-tanh(
ba.if(phase < 1,
dropout_noiseL(rate),
dropout_noiseR(rate))
* dropout_curve - dropout_curve)
+ (1 - intensity);
dropout(phase, x) = x * (dropout_nonlinear(r, strength, curve, phase))
with{
r = hslider("rate", 1, 0.4, 10, 0.01);
strength = hslider("intensity", 0, 0, 1, 0.01);
curve = hslider("curve", 4, 1.4, 10, 0.01);
};
signalL = dropout(0);
signalR = dropout(2);