[CM] time variable filter (& stereo mastering ..) + a new 3d feature idea

Bill Schottstaedt bil at ccrma.Stanford.EDU
Mon, 17 Mar 2008 12:09:13 -0700

> the Update function in the File menu ..is it supposed to update the file? 

It means "update from disk" -- sometimes the sound file changes due to
some other program, and if you don't have auto-update set, you need
to update the Snd program's view explicitly.  Use 'Save' or 'Save as' 
if you want to write out the current edits.

One way to apply a filter to a selection and ramp in and out of it is:

(define* (filter-selection-and-smooth ramp-dur flt :optional order)
  (let ((temp-file (snd-tempnam)))
    (save-selection temp-file)
    (let ((selsnd (open-sound temp-file)))
      (filter-sound flt selsnd)
      (let ((tmp-dur (samples->seconds (frames selsnd))))
	(set! (sync selsnd) (1+ (sync-max))) ; make sure env-sound hits all chans
	(env-sound (list 0 0  ramp-dur 1  (- tmp-dur ramp-dur) 1  tmp-dur 0) 0 #f 1.0 selsnd)
	(save-sound selsnd)
	(close-sound selsnd)
	(env-selection (list 0 1  ramp-dur 0  (- tmp-dur ramp-dur) 0  tmp-dur 1))))
    (mix temp-file (selection-position) #t #f #f #f #t)))

;;; (filter-selection-and-smooth .01 (make-one-zero .5 .5))

I think you could also set up the filter you want in the control panel,
then use (filter-selection-and-smooth .01 (filter-control-coeffs)), but
I didn't try it.

I'm not using the more elegant (or readable) sample-readers here because
a selection can be scattered over any channels of any sounds, making it
messy to keep track of everything. 

To swap channels, see swap-channels.  I'll try to get to the other questions