Re: [Faudiostream-users] [Faudiostream-devel] "ZDF" SVF in C++, could this be converted to FAUST?

2018-07-23 Thread Kjetil Matheussen
I just tried to compile it now, and it seems like you need an older version
of faust,
plus that you need to dig up Qi, which was not very easy since it's been
replaced
by Shen now. I found Qi here though:
http://www.shenlanguage.org/lambdassociates/htdocs/download/QiII1.07.zip

And if you find a version of faust from around 2011 (only the source code,
you
don't have to compile it up), you should be able to compile up Point
Imperatif.
(Point Imperatif uses the lexer from Faust)

I'll see if I can clean this up. I don't have access to my normal computer
right
now, so it's a bit inconvenient to make a binary, but I'll try to create a
binary
package when I get home.



On Sun, Jul 22, 2018 at 3:42 PM, Oliver Larkin 
wrote:

> interesting…
>
> is a point imeratif binary available?
>
>
>
> > On 20 Jul 2018, at 12:39, Stéphane Letz  wrote:
> >
> > This even simpler code :
> >
> > foo(x) = 5;
> > process = (foo ~ _) ;
> >
> > Produces suboptimal code:
> >
> > virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT**
> outputs)
> > {
> >   FAUSTFLOAT* output0 = outputs[0];
> >   for (int i = 0; (i < count); i = (i + 1)) {
> >   int iRec0 = 5;
> >   output0[i] = FAUSTFLOAT(iRec0);
> >   }
> > }
> >
> > Stéphane
> >
> >> Le 20 juil. 2018 à 13:08, Kjetil Matheussen 
> a écrit :
> >>
> >>
> >> On Fri, Jul 20, 2018 at 11:35 AM, Kjetil Matheussen <
> k.s.matheus...@gmail.com> wrote:
> >>
> >> Actually, Faust should have been able to convert
> m_a1/m_a2/m_a3/m_m0/m_m1/m_m2 into
> >> slow variables so that we would have avoided all the conditional code
> in the inner loop.
> >> I'll see if I can come up with a smaller example.
> >>
> >>
> >> I simplified the problem down to this faust program:
> >>
> >> """
> >> modeSlider = hslider ( "Mode" , 0 , 0 , 1 , 1 ) ;
> >>
> >> returnfunc(a) = select2(a==0, 2, 3);
> >>
> >> process(x) = (function__1936 ~ (_)) : returnfunc  with{
> >>function__1936(a) = modeSlider;
> >> };
> >> """
> >>
> >> which compiles down to this C++ code:
> >>
> >> """
> >>virtual void compute (int count, FAUSTFLOAT** input,
> FAUSTFLOAT** output) {
> >>   FAUSTFLOAT* input0 = input[0];
> >>   FAUSTFLOAT* output0 = output[0];
> >>   for (int i=0; i >>   float   fRec0 = float(fslider0);
> >>   output0[i] = (FAUSTFLOAT)((int((fRec0 ==
> 0)))?3:2);
> >>   }
> >>   }
> >> }
> >> """
> >>
> >> which would have been faster if "fRec0" and "(FAUSTFLOAT)((int((fRec0
> == 0)))?3:2);"
> >> had been compiled down to slow variables.
> >>
> >>
> >> 
> --
> >> Check out the vibrant tech community on one of the world's most
> >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot__
> _
> >> Faudiostream-devel mailing list
> >> faudiostream-de...@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/faudiostream-devel
> >
> >
> > 
> --
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > ___
> > Faudiostream-users mailing list
> > Faudiostream-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/faudiostream-users
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users


Re: [Faudiostream-users] [Faudiostream-devel] "ZDF" SVF in C++, could this be converted to FAUST?

2018-07-22 Thread Oliver Larkin via Faudiostream-users
interesting…

is a point imeratif binary available?



> On 20 Jul 2018, at 12:39, Stéphane Letz  wrote:
> 
> This even simpler code :
> 
> foo(x) = 5;
> process = (foo ~ _) ;
> 
> Produces suboptimal code:
> 
> virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) 
> {
>   FAUSTFLOAT* output0 = outputs[0];
>   for (int i = 0; (i < count); i = (i + 1)) {
>   int iRec0 = 5;
>   output0[i] = FAUSTFLOAT(iRec0);
>   }
> }
> 
> Stéphane
> 
>> Le 20 juil. 2018 à 13:08, Kjetil Matheussen  a 
>> écrit :
>> 
>> 
>> On Fri, Jul 20, 2018 at 11:35 AM, Kjetil Matheussen 
>>  wrote:
>> 
>> Actually, Faust should have been able to convert 
>> m_a1/m_a2/m_a3/m_m0/m_m1/m_m2 into
>> slow variables so that we would have avoided all the conditional code in the 
>> inner loop.
>> I'll see if I can come up with a smaller example.
>> 
>> 
>> I simplified the problem down to this faust program:
>> 
>> """
>> modeSlider = hslider ( "Mode" , 0 , 0 , 1 , 1 ) ; 
>> 
>> returnfunc(a) = select2(a==0, 2, 3);
>> 
>> process(x) = (function__1936 ~ (_)) : returnfunc  with{
>>function__1936(a) = modeSlider;
>> };
>> """
>> 
>> which compiles down to this C++ code:
>> 
>> """
>>virtual void compute (int count, FAUSTFLOAT** input, FAUSTFLOAT** 
>> output) { 
>>   FAUSTFLOAT* input0 = input[0]; 
>>   FAUSTFLOAT* output0 = output[0]; 
>>   for (int i=0; i>   float   fRec0 = float(fslider0); 
>>   output0[i] = (FAUSTFLOAT)((int((fRec0 == 0)))?3:2); 
>>   } 
>>   } 
>> }
>> """
>> 
>> which would have been faster if "fRec0" and "(FAUSTFLOAT)((int((fRec0 == 
>> 0)))?3:2);"
>> had been compiled down to slow variables.
>> 
>> 
>> --
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! 
>> http://sdm.link/slashdot___
>> Faudiostream-devel mailing list
>> faudiostream-de...@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/faudiostream-devel
> 
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Faudiostream-users mailing list
> Faudiostream-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/faudiostream-users


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users


Re: [Faudiostream-users] [Faudiostream-devel] "ZDF" SVF in C++, could this be converted to FAUST?

2018-07-20 Thread Stéphane Letz
This even simpler code :

foo(x) = 5;
process = (foo ~ _) ;

Produces suboptimal code:

virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) 
{
FAUSTFLOAT* output0 = outputs[0];
for (int i = 0; (i < count); i = (i + 1)) {
int iRec0 = 5;
output0[i] = FAUSTFLOAT(iRec0);
}
}

Stéphane

> Le 20 juil. 2018 à 13:08, Kjetil Matheussen  a 
> écrit :
> 
> 
> On Fri, Jul 20, 2018 at 11:35 AM, Kjetil Matheussen 
>  wrote:
> 
> Actually, Faust should have been able to convert 
> m_a1/m_a2/m_a3/m_m0/m_m1/m_m2 into
> slow variables so that we would have avoided all the conditional code in the 
> inner loop.
> I'll see if I can come up with a smaller example.
> 
> 
> I simplified the problem down to this faust program:
> 
> """
> modeSlider = hslider ( "Mode" , 0 , 0 , 1 , 1 ) ; 
> 
> returnfunc(a) = select2(a==0, 2, 3);
> 
> process(x) = (function__1936 ~ (_)) : returnfunc  with{
> function__1936(a) = modeSlider;
> };
> """
> 
> which compiles down to this C++ code:
> 
> """
> virtual void compute (int count, FAUSTFLOAT** input, FAUSTFLOAT** 
> output) { 
>FAUSTFLOAT* input0 = input[0]; 
>FAUSTFLOAT* output0 = output[0]; 
>for (int i=0; ifloat   fRec0 = float(fslider0); 
>output0[i] = (FAUSTFLOAT)((int((fRec0 == 0)))?3:2); 
>} 
>} 
> }
> """
> 
> which would have been faster if "fRec0" and "(FAUSTFLOAT)((int((fRec0 == 
> 0)))?3:2);"
> had been compiled down to slow variables.
> 
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! 
> http://sdm.link/slashdot___
> Faudiostream-devel mailing list
> faudiostream-de...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/faudiostream-devel


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users


Re: [Faudiostream-users] [Faudiostream-devel] "ZDF" SVF in C++, could this be converted to FAUST?

2018-07-20 Thread Kjetil Matheussen
On Fri, Jul 20, 2018 at 11:35 AM, Kjetil Matheussen <
k.s.matheus...@gmail.com> wrote:

>
> Actually, Faust should have been able to convert
> m_a1/m_a2/m_a3/m_m0/m_m1/m_m2 into
> slow variables so that we would have avoided all the conditional code in
> the inner loop.
> I'll see if I can come up with a smaller example.
>
>
I simplified the problem down to this faust program:

"""
modeSlider = hslider ( "Mode" , 0 , 0 , 1 , 1 ) ;

returnfunc(a) = select2(a==0, 2, 3);

process(x) = (function__1936 ~ (_)) : returnfunc  with{
function__1936(a) = modeSlider;
};
"""

which compiles down to this C++ code:

"""
virtual void compute (int count, FAUSTFLOAT** input, FAUSTFLOAT**
output) {
   FAUSTFLOAT* input0 = input[0];
   FAUSTFLOAT* output0 = output[0];
   for (int i=0; i--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users


Re: [Faudiostream-users] [Faudiostream-devel] "ZDF" SVF in C++, could this be converted to FAUST?

2018-07-20 Thread Kjetil Matheussen
Poing Imperatif was made for making it easier to convert C++ and similar
languages into Faust.

I made this Poing Imperatif program from your C++ code:
https://pastebin.com/DuVWvu7w

Poing Imperatif created this Faust code: https://pastebin.com/fX0nkaGJ

And finally Faust created this C++ code:

virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) {
FAUSTFLOAT* input0 = inputs[0];
FAUSTFLOAT* output0 = outputs[0];
int iSlow0 = int(float(fHslider0));
int iSlow1 = (iSlow0 == 0);
int iSlow2 = (iSlow0 == 1);
int iSlow3 = (iSlow0 == 2);
int iSlow4 = (iSlow0 == 3);
int iSlow5 = (iSlow0 == 4);
int iSlow6 = (iSlow0 == 5);
int iSlow7 = (iSlow0 == 6);
int iSlow8 = (iSlow0 == 7);
float fSlow9 = float(fHslider1);
float fSlow10 = std::tan((6.54498435e-05f * fSlow9));
float fSlow11 = float(fHslider2);
float fSlow12 = std::pow(10.0f, (0.025004f * fSlow11));
float fSlow13 = std::sqrt(fSlow12);
float fSlow14 = (fSlow10 / fSlow13);
float fSlow15 = float(fHslider3);
float fSlow16 = (1.0f / fSlow15);
float fSlow17 = (((fSlow10 * (fSlow14 + fSlow16)) / fSlow13) + 1.0f);
float fSlow18 = (fSlow10 / (fSlow13 * fSlow17));
float fSlow19 = ((fSlow10 * (fSlow10 + fSlow16)) + 1.0f);
float fSlow20 = (fSlow10 / fSlow19);
float fSlow21 = (1.0f / fSlow17);
float fSlow22 = (1.0f / fSlow19);
float fSlow23 = mydsp_faustpower2_f(fSlow10);
float fSlow24 = (fSlow23 / (mydsp_faustpower2_f(fSlow13) * fSlow17));
float fSlow25 = (fSlow23 / fSlow19);
float fSlow26 = (2.0f * fSlow18);
float fSlow27 = (2.0f * fSlow20);
float fSlow28 = (2.0f / fSlow17);
float fSlow29 = (2.0f / fSlow19);
float fSlow30 = (2.0f * fSlow24);
float fSlow31 = (2.0f * fSlow25);
float fSlow32 = mydsp_faustpower2_f(fSlow12);
float fSlow33 =
(iSlow1?0.0f:(iSlow2?1.0f:(iSlow3?0.0f:(iSlow4?1.0f:(iSlow5?1.0f:(iSlow6?1.0f:(iSlow7?1.0f:(iSlow8?fSlow32:0.0f;
float fSlow34 = (fSlow32 + -1.0f);
float fSlow35 = (0.0f - fSlow16);
float fSlow36 =
(iSlow1?0.0f:(iSlow2?fSlow35:(iSlow3?1.0f:(iSlow4?fSlow35:(iSlow5?fSlow35:(iSlow6?(fSlow34
/ fSlow15):(iSlow7?((fSlow12 + -1.0f) / fSlow15):(iSlow8?((fSlow12 * (1.0f
- fSlow12)) / fSlow15):0.0f;
float fSlow37 =
(iSlow1?1.0f:(iSlow2?-1.0f:(iSlow3?0.0f:(iSlow4?0.0f:(iSlow5?-2.0f:(iSlow6?0.0f:(iSlow7?fSlow34:(iSlow8?(1.0f
- fSlow32):0.0f;
for (int i = 0; (i < count); i = (i + 1)) {
int iTemp0 = iRec8[1];
float fTemp1 = float(input0[i]);
float fTemp2 = (fSlow18 * fTemp1);
float fTemp3 = (fSlow20 * fTemp1);
float fTemp4 = (fTemp1 - fRec3[1]);
float fTemp5 = (fRec2[1] + (fSlow14 * fTemp4));
float fTemp6 = (fSlow21 * fTemp5);
float fTemp7 = (fRec2[1] + (fSlow10 * fTemp4));
float fTemp8 = (fSlow22 * fTemp7);
float fRec0 =
(iTemp0?(iSlow1?fTemp8:(iSlow2?fTemp8:(iSlow3?fTemp8:(iSlow4?fTemp8:(iSlow5?fTemp8:(iSlow6?fTemp8:(iSlow7?fTemp6:(iSlow8?fTemp6:0.0f:(iSlow1?fTemp3:(iSlow2?fTemp3:(iSlow3?fTemp3:(iSlow4?fTemp3:(iSlow5?fTemp3:(iSlow6?fTemp3:(iSlow7?fTemp2:(iSlow8?fTemp2:0.0f);
float fTemp9 = (fSlow24 * fTemp1);
float fTemp10 = (fSlow25 * fTemp1);
float fTemp11 = (fRec3[1] + (fSlow18 * fTemp5));
float fTemp12 = (fRec3[1] + (fSlow20 * fTemp7));
float fRec1 =
(iTemp0?(iSlow1?fTemp12:(iSlow2?fTemp12:(iSlow3?fTemp12:(iSlow4?fTemp12:(iSlow5?fTemp12:(iSlow6?fTemp12:(iSlow7?fTemp11:(iSlow8?fTemp11:fRec3[1]:(iSlow1?fTemp10:(iSlow2?fTemp10:(iSlow3?fTemp10:(iSlow4?fTemp10:(iSlow5?fTemp10:(iSlow6?fTemp10:(iSlow7?fTemp9:(iSlow8?fTemp9:0.0f);
float fTemp13 = (fSlow26 * fTemp1);
float fTemp14 = (fSlow27 * fTemp1);
float fTemp15 = ((fSlow28 * fTemp5) - fRec2[1]);
float fTemp16 = ((fSlow29 * fTemp7) - fRec2[1]);
fRec2[0] =
(iTemp0?(iSlow1?fTemp16:(iSlow2?fTemp16:(iSlow3?fTemp16:(iSlow4?fTemp16:(iSlow5?fTemp16:(iSlow6?fTemp16:(iSlow7?fTemp15:(iSlow8?fTemp15:(0.0f
-
fRec2[1]):(iSlow1?fTemp14:(iSlow2?fTemp14:(iSlow3?fTemp14:(iSlow4?fTemp14:(iSlow5?fTemp14:(iSlow6?fTemp14:(iSlow7?fTemp13:(iSlow8?fTemp13:0.0f);
float fTemp17 = (fSlow30 * fTemp1);
float fTemp18 = (fSlow31 * fTemp1);
float fTemp19 = ((2.0f * fTemp11) - fRec3[1]);
float fTemp20 = ((2.0f * fTemp12) - fRec3[1]);
fRec3[0] =
(iTemp0?(iSlow1?fTemp20:(iSlow2?fTemp20:(iSlow3?fTemp20:(iSlow4?fTemp20:(iSlow5?fTemp20:(iSlow6?fTemp20:(iSlow7?fTemp19:(iSlow8?fTemp19:fRec3[1]:(iSlow1?fTemp18:(iSlow2?fTemp18:(iSlow3?fTemp18:(iSlow4?fTemp18:(iSlow5?fTemp18:(iSlow6?fTemp18:(iSlow7?fTemp17:(iSlow8?fTemp17:0.0f);
float fRec4 = fSlow33;
float fRec5 = fSlow36;
float fRec6 = fSlow37;
float fRec7 = fTemp1;
iRec8[0] = 1;
output0[i] = FAUSTFLOATfRec4 * fRec7) + (fRec5 * fRec0)) + (fRec6 *
fRec1)));
fRec2[1] = fRec2[0];
fRec3[1] = fRec3[0];
iRec8[1] = iRec8[0];
}
}


If faust had known that "mode" doesn't change very often, it could probably
have optimized a bit here.
Or perhaps it would be more naturally to make one faust program for each
mode.




On Thu, Jul 19, 2018 at 12:55 PM, Oliver Larkin via Faudiostream-devel <
faudiostream-de...@lists.sourceforge.net> wrote:

> Well done to the IFC team for a great conference!