Re: [LAD] Prototyping algorithms and ideas

From: Albert Graef <Dr.Graef@email-addr-hidden-online.de>
Date: Fri Feb 01 2008 - 07:44:48 EET

Kjetil S. Matheussen wrote:
> The second problem (besides its lack of interactivity) I have about faust
> is that is purely functional. I have programmed lots of code in purely
> functional style, and I like it very much, so thats not the issue. But, I
> feel that being forced to work in one paradigm gives me less
> possibilities.

Yep, it takes some discipline, but you also get to reap the benefits
(clear semantics, better output code).

> It would be interesting to see how the routine would
> look like in faust, if you have the time. :-)

I don't have the time to really work out all the details of your example
right now, but looking at http://www.notam02.no/~kjetism/sandysth/, the
-1 or 1 decider should be easy to do:

max_add = hslider("Max add", 0, 0, 100, 1);
d(y,f,pc) = e(y,f,pc) ~ _;
e(y,f,pc,d) = select2(abs(y) < 1, -1*sgn(y),
                  select2(abs(f) <= max_add/100, -1*sgn(f),
                  select2(pc==1, d, -1*d)));
sgn(x) = (x>0)-(x<0);

process = d;

(Note that Faust's select2 is a bit different from if-then-else, it has
the branches reversed.)

Faust takes a bit of a different mindset. Instead of thinking in terms
of a memory cell to be changed, imagine a signal that changes over time,
then it's actually quite easy. Of course we've all been raised on a von
Neumann diet, so it takes some time to relearn how to do certain things.
But for me this is what makes Faust so much fun to use. :)

Albert

-- 
Dr. Albert Gr"af
Dept. of Music-Informatics, University of Mainz, Germany
Email:  Dr.Graef@email-addr-hidden-online.de, ag@email-addr-hidden-mainz.de
WWW:    http://www.musikinformatik.uni-mainz.de/ag
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Fri Feb 1 08:15:05 2008

This archive was generated by hypermail 2.1.8 : Fri Feb 01 2008 - 08:15:05 EET