;;; this one makes selections from first mark onwards, ends with ;;; selection from last mark -> end of sound. (define* (mark-explode #:optional (snd (or (selected-sound) (car (sounds)))) (htype mus-next) (dformat mus-bfloat) (aenv '(0 0 1 1 99 1 100 0))) "(mark-explode :optional header-type data-format) splits a sound into a bunch of sounds based on mark placements" (let* ((file-ctr 0) (start (mark-sample (car (car (marks snd))))) (end 0) (name (basename (short-file-name snd) ".wav"))) (for-each (lambda (mark) (set! end (mark-sample mark)) (if (> end start) (let ((filename (format #f "~A-explode-~D.snd" name file-ctr))) (set! file-ctr (1+ file-ctr)) (do ((i 0 (1+ i))) ((= i (chans snd))) (set! (selection-member? snd i) #t) (set! (selection-position snd i) start) (set! (selection-frames snd i) (- end start))) (env-selection aenv) (save-selection filename :header-type htype :data-format dformat :srate (srate snd)) (do ((i 0 (1+ i))) ((= i (chans snd))) (set! (selection-member? snd i) #f)))) (set! start end)) (cdr (car (marks snd)))) (let ((filename (format #f "~A-explode-~D.snd" name file-ctr))) (set! file-ctr (1+ file-ctr)) (do ((i 0 (1+ i))) ((= i (chans snd))) (set! (selection-member? snd i) #t) (set! (selection-position snd i) start) (set! (selection-frames snd i) (- (frames snd) start))) (save-selection filename :header-type htype :data-format dformat :srate (srate snd)) (do ((i 0 (1+ i))) ((= i (chans snd))) (set! (selection-member? snd i) #f))) (update-time-graph snd)))