[CM] Applying a function to every file in dir?

bil at ccrma.Stanford.EDU bil at ccrma.Stanford.EDU
Tue Jul 23 12:45:29 PDT 2024


framples and srate refer to the currently opened sound if
none is passed as an argument, so the open-sound merely
provides a fallback, but leaves the file open, and has no
effect on sndwarp, unless I'm misreading that code.
The file argument to sndwarp worked in the single-file
case because you gave the full file-name.  I think
for-each-sound-file passes you the file-names
without any directory info.

(let ((stretch 8)
       (indir "/home/kf/Documents/REAPER Media/keen/")
       (outdir "/home/kf/mySamples/keen/"))
   (for-each-sound-file
    (lambda (file)
      (with-sound (:output (string-append outdir file)
		  :scaled-to (db->linear 0))
        (let ((dir+file (string-append indir file)))
          (sndwarp
            0 ; beginning
            (* stretch (/ (mus-sound-framples dir+file) (mus-sound-srate 
dir+file))) ; duration
            dir+file
            :stretch stretch
            :randw 0.2
            :rev 0.01
            :overlaps 40
            ))))
    indir))




More information about the Cmdist mailing list