Hi Autumn,

Yes, resonbp is very simple and not protected against Q changes that can
blow up its dynamic range.  To guard against this you can apply smoothing
(si.smooth()) to the Q and frequency parameters, and keep them within
reasonable limits.

The next level up would be to replace tf2 in its implementation with
something like tf2snp which is formulated to have much less variation in
dynamic range when the parameters change quickly.

Cheers,
Julius

On Thu, Dec 28, 2023 at 8:00 AM Autumn Cheney via Faudiostream-users <
faudiostream-users@lists.sourceforge.net> wrote:

> as before, i'm working on a vocoder. i added some features since my last
> thread, and they're what this is about
>
> here's my program so far:
>
> import("stdfaust.lib");
>
> select4(s) = *(s==0),*(s==1),*(s==2),*(s==3):>_;
> clip(x,a,b) = min(max(x,a),b);
>
> n = 16;
>
> time(x) = hgroup("[0]time controls",x);
>
> attack = time(vslider("[0]attack[style:knob][unit:ms]",50,0,2000,0.1));
> release = time(vslider("[1]release[style:knob][unit:ms]",50,0,2000,0.1));
>
> op(x) = hgroup("[1]operator controls",x);
>
> car(x) = op(hgroup("[0]carrier controls",x));
> mod(x) = op(hgroup("[0]modulator controls",x));
>
>
> mod_order = mod(nentry("[0]modulator
> order[style:menu{'-12db':0;'-24db':1;'-36db':2;'-48db':3}}]",0,0,3,1));
> mod_bw = mod(vslider("[1]modulator bw[style:knob]",0.5,0.1,2,0.001));
>
> car_order = car(nentry("[0]carrier
> order[style:menu{'-12db':0;'-24db':1;'-36db':2;'-48db':3}}]",0,0,3,1));
> car_bw = car(vslider("[1]carrier bw[style:knob]",0.5,0.1,2,0.001));
>
> fx(x) = vgroup("[2]effects",x);
> self_mod = fx(checkbox("[0]self-modulate"));
> form_shift = fx(hslider("[1]formant shift[unit:%]",1,0.5,3,0.01));
> range = fx(hslider("[1]range",1,0.01,1,0.01));
>
>
> misc(x) = hgroup("[3]misc controls",x);
> out_gain = misc(hslider("output gain[unit:db]",0,-48,48,0.01));
>
>
> bp(freq,q,gain) = fi.resonbp(freq,q,gain/q);
> multi_bp(freq,q,gain,order) =
> _<:bp(freq,q,gain),(bp(freq,q,gain):bp(freq,q,gain)),(bp(freq,q,gain):bp(freq,q,gain):bp(freq,q,gain)),(bp(freq,q,gain):bp(freq,q,gain):bp(freq,q,gain):bp(freq,q,gain)):>select4(order):_*((order)+1);
>
> voc_band(band_num,bands_num,shift,bw_ratio,order,bg,x) = x :
> multi_bp(band_freq, band_q, bg, order) : _ with {
>         band_freq = (25*pow(2,(band_num+1)*(9/bands_num)))*shift;
>         bw = (band_freq - 25*pow(2,(band_num)*(9/bands_num)))*bw_ratio;
>         band_q = band_freq/bw;
> };
>
> voc(bands_num,att,rel,form_shift,range,mod_bw,mod_order,car_bw,car_order,carrier,modulator)
> = carrier <: par(i,bands_num,voc_band(i,bands_num,range,mod_bw,mod_order,1)
> : an.amp_follower_ar(att,rel) : _,modulator :
> voc_band(i,bands_num,form_shift*range,car_bw,car_order)) :> _;
>
> x = _,_ <: !,_,_,!;
>
> process =
> _,_,_,_<:(_,x,_),((_<:_,_),(_<:_,_),!,!):(par(i,4,_*(1-self_mod)),par(i,
> 4,_*(self_mod))):>par(i,2,voc(n,attack/1000,release/1000,form_shift,range,mod_bw,mod_order,car_bw,car_order)):par(i,2,_*ba.db2linear(out_gain));
>
> when i run the program and adjust the "formant shift" and "range" sliders
> with audio input and the "self-modulate" checkbox enabled, at certain
> values a very loud signal is produced. it seems to depend on the value of
> either of the bandwidth parameters
>
> i think it might have to do with the resonbp q taking some value it
> shouldn't, but i don't know how to fix it
>
> incidentally, the "range" slider is meant to scale down the frequencies of
> both the modulator and carrier bands. and the "formant shift" scales up or
> down the frequencies of the carrier band only
>
> thanks for any help in advance
>
> a
> _______________________________________________
> Faudiostream-users mailing list
> Faudiostream-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/faudiostream-users
>


-- 
"Anything that can be automated should optionally be"
_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to