I’m trying to write a plugin which convolves all selected tracks (assuming mono).
My approach is to store the audio so far as a property of SCRATCH, then retrieve this audio when Nyquist invokes the plugin again on the next track.
I can’t tell why this isn’t working. I’m not sure, but I think nil audio is being added to the property list.
;nyquist plug-in
;version 4
;type process
;preview linear
;name "Convolve Tracks"
;action "Convolving..."
;author "dm"
(defun get-storage ()
(get '*SCRATCH* 'DM-CONVOLVE-STORAGE))
(defun clear-storage ()
(remprop '*SCRATCH* 'DM-CONVOLVE-STORAGE))
(defun store (signal)
(putprop '*SCRATCH* signal 'DM-CONVOLVE-STORAGE))
(defun conv-stored (signal)
(convolve signal (get-storage)))
(setq index (get '*TRACK* 'INDEX))
(setq tracks (length (get '*SELECTION* 'TRACKS)))
;(print (symbol-plist '*SCRATCH*))
(if (= index 1)
(if (< tracks 2) (print "Select two or more tracks")
(store *TRACK*))
(if (= index tracks) (prog1 (conv-stored *TRACK*) (clear-storage))
(store (conv-stored *TRACK*))))