diff --git a/plug-ins/clicktrack.ny b/plug-ins/clicktrack.ny index 79a6b2420..aea26c3c7 100644 --- a/plug-ins/clicktrack.ny +++ b/plug-ins/clicktrack.ny @@ -1,8 +1,9 @@ ;nyquist plug-in -;version 3 +;version 4 ;type generate ;categories "http://lv2plug.in/ns/lv2core#GeneratorPlugin" ;name "Click Track..." +;preview linear ;action "Generating Click Track..." ;info "For help, select one of two help screens in 'Action choice' below." ;author "Dominic Mazzoni" @@ -13,8 +14,8 @@ ;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html . ;; original clicktrack.ny by Dominic Mazzoni, ;; modified by David R. Sky and Steve Daulton. -;; Minimum Audacity version: 1.3.4 ;; +;; Updated to v4 by Steve Daulton May 2015 ;; bug fixes and restructured by Steve Daulton Sept 2011. ;; string input verification added by Steve Daulton, 2009. ;; added click pitch [user request] and sound types fields September 2007 (D.R.Sky). @@ -286,6 +287,12 @@ Use whole numbers only.~%")))) (if m-s (setq measures (/ (m-s-to-seconds m-s)(* sig beatlen)))) + ;if previewing, restrict number of measures + (let ((preview (/ (get '*project* 'preview-duration) + (* sig beatlen)))) + (if (not (get '*track* 'view)) ;NIL if preview + (setq measures (min preview measures)))) + ;round up number of measures (setq measures (round-up measures)) diff --git a/plug-ins/pluck.ny b/plug-ins/pluck.ny index 120b87cf5..eb52daab7 100644 --- a/plug-ins/pluck.ny +++ b/plug-ins/pluck.ny @@ -1,8 +1,9 @@ ;nyquist plug-in -;version 3 +;version 4 ;type generate ;categories "http://lv2plug.in/ns/lv2core#GeneratorPlugin" ;name "Pluck..." +;preview linear ;action "Generating pluck sound..." ;info "MIDI values for C notes: 36, 48, 60 [middle C], 72, 84, 96." ;author "David R.Sky" @@ -11,7 +12,7 @@ ;; Released under terms of the GNU General Public License version 2: ;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html . -;control p "Pluck MIDI pitch" int "" 60 1 127 +;control pitch "Pluck MIDI pitch" int "" 60 1 120 ;control fade "Fade-out type" choice "abrupt,gradual" 0 ;control dur "Duration [seconds]" real "" 1 0.1 30 @@ -24,12 +25,24 @@ ; maximum amplitude. As defined in Audacity, 'pluck' has ; incorrect length duration and clipping at the start which gives ; rise to DC offset. Using 'snd-pluck' avoids the clipping and -; offset so we don't need the highpass8 filter that we used before. +; reduces offset so we don't need the highpass8 filter that we used before. +; Updated to v4 by Steve Daulton May 2015 ; set final-amp for abrupt or gradual fade (setf final-amp (if (= fade 1) 0.001 0.000001)) -(let* ((pluck-sound (snd-pluck *sound-srate* (step-to-hz p) 0 dur final-amp)) +;; Get length of preview +(setq pdur + (if (get '*track* 'view) ;NIL if preview + dur + (get '*project* 'preview-duration))) + +(let* ((pluck-sound (snd-pluck *sound-srate* (step-to-hz pitch) 0 dur final-amp)) + (pluck-sound (extract-abs 0 pdur pluck-sound)) ; shorten if necessary for preview. (max-peak (peak pluck-sound ny:all))) - (scale (/ 0.8 max-peak) pluck-sound)) + ;; snd-pluck has a random element and will occasionally produce + ;; zero amplitude at very high pitch settings. Avoid division by zero. + (if (> max-peak 0) + (scale (/ 0.8 max-peak) pluck-sound) + pluck-sound)) diff --git a/plug-ins/rissetdrum.ny b/plug-ins/rissetdrum.ny index 959839e58..32cfd1f74 100644 --- a/plug-ins/rissetdrum.ny +++ b/plug-ins/rissetdrum.ny @@ -1,14 +1,15 @@ ;nyquist plug-in -;version 3 +;version 4 ;type generate ;categories "http://lv2plug.in/ns/lv2core#GeneratorPlugin" +;preview linear ;name "Risset Drum..." ;action "Generating Risset Drum..." ;author "Steven Jones" ;copyright "Released under terms of the GNU General Public License version 2" ;; rissetdrum.ny by Steven Jones, after Jean Claude Risset. -;; Updated by Steve Daulton July 2012. +;; Updated by Steve Daulton July 2012 and May 2015. ;; Released under terms of the GNU General Public License version 2: ;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html ;; @@ -16,7 +17,7 @@ ;; http://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference ;control freq "Frequency (Hz)" real "" 100 50 2000 -;control decay "Decay (seconds)" real "" 2 0.125 10 +;control decay "Decay (seconds)" real "" 2 0.1 60 ;control cf "Center frequency of noise (Hz)" real "" 500 100 5000 ;control bw "Width of noise band (Hz)" real "" 400 10 1000 ;control noise "Amount of noise in mix (percent)" real "" 25 0 100 @@ -26,6 +27,8 @@ (defun sanitise (val minx maxx) (min (max val minx) maxx)) +;; Not required with validation in Audacity 2.1.1 but left +;; for compatibility. (setq freq (sanitise freq 1 (/ *sound-srate* 2))) (setq decay (sanitise decay 0.1 600)) (setq cf (sanitise cf 1 (/ *sound-srate* 2))) @@ -33,6 +36,12 @@ (setq noise (sanitise (/ noise 100) 0 1)) (setq gain (sanitise gain 0 1)) +;; Get length of preview +(setq pdur + (if (get '*track* 'view) ;NIL if preview + decay + (get '*project* 'preview-duration))) + (setq *rdrum-table* (list (mult 0.17 @@ -73,5 +82,6 @@ ;; Generate and normalize (let* ((output (risset-drum freq decay cf bw noise)) + (output (extract-abs 0 pdur output)) ; shorten if necessary for preview. (peakval (peak output ny:all))) (scale (/ gain peakval) output))