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

Kenneth Flak kennethflak at protonmail.com
Tue Jul 23 10:49:53 PDT 2024


<bil at ccrma.Stanford.EDU> writes:

> I think you don't need the open-sound, but the
> file passed to sndwarp should be (string-append
> indir file), not just file (the latter defaults
> to the current directory).

Hi Bill,

Tanks for the tip. I tried to omit (open-sound), but this give me 
an error:

#<unspecified>
>framples: no such sound: #<undefined>
"*stdout*"[5]: (sndwarp 0 (* stretch (/ (framples) (srate))) file 
:stretch stretch :randw 0.2 :rev 0.01 :overlaps 40)

Reducing the example to a single file, this is the code:

(let ((stretch 8)
      (file "/home/kf/Documents/REAPER Media/keen/keen-005.wav"))
  (with-sound (:output "/home/kf/mySamples/keen/keen-005.wav" 
  :scaled-to (db->linear 0))
              ;; (open-sound file) ; if I enable this, everything 
              works as it should
              (sndwarp 
                0 ; beginning
                (* stretch (/ (framples) (srate))) ; duration
                file
                :stretch stretch
                ;; :srate 0.5 ; pitch shift. 1.0 unchanged, 0.5 1 
                octave down.
                :randw 0.2
                :rev 0.01
                :overlaps 40
                )
              ))

Kenneth





More information about the Cmdist mailing list