Re: [Faudiostream-users] debug help needed

2023-12-28 Thread Julius Smith
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


[Faudiostream-users] debug help needed

2023-12-28 Thread Autumn Cheney via Faudiostream-users
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


Re: [Faudiostream-users] input signal cross-routing?

2023-12-28 Thread yann orlarey
Hi Autumn,

Here is how to cross inputs 2 and 3.
Cheers

Yann

X = _,_ <: !,_,_,!;
process = _,X,_:par(i,2,(voc(n,0.01,1,mod_bw,mod_order,car_bw,car_order))):>
_,_;

Le jeu. 28 déc. 2023 à 14:06, Autumn Cheney via Faudiostream-users <
faudiostream-users@lists.sourceforge.net> a écrit :

> hi!
>
> i'm currently building a stereo vocoder in radium's faust development
> environment, and i've run into a minor problem
>
> i have the core vocoder running, but i can't figure out how to route the
> effect input the way i want to. i'd like to have input 1 going into the
> left channel modulator input, input 2 going into the right channel carrier
> input, and inputs 3 and 4 going into their respective modulator inputs. but
> as of now inputs 1 and 2 are routed to the left channel unit and inputs 3
> and 4 are routed to the right channel input
>
> hopefully this makes sense. here's my faust code (don't mind the fact that
> some code is ripped from the libraries):
>
> import("stdfaust.lib");
>
> select4(s) = *(s==0),*(s==1),*(s==2),*(s==3):>_;
>
> n = 8;
>
> mod_order = nentry("modulator
> order[style:menu{'-12db':0;'-24db':1;'-36db':2;'-48db':3}}]",0,0,3,1);
> mod_bw = vslider("modulator bw",0.5,0.1,2,0.001);
>
> car_order = nentry("carrier
> order[style:menu{'-12db':0;'-24db':1;'-36db':2;'-48db':3}}]",0,0,3,1);
> car_bw = vslider("carrier bw",0.5,0.1,2,0.001);
>
> bp(freq,q) = fi.svf.bp(freq,q);
> multi_bp(freq,q,order) =
> _<:bp(freq,q),(bp(freq,q):bp(freq,q)),(bp(freq,q):bp(freq,q):bp(freq,q)),(bp(freq,q):bp(freq,q):bp(freq,q):bp(freq,q)):>select4(order);
>
> voc_band(band_num,bands_num,bw_ratio,order,bg,x) = x : multi_bp(band_freq,
> band_q, order) : _*bg with {
> band_freq = 25*pow(2,(band_num+1)*(9/bands_num));
> bw = (band_freq - 25*pow(2,(band_num)*(9/bands_num)))*bw_ratio;
> band_q = band_freq/bw;
> };
>
> voc(bands_num,att,rel,mod_bw,mod_order,car_bw,car_order,carrier,modulator)
> = carrier <: par(i,bands_num,voc_band(i,bands_num,mod_bw,mod_order,1) :
> an.amp_follower_ar(att,rel) : _,modulator :
> voc_band(i,bands_num,car_bw,car_order)) :>
> _*(1/(bands_num*(mod_order+1)*(car_order+1)));
>
> process =
> _,_,_,_:par(i,2,(voc(n,0.01,1,mod_bw,mod_order,car_bw,car_order))):>_,_;
>
> as you'll see from the block diagram the input  2 and 3 cables don't cross
> over. but i want them to cross over
>
> is this possible? thank you,
>
> a cheney
> ___
> Faudiostream-users mailing list
> Faudiostream-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/faudiostream-users
>
___
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users


[Faudiostream-users] input signal cross-routing?

2023-12-28 Thread Autumn Cheney via Faudiostream-users
hi!

i'm currently building a stereo vocoder in radium's faust development 
environment, and i've run into a minor problem

i have the core vocoder running, but i can't figure out how to route the effect 
input the way i want to. i'd like to have input 1 going into the left channel 
modulator input, input 2 going into the right channel carrier input, and inputs 
3 and 4 going into their respective modulator inputs. but as of now inputs 1 
and 2 are routed to the left channel unit and inputs 3 and 4 are routed to the 
right channel input

hopefully this makes sense. here's my faust code (don't mind the fact that some 
code is ripped from the libraries):

import("stdfaust.lib");

select4(s) = *(s==0),*(s==1),*(s==2),*(s==3):>_;

n = 8;

mod_order = nentry("modulator 
order[style:menu{'-12db':0;'-24db':1;'-36db':2;'-48db':3}}]",0,0,3,1);
mod_bw = vslider("modulator bw",0.5,0.1,2,0.001);

car_order = nentry("carrier 
order[style:menu{'-12db':0;'-24db':1;'-36db':2;'-48db':3}}]",0,0,3,1);
car_bw = vslider("carrier bw",0.5,0.1,2,0.001);

bp(freq,q) = fi.svf.bp(freq,q);
multi_bp(freq,q,order) = 
_<:bp(freq,q),(bp(freq,q):bp(freq,q)),(bp(freq,q):bp(freq,q):bp(freq,q)),(bp(freq,q):bp(freq,q):bp(freq,q):bp(freq,q)):>select4(order);

voc_band(band_num,bands_num,bw_ratio,order,bg,x) = x : multi_bp(band_freq, 
band_q, order) : _*bg with {
band_freq = 25*pow(2,(band_num+1)*(9/bands_num));
bw = (band_freq - 25*pow(2,(band_num)*(9/bands_num)))*bw_ratio;
band_q = band_freq/bw;
};

voc(bands_num,att,rel,mod_bw,mod_order,car_bw,car_order,carrier,modulator) = 
carrier <: par(i,bands_num,voc_band(i,bands_num,mod_bw,mod_order,1) :
an.amp_follower_ar(att,rel) : _,modulator : 
voc_band(i,bands_num,car_bw,car_order)) :> 
_*(1/(bands_num*(mod_order+1)*(car_order+1)));
process = 
_,_,_,_:par(i,2,(voc(n,0.01,1,mod_bw,mod_order,car_bw,car_order))):>_,_;

as you'll see from the block diagram the input 2 and 3 cables don't cross over. 
but i want them to cross over

is this possible? thank you,

a cheney___
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users