Hi,
Maybe there are multiple ways to answer your question; I think this approach
requires a few simple manipulations of your code.
the first step concern the "%" *print* function to pass a values to the GUI
through a variable
slider(n) = hslider("Slider %n",0,0,1,0.1);
process = slider(42);
will create only a slider, the 42nd (in a figurative way);
with *par* you can parallelise functions N times
process = par(i,23,slider(i));
Twenty-three parallel functions labelled from 0 to 22 in a logic but
inconvenient way. You can tricky fix the labelling order with "%2” (the number
of characters used for labelling) and a new function that add 1 to the index.
slider(n) = hslider("Slider %2nn",0,0,1,0.1)
with{
nn = n+1;
};
process = par(i,23,slider(i));
so, You can produce something not so distant from your starting point:
import("stdfaust.lib");
// vertical voice group
osc_g(i,x) = vgroup("OSC %2nn", x)
with{
nn = i+1;
};
// Oscillator
f = hslider("[05]Freq",440,1,20000,0.1);
s = nentry("[06]Waveform Select",0,0,2,1);
oscillator = os.polyblep_saw(f),
os.polyblep_square(f),
os.polyblep_triangle(f) :
select3(s);
//Amp
attack = hslider("[01]Attack",0,0,400,0.1);
decay = hslider("[02]Decay",0,0,400,0.1);
sustain = hslider("[03]Sustain",0,0,1,0.1);
release = hslider("[04]Release",0,0,400,0.1);
gate = button("[07]Gate");
envelope = en.adsr(attack,decay,sustain,release,gate);
amp = gate*envelope;
process = hgroup("MYSYNTH", par(i,2,osc_g(i,oscillator*amp))) :>_;
The square brackets inside labels are for metadata; the number identifies the
position order.
I hope this will help you.
Giuseppe
> On 5 Feb 2021, at 13:05, Magnus <[email protected]> wrote:
>
> Hello,
> I'm new to fuast and programming in general so I have quite a simple
> question, I made a simple synth voice :
>
> import("stdfaust.lib");
> // Oscillator
> f = hslider("Freq",440,1,20000,0.1);
> s = nentry("Waveform Select",0,0,2,1);
> oscillator =
> os.polyblep_saw(f),os.polyblep_square(f),os.polyblep_triangle(f):
> select3(s);
>
> //Amp
> attack = hslider("Attack",0,0,400,0.1);
> decay = hslider("Decay",0,0,400,0.1);
> sustain = hslider("Sustain",0,0,1,0.1);
> release = hslider("Release",0,0,400,0.1);
>
> gate = button("Gate");
> envelope = en.adsr(attack,decay,sustain,release,gate);
> amp = gate*envelope;
>
>
> process = oscillator*amp;
>
>
> Now my question was is there a way to duplicate the voice so that it
> makes another set of sliders for the secound voice. I hope this
> question makes sense
>
> Thanks
> Magnus
>
>
>
> _______________________________________________
> Faudiostream-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/faudiostream-users
_______________________________________________
Faudiostream-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users