[CM] file output formats

Bill Schottstaedt bil@ccrma.Stanford.EDU
Tue, 4 Mar 2003 03:42:17 -0800


> Alternatively (and perhaps better), the reverb file that
> gets written anyway could still be written and then the reverb mixing step
> could be skipped, so that in the end you would be left with a reverb
> signal file, and a dry signal file, and could then remix these through an
> outboard reverb box at a later time.

I think this is the :revfile argument to with-sound -- if it is given,
it sets the reverb stream file name, but if no :reverb is given,
the reverb file is not handled in any way.  You can also set
*clm-delete-reverb* to t to have the reverb file deleted by
with-sound (it is normally not deleted).

> (with-sound (:channels 2 :output "george.aiff" :mono-output (".L" ".R"))
>	(some-inst 0 1 2 3))
>
> would result in an output of two mono files, rather than one stereo file,
> and the output files would be named "george.aiff.L" and "george.aiff.R."

The main complication with this involves locsig.  I think I'd rather
provide a wrapper around with-sound that does the split:

#!snd -b
!#
(if (= (length (script-args)) 2)
  (display "usage: split.scm file-name\n")
  (let* ((name (list-ref (script-args) (1+ (script-arg))))
	 (chns (mus-sound-chans name)))
    (if (> chns 1)
	(let ((ind (open-sound name)))
	  (do ((i 0 (1+ i)))
	      ((= i chns))
	    (display (format #f "~A.~D " name i))
	    (save-sound-as (format #f "~A.~D" name i)
			   ind
			   (header-type ind)
			   (data-format ind)
			   (srate ind)
			   i))
	  (close-sound ind)))))
(exit)

(Call it split.scm and make it executable); then a lisp function:

(defmacro with-exploded-sound ((&rest args) &body body)
  `(let ((filename (with-sound ,args ,.body)))
     (clm::run-in-shell "split.scm" filename)))