[CM] Snd: removing a channel

Bill Schottstaedt bil@ccrma.Stanford.EDU
Thu, 01 Apr 2004 03:07:33 -0800

One way to extract a group of channels and save them as a separate
WAVE sound file is:

(define* (extract-channels #:rest chans)
   ;; extract a list of channels from the current sound and save as test.snd: (extract-channels 0 2)
   (let ((snd (or (selected-sound) (car (sounds)))))
     (if (sound? snd)
	   (lambda (chan)
	     (set! (selection-member? snd chan) #t)
	     (set! (selection-position snd chan) 0)
	     (set! (selection-frames snd chan) (frames snd chan)))
	  (save-selection "test.snd" :header-type mus-riff)))))

To have this affect the current sound "in place", use the current
sound's filename in place of "test.snd", then call update-sound.
There are a lot more ways to do this sort of thing.