Re: [Faudiostream-users] How to use par() to Duplicate DSP AND Sliders

2020-10-23 Thread James Mckernon
On 10/23/20, Albert Graef  wrote:
> It's in the manual:
> https://faust.grame.fr/doc/manual/index.html#definitions-with-pattern-matching.
> These are expanded at compile time. Basically, Faust uses term rewriting as
> its macro engine. The macros are "hygienic", too (
> https://en.wikipedia.org/wiki/Hygienic_macro).
>
> Albert

I should have been clearer - it was the string interpolation in labels
I was surprised by. (Pattern matching *is* amazing, but I already knew
about that part.)


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


Re: [Faudiostream-users] How to use par() to Duplicate DSP AND Sliders

2020-10-23 Thread Albert Graef
It's in the manual:
https://faust.grame.fr/doc/manual/index.html#definitions-with-pattern-matching.
These are expanded at compile time. Basically, Faust uses term rewriting as
its macro engine. The macros are "hygienic", too (
https://en.wikipedia.org/wiki/Hygienic_macro).

Albert


On Fri, Oct 23, 2020 at 6:22 PM James Mckernon  wrote:

> On 10/23/20, Julius Smith  wrote:
> > feedback(i) = hslider("feedback %03i",0,0,0.9,0.01);
>
> Not the one who asked, but I had no idea this worked! Amazing.
>
>
> ___
> Faudiostream-users mailing list
> Faudiostream-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/faudiostream-users
>


-- 
Dr. Albert Gr"af
Computer Music Research Group, JGU Mainz, Germany
Email: aggr...@gmail.com, web: https://agraef.github.io/
___
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users


Re: [Faudiostream-users] How to use par() to Duplicate DSP AND Sliders

2020-10-23 Thread Julius Smith
That's how the sort comes out when there are no leading spaces in front of
the number creating a fixed field size.

In Faust, I think there is no difference between %03i and %3i.  As James
guessed, I was thinking of C's printf format string.

- Julius

On Fri, Oct 23, 2020 at 9:38 AM Brandon Hale 
wrote:

> Thanks James. That makes a lot more sense. I saw that in the manual, but
> it didn't register for me until you put it more simply. If you replace the
> "%03i" with just "%i", it goes from the sliders being laid out from 0-127,
> to being laid out like:
> Slider 0
> Slider 1
> Slider 10
> Slider 100
> Slider 101
> Slider 102
>
> Basically numbered left to right, almost like binary. Why is that?
> On 10/23/20 12:31 PM, James Mckernon wrote:
>
> On 10/23/20, Brandon Hale  
>  wrote:
>
> Thanks Julius! Using i like that makes a lot of sense. I had no idea you
> could substitute it like that.
>
> What does the %03i mean and how does that work?
>
> Brandon Hale
>
> Having just looked this up myself, I can perhaps answer for Julius.
> From https://faust.grame.fr/doc/manual/index.html#variable-parts-of-a-label
> :
>
>
> Labels can contain variable parts. These are indicated with the sign % 
> followed by the name of a variable. During compilation each label is 
> processed in order to replace the variable parts by the value of the 
> variable. For example:
> process = par(i,8,hslider("Voice %i", 0.9, 0, 1, 0.01));
> creates 8 sliders in parallel with different names while 
> par(i,8,hslider("Voice", 0.9, 0, 1, 0.01)) would have created only one slider 
> and duplicated its output 8 times.
> The variable part can have an optional format digit. For example "Voice %2i" 
> would indicate to use two digit when inserting the value of i in the string.'
>
> So %03i means insert the variable i's value into the string here,
> padding it (I guess with zeroes) to be three digits wide.
>
>

-- 
"Anybody who knows all about nothing knows everything" -- Leonard Susskind
___
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users


Re: [Faudiostream-users] How to use par() to Duplicate DSP AND Sliders

2020-10-23 Thread Brandon Hale
Thanks James. That makes a lot more sense. I saw that in the manual, but 
it didn't register for me until you put it more simply. If you replace 
the "%03i" with just "%i", it goes from the sliders being laid out from 
0-127, to being laid out like:


Slider 0
Slider 1
Slider 10
Slider 100
Slider 101
Slider 102

Basically numbered left to right, almost like binary. Why is that?

On 10/23/20 12:31 PM, James Mckernon wrote:

On 10/23/20, Brandon Hale  wrote:

Thanks Julius! Using i like that makes a lot of sense. I had no idea you
could substitute it like that.

What does the %03i mean and how does that work?

Brandon Hale

Having just looked this up myself, I can perhaps answer for Julius.
 From https://faust.grame.fr/doc/manual/index.html#variable-parts-of-a-label
:


Labels can contain variable parts. These are indicated with the sign % followed 
by the name of a variable. During compilation each label is processed in order 
to replace the variable parts by the value of the variable. For example:
process = par(i,8,hslider("Voice %i", 0.9, 0, 1, 0.01));
creates 8 sliders in parallel with different names while 
par(i,8,hslider("Voice", 0.9, 0, 1, 0.01)) would have created only one slider 
and duplicated its output 8 times.
The variable part can have an optional format digit. For example "Voice %2i" 
would indicate to use two digit when inserting the value of i in the string.'

So %03i means insert the variable i's value into the string here,
padding it (I guess with zeroes) to be three digits wide.
___
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users


Re: [Faudiostream-users] How to use par() to Duplicate DSP AND Sliders

2020-10-23 Thread James Mckernon
On 10/23/20, Brandon Hale  wrote:
> Thanks Julius! Using i like that makes a lot of sense. I had no idea you
> could substitute it like that.
>
> What does the %03i mean and how does that work?
>
> Brandon Hale

Having just looked this up myself, I can perhaps answer for Julius.
>From https://faust.grame.fr/doc/manual/index.html#variable-parts-of-a-label
:

> Labels can contain variable parts. These are indicated with the sign % 
> followed by the name of a variable. During compilation each label is 
> processed in order to replace the variable parts by the value of the 
> variable. For example:
> process = par(i,8,hslider("Voice %i", 0.9, 0, 1, 0.01));
> creates 8 sliders in parallel with different names while 
> par(i,8,hslider("Voice", 0.9, 0, 1, 0.01)) would have created only one slider 
> and duplicated its output 8 times.
> The variable part can have an optional format digit. For example "Voice %2i" 
> would indicate to use two digit when inserting the value of i in the string.'

So %03i means insert the variable i's value into the string here,
padding it (I guess with zeroes) to be three digits wide.


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


Re: [Faudiostream-users] How to use par() to Duplicate DSP AND Sliders

2020-10-23 Thread James Mckernon
On 10/23/20, Julius Smith  wrote:
> feedback(i) = hslider("feedback %03i",0,0,0.9,0.01);

Not the one who asked, but I had no idea this worked! Amazing.


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


Re: [Faudiostream-users] How to use par() to Duplicate DSP AND Sliders

2020-10-23 Thread Brandon Hale
Thanks Julius! Using i like that makes a lot of sense. I had no idea you 
could substitute it like that.


What does the %03i mean and how does that work?

Brandon Hale

On 10/23/20 12:00 PM, Julius Smith wrote:

Hi Brandon,

You want to use pattern-matching, something like

feedback(i) = hslider("feedback %03i",0,0,0.9,0.01);
echo(i) = +~(de.delay(262144,echoDuration*ma.SR)*feedback(i));
process = _,_ <: par(i,128,echo(i));

Cheers,
Julius

On Fri, Oct 23, 2020 at 8:42 AM Brandon Hale 
mailto:bthaleproducti...@gmail.com>> wrote:


Hello all,

I just joined the Faust User mailing list, and am excited to be
here! I have a question about programming with Faust.

First off, I am writing a multichannel delay by using the par()
function:

import("stdfaust.lib");
echoDuration = hslider("echoDuration",0,0,5,0.01);
feedback = hslider("feedback",0,0,0.9,0.01);
echo = +~(de.delay(262144,echoDuration*ma.SR)*feedback);
process = _,_ <: par(i,128,echo);

I have followed Romain's 2017 Faust Day videos to get to the point
where I am now and have got the processing that I want.
faust2firefox shows exactly what I need: 2in -> 128 separate delay
lines. Now, I want to have separate slider controls for each delay
line. How would I do that neatly, without making 128 new variables
for echoDuration and feedback?

I saw in the Faust manual that % exists as a way to increment
names, but I am not 100% sure how that works. Is that the secret
to crack this code?

Thank you so much for any help you can provide,

Brandon Hale

___
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/faudiostream-users



--
"Anybody who knows all about nothing knows everything" -- Leonard Susskind
___
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users


Re: [Faudiostream-users] How to use par() to Duplicate DSP AND Sliders

2020-10-23 Thread Julius Smith
Hi Brandon,

You want to use pattern-matching, something like

feedback(i) = hslider("feedback %03i",0,0,0.9,0.01);
echo(i) = +~(de.delay(262144,echoDuration*ma.SR)*feedback(i));
process = _,_ <: par(i,128,echo(i));

Cheers,
Julius

On Fri, Oct 23, 2020 at 8:42 AM Brandon Hale 
wrote:

> Hello all,
>
> I just joined the Faust User mailing list, and am excited to be here! I
> have a question about programming with Faust.
>
> First off, I am writing a multichannel delay by using the par() function:
>
> import("stdfaust.lib");
> echoDuration = hslider("echoDuration",0,0,5,0.01);
> feedback = hslider("feedback",0,0,0.9,0.01);
> echo = +~(de.delay(262144,echoDuration*ma.SR)*feedback);
> process = _,_ <: par(i,128,echo);
>
> I have followed Romain's 2017 Faust Day videos to get to the point where I
> am now and have got the processing that I want. faust2firefox shows exactly
> what I need: 2in -> 128 separate delay lines. Now, I want to have separate
> slider controls for each delay line. How would I do that neatly, without
> making 128 new variables for echoDuration and feedback?
>
> I saw in the Faust manual that % exists as a way to increment names, but I
> am not 100% sure how that works. Is that the secret to crack this code?
>
> Thank you so much for any help you can provide,
>
> Brandon Hale
> ___
> Faudiostream-users mailing list
> Faudiostream-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/faudiostream-users
>


-- 
"Anybody who knows all about nothing knows everything" -- Leonard Susskind
___
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users


[Faudiostream-users] How to use par() to Duplicate DSP AND Sliders

2020-10-23 Thread Brandon Hale

Hello all,

I just joined the Faust User mailing list, and am excited to be here! I 
have a question about programming with Faust.


First off, I am writing a multichannel delay by using the par() function:

import("stdfaust.lib");
echoDuration = hslider("echoDuration",0,0,5,0.01);
feedback = hslider("feedback",0,0,0.9,0.01);
echo = +~(de.delay(262144,echoDuration*ma.SR)*feedback);
process = _,_ <: par(i,128,echo);

I have followed Romain's 2017 Faust Day videos to get to the point where 
I am now and have got the processing that I want. faust2firefox shows 
exactly what I need: 2in -> 128 separate delay lines. Now, I want to 
have separate slider controls for each delay line. How would I do that 
neatly, without making 128 new variables for echoDuration and feedback?


I saw in the Faust manual that % exists as a way to increment names, but 
I am not 100% sure how that works. Is that the secret to crack this code?


Thank you so much for any help you can provide,

Brandon Hale

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