On Fri, 1 Feb 2008, Albert Graef wrote:
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).
Yes. I'm just pointing out the experimental approach which is
common for music programming. But it might just be a matter
of training.
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.)
Thanks, that was simple. I'll try figuring out the rest myself.
But what about resampling? The main main signal usually needs to
be resampled up 5-10 times to get a decent sound. Can I do that
with faust? Something like:
process = resample(5,d)
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. :)
Yes, its something else. I think I'll try to incorporate faust
into snd. It shouldn't be so much work, and it'll provide a
dynamic programming environment for faust, plus that faust can use
snd-rt's realtime engine for proper scheduling and connections
with ladspa/pd/midi/clm/cm/etc., and snd-rt can call faust
fucntions to get a convenient speed boost for dsp processing. A few
modifications to the faust syntax will be necesarry though to make
it work in s-expressions, but it shouldn't be so hard.