#!/usr/bin/sbcl --noinform ; If you haven't already, read about sbcl #! processing at ; http://sbcl.sf.net/manual/Unix_002dstyle-Command-Line-Protocol.html ; NOTE: This is obsolete! Mplayer since 1.0_rc2 has a scaletempo audio filter. ; Usage: fastplay ; eg: fastplay 2.1 moviefile.avi (defun intersperse (thing list) "Put thing between each of the elements in list. (intersperse '|,| '(1 2 3)) => (1 |,| 2 |,| 3)" (rest (mapcan (lambda (x) (list thing x)) list))) (defun decompose-to-factors-in-range (n min max) (cond ((< n min) (cons min (decompose-to-factors-in-range (* n min) min max))) ((> n max) (cons max (decompose-to-factors-in-range (* n min) min max))) (t (list n)))) (defun factor-to-semitones (factor) (* -12 (log factor 2))) (defun tap-pitch-decorate (factor &key (path "/usr/lib/ladspa/tap_pitch.so") (dry -40) (wet 0)) (format nil "ladspa=~A:tap_pitch:~A:0:~A:~A" path (factor-to-semitones factor) dry wet)) (defun build-tap-pitch-filter-chain (factor) (apply #'concatenate 'string (intersperse "," (mapcar #'tap-pitch-decorate (decompose-to-factors-in-range factor 1/2 2))))) (defun fastplay (factor &rest args) (sb-ext:run-program "mplayer" (append (list "-af" (build-tap-pitch-filter-chain (read-from-string factor)) "-speed" (format nil "~A" factor)) args) :output t :search t)) (apply #'fastplay (nthcdr 2 *posix-argv*))