[CM] With-sound question

Fernando Pablo Lopez-Lezcano nando@ccrma.Stanford.EDU
Mon, 21 Oct 2002 20:57:41 -0700 (PDT)

> I have a macro that writes calls to an instrument:
> (write-ins my-instrument-gen)
> > (my-instrument 0 4 440)  ;;this might ba an simp-type instrument that
>                            ;;   implements a simple oscilator.
> If i place a call to this macro in the spot where a normal instrument call
> would be in a with-sound:
> (with-sound () (write-ins my-instrument-gen))
> The results are rather odd.  No error is returned, but the output
> soundifle is only 1 sample in length.

Things work fine here:
  start cmucl
  (compile-file "v.ins")
  (load "v.cmucl")
- load this macro:

(defmacro twov (start dur f1 f2 amp)
     (fm-violin ,start ,dur ,f1 ,amp)
     (fm-violin ,start ,dur ,f2 ,amp)))

- execute this with-sound call:

(with-sound()(twov 0 1 440 450 0.1)

It creates a soundfile with two violin notes with 440 and 450Hz
frequencies For something like this obviously a macro is overkill, a
simple function would suffice:

(defun twovfun (start dur f1 f2 amp)
  (fm-violin start dur f1 amp)
  (fm-violin start dur f2 amp))

-- Fernando