[CM] Re: [Faudiostream-devel] Faust and Snd-rt

Kjetil S. Matheussen k.s.matheussen at notam02.no
Tue, 18 Mar 2008 11:54:07 +0100 (CET)


That's great!

I've also uploaded a new version of snd-ls now (0.9.8.10)
because of a bug in 0.9.8.9 which caused the snd-rt-gtk.cpp
to be used when compiling every faust objects,
not just the first one.

It's only necessary to to use snd-rt-gtk.cpp at
the first compilation, and after that the
module.cpp file can be used instead. module.cpp
takes a lot less time to compile than snd-rt-gtk.cpp
so this is a big improvement.

There was also a bug in the "url" macro, which
is now fixed. (well, the "url" macro was actually
never tested, so "completely broken" is
probably more describing than "bug")

Oh, and by using url, I've also found that using

(<rt-faust> :autoimport-libs #f
            (url (x11-selection)))

is a very convenient way to test the faust
programs at 
http://faudiostream.cvs.sourceforge.net/faudiostream/faust/examples/


And finally, in my last posting I forgot to
give an example on how to feed sound from
Snd-rt into a snd-rt <faust> object:

(<rt-out> (<faust> :in (vct (oscil))
		   (= gain    (vslider "gain" 0.2 0 1 0.01))
		   (= process (vgroup "ai" "*(gain)"))))

however this syntax is a bit strange and should probably
be changed. The natural solution is to make <faust> a
macro which returns a function:

  ((<faust> (out "*(0.5)"))
   (vct (oscil)))

but this would require an extra layer of parantesis
even when no input is required.




On Mon, 17 Mar 2008, Yann Orlarey wrote:

> Hi Kjetil,
> 
> Thanks you *very* much. I still have to try it, but it is a very 
> important contribution ! I have uploaded the "snd-rt-gtk.cpp" file to 
> the Faust CVS.
> 
> Yann
> 
> 
> 
> Kjetil S. Matheussen a écrit :
> > Hi,
> >
> > Latest versions of snd and snd-ls: 
> > http://www.notam02.no/arkiv/src/snd/snd-ls-0.9.8.9.tar.gz
> > contain code to use faust from snd-rt.
> >
> > I have mentioned this both on the linux audio mailing
> > list and on the linux audio conference but haven't had
> > time to implement it yet.
> >
> > This is the faust module containing glue code for snd-rt:
> >
> >   http://www.notam02.no/arkiv/src/snd/snd-rt-gtk.cpp
> >
> > ...which must be copied it into the lib/faust directory.
> > Hopefully Yann will include it in faust. (Its almost
> > entirely similar to the jack-gtk module though.)
> >
> >
> >
> > Simplest example:
> >
> >   (<rt-faust> (out (osc 400)))
> >
> >
> >
> > ...which is exactly the same as:
> >
> >   (<rt-faust> "process=osc(400);")
> >
> >
> >
> > Larger example:
> >
> >   (<rt-faust> (import "math.lib")
> >               (= (smooth c) (colon "*(1-c)" "+~*(c)"))
> >               (= vol        (colon  (hslider "volume (db)" 0 -96 0 0.1)
> >                                     db2linear
> >                                     (smooth 0.99)))
> >               (= freq       (hslider "freq" 1000 0 24000 0.1))
> >               (out (vgroup "Osc" (* (osci freq) vol))))
> >
> >
> >
> > Evaluating code in the x11 buffer, for example from the faust software 
> > catalog:
> >
> >   (<rt-faust> :autoimport-libs #f	   
> >              (x11-selection))
> >
> >
> > Import code from url:
> >
> >   (<rt-faust> (url "http://..."))
> >
> >
> >
> > Import local file:
> >
> >   (<rt-faust> (include "/home/kjetil/snd-run/osc.dsp"))
> >
> >
> >
> > Display the faust source of the lastest evaluated faust object:
> >   (display-faust-source)
> >
> >
> >
> > Sending sound from one RT object to another:
> >
> > (let ((abus (make-bus)))
> >   (<rt-faust> :in-bus abus
> >               (= (smooth c) "*(1-c) : +~*(c)")
> >               (= gain       (colon (vslider " dB " 0 -96 4 0.1)
> >                                    db2linear
> >                                    (smooth 0.999)))
> >               (out (vgroup "fader" "*(gain)")))
> >   (<rt-out> :out-bus abus
> >             (oscil)))
> >
> >
> > Using faust to monitor the output of the RT engine:
> >
> >   (<rt-faust> :in-bus *out-bus*
> >              "vmeter(x)       = attach(x, envelop(x) : vbargraph(\"dB\", -96, 10));
> >               hmeter(x)       = attach(x, envelop(x) : hbargraph(\"dB\", -96, 10));
> >               envelop         = abs : max(db2linear(-96)) : linear2db : min(10)  : max ~ -(96.0/SR);
> >               process         = vmeter;")
> >
> >
> >
> > Faust lisp macro:
> >
> >   (define-faust-macro (oscivol freq vol)
> >     `(* ,vol (osci ,freq)))
> >
> >   (<rt-faust> (out (oscivol 500 0.2)))
> >
> >
> >
> > Calling Faust functions from Snd-Rt code.
> > Both the frequency slider and the volume
> > slider will appear in the same dialog:
> >
> >   (<rt-out> (* (<faust> (= freq    (vslider "freq" 600 0 2400 0.1))
> >                         (= process (vgroup "ai" (osc freq))))
> >                (<slider> "vol" 0.0 0.1 1.0)))
> >
> >
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Microsoft
> > Defy all challenges. Microsoft(R) Visual Studio 2008.
> > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > _______________________________________________
> > Faudiostream-devel mailing list
> > Faudiostream-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/faudiostream-devel
> >
> >
> >   
> 
>