DIY Stompboxes > Digital & DSP

Emulating a Rotary Effect in Faust (and Teensy)

(1/6) > >>

I've been inspired by Potul to try and create a Guitar Pedal Implementation, just for fun. I've been diving a lot into the world of DSP lately but didn't have a proper target to pursue until now!

--- Quote from: potul on September 02, 2021, 05:32:37 AM ---I went through this journey some time ago (not with SpinCAD), and I found a couple of documents useful to understand the rotary speaker and how to simulate:

Enjoy the reading.

--- End quote ---

First the code I have so far:

--- Code: ---import("stdfaust.lib");
ms_sample = ba.sec2samp(1) / 1000;
max_delay_ms = 30;

//UI Elements
bpc = checkbox("Bypass");
high_lfo_freq = hslider("Rate",5,0.1,10,0.1);
gain = hslider("Gain", 1.5, 0.1, 10, 0.1);
volume_slider = hslider("Volume", 1.5, 0.001, 2, 0.01);
dw = hslider("Mix", 0.5, 0.0, 1, 0.01);

// LFOs
high_lfo = os.lf_trianglepos(high_lfo_freq);
low_lfo = os.lf_trianglepos(high_lfo_freq/3);

// Dynamics Parameters
k = 2;
waveshaper(X, Y, gain) = (1/atan(k))*atan(k*X*gain), (1/atan(k))*atan(k*Y*gain);

// DSP Functions
rotary(_,_) = de.fdelay(max_delay_ms * ms_sample, high_lfo * max_delay_ms)*high_lfo, de.fdelay(max_delay_ms * ms_sample, max_delay_ms - (high_lfo * max_delay_ms))*(1-high_lfo);
vol(_,_,v) = _*v, _*v;
mixer(a,b,c) = a+c,b+c;
dry_wetST(dw,x1,x2,y1,y2) = (wet*y1 + dry*x1),(wet*y2 + dry*x2)
with {
    wet = dw;
    dry = 1.0-wet;

process = ba.bypass2(bpc, (_,_ <:
        _,_,(waveshaper(_,_,gain) :
        low, hi :
        mixer(_,_)) :
        dry_wetST(dw) :
        vol(_,_, volume_slider)
with {
    low = fi.lowpass(1, 800) <: fi.lowpass(1,200), fi.highpass(1,200) : _+_*-low_lfo : _*0.4;
    hi = fi.highpass(1, 800) <: rotary(_,_) : fi.resonbp(2000,0.7,1), fi.resonbp(2000,0.7,1);

--- End code ---

You can copy-paste it to the following link, where you can adjust some parameters, upload your own guitar tracks etc. Very fun!

Now the following. First of all, I would love to hear your feedback! How does it sound? What should I improve?
I've been struggling with the maximum delay length and vibrato depth so insights there would be totally useful.

I plan to create a guitar pedal based on the Teensy (to which you can port Faust programs to). But that's something for the future... But of course I'll keep you posted! But first the DSP stuff  ;D

A few block diagrams probably make it a bit more insightfull for the quick glance :)

Digital Larry:
So, is there any delay modulation yet?  I just see filtering and volume modulation.


--- Quote from: Digital Larry on September 09, 2021, 05:25:34 PM ---So, is there any delay modulation yet?  I just see filtering and volume modulation.

--- End quote ---

Everything in the low section is AM only (as per the paper that potul linked to). But the high section delay is definitely there. It's this statement (actually there are 2 of them, left and right):

--- Code: ---de.fdelay(max_delay_ms * ms_sample, high_lfo * max_delay_ms)*high_lfo
--- End code ---
de.fdelay is called as fdelay(n,d) where:

--- Quote ---n: the max delay length in samples
d: the delay length as a number of samples (float)
--- End quote ---
It's a fractional delay that interpolates nicely as the rate changes :) I have currently set max_delay_ms at 30/ The high_lfo is a triangle (yes I cheated :icon_mrgreen:) wave between 0 and 1 that I multiply against the max_delay_ms to get the current delay. :) and then the whole section is agáin multiplied in amplitude with the LFO to get AM :)

But it might very well be that the tremolo effect is too pronounced :)

Sounds nice to me! A very good starting point. I can't really tell if it sound like a real leslie, as I have never tried one, but it's in the ballpark of what I expect.

Fuast online IDE is improving a lot, last time I tried it was not that nice.


[0] Message Index

[#] Next page

Go to full version