[CM] wrapper macro strategies
Bret F Battey
bbattey@u.washington.edu
Fri, 25 Jul 2003 11:21:55 -0700 (PDT)
Oops, sorry, I should have been clearer:
I already know how to make basic wrapper macros using &body. What I can't crack is
how to write a macro 'balance-sounds' that could turn this (for example):
(balance-sounds () (mix soundfile1) (mix soundfile2))
into
(sound-let ((temp1 () (mix soundfile2))
(sound-let ((temp2 () (mix soundfile2)))
(balance temp1 temp2))))
or a macro 'balance-sound-process':
(balance-sound-process () (contrast (:fm-index '(0 0 1 2))) (mix soundfile2)))
expanding into
(sound-let ((temp1 () (mix soundfile2))
(sound-let ((temp2 () (contrast temp1 :fm-index '(0 0 1 2))))
(balance temp2 temp1))))
(My paren's are probably off because I'm typing right into email)
The specific problem being that &body -- which would contain both the source sound
specification and the contrast specification -- has to be split into two parts somehow...
[Also, this later example shows that I'm varying fm-index continuously, so I need a
continuous adaptation of gain on the sound -- hence using balance rather than a
single overall gain control based on relative peak values.]
Bret Battey http://BatHatMedia.com
----------------------------------------------------------------------
Research Associate
Center for Digital Arts and Experimental Media
University of Washington, Seattle http://www.washington.edu/dxarts/
On Fri, 25 Jul 2003, Bill Schottstaedt wrote:
> Bret F Battey wrote:
>
> >(balance-sounds () (mix soundfile1) (mix soundfile2))
> >
> >But given that defmacro can only take one &body, I'm really not sure on how to pull
this off.
> >
> >
> sound.lisp has several examples -- &body is a list of all the statements
> in the
> body of the macro, so you can use ,.body or ,@body to plug them in anywhere.
> A very simple example is
>
> (defmacro without-warnings (&body body) `(progn ,.body))
>
> For (balance-processed-sound () (contrast-sound (:fm-index 2) (mix soundfile1))),
> I'd save the maxamp (or whatever) of soundfile1, save the output of contrast-sound
> via sound-let, get the ratio to match the original, scale the new output, mixing
> that into the overall output. sound-let's can be nested, as can with-sound's.
> If you get stuck, send me the actual code you're trying to use.
>
>
>
>
>
>
>