[CM] feature request

Bill Schottstaedt bil@ccrma.Stanford.EDU
Wed, 13 Jun 2007 07:34:39 -0700


> I have a request that in a future version of SND one would be able to drag a
> single audio file off of the main program window so that it can be displayed
> separate.

It's probably not quite what you want, and it's clumsy, but:

(define* (separate-sound :optional snd)
  "split out 'snd' into its own snd process"
  (let* ((tmpf (snd-tempnam))
         (scm (string-append (substring tmpf 0 (- (string-length tmpf) 3)) "scm"))
         (scm1 (string-append (substring tmpf 0 (- (string-length tmpf) 4)) "-1.scm"))
         (oldsnd (or snd (selected-sound)))
         (name (file-name oldsnd)))
    (if (not (string? (save-dir))) (set! (save-dir) "/tmp"))
    (save-edit-history scm oldsnd)
    (close-sound oldsnd)
    (with-output-to-file
        scm1
      (lambda ()
        (display (format #f "(define sfile (open-sound ~S))~%" name))
        (display (format #f "(load ~S)~%" scm))))
    (system (format #f "snd ~A &" scm1))))