;;********************************************
;;********************************************
;;////////////////////////////////////////////
;;Nyquist
Plug-Ins for Audacity
;;////////////////////////////////////////////
;;Mauricio
Rodriguez - 2014
;;////////////////////////////////////////////
;;marod@ccrma.stanford.edu
;;////////////////////////////////////////////
;;********************************************
;;********************************************
#|
******************************
******************************
Use and
copying of this software and preparation of derivative works
based upon
this software are prohibited unless permission of the author.
Suggestions,
comments and bug reports are welcome. Please address email to:
marod@ccrma.stanford.edu
******************************
******************************
|#
#|
Locate
this code in the Plug-Ins directory from Audacity. Each Plug-In must be saved
as a separate file.
|#
#|
******************************
******************************
Break
Point Envelope
******************************
******************************
|#
;nyquist
plug-in
;version 3
;type
process
;name
"Break Point Envelope..."
;action
"Performing envelope..."
;info
"Written by Mauricio Rodriguez"
;control
string-input "Input" string "Input-values" "0.0 0.0 0.5
1.0 1.0 0.0"
(defun
string-to-list (string)
(read (make-string-input-stream (format
nil "(~a)" string))))
;;(string-to-list
"0.0 0.0 1.0 1.0")
(defun
mapvalue (x a b c d)
(+ c (* (- x a) (/ (float (- d c)) (- b a)))))
(defun
normalize-envelope (input)
(let ((low (first input))
(high (second (reverse input))))
(do ((current-input input
(rest (rest current-input)))
(output 'nil (append (list (second current-input) (mapvalue (first
current-input) low high 0.0 1.0)) output)))
((endp current-input) (cons 'pwl (reverse output))))))
;;(normalize-envelope
'(0.0 0.0 5.0 1.0))
;;(normalize-envelope
'(0.0 0.0 5.0 1.0 10.0 0.0))
;;(normalize-envelope
'(0.0 0.0 2.5 1.0 5.0 0.0))
;;(normalize-envelope
'(0.0 0.0 25 1.0 50.0 0.0))
(mult s
(eval (normalize-envelope (string-to-list string-input))))
#|
******************************
******************************
Ring
Modulator
******************************
******************************
|#
;nyquist
plug-in
;version 3
;type
process
;name
"Ring Modulation"
;action
"Ring Modulating..."
;info
"Written by Mauricio Rodriguez"
;control
wave "Waveform type" choice "Sine, Triangle, Sawtooth,
Square" 0
;control
modulation-frequency "Frequency [Hz]" real "" 440.0 100.0
2000.0
(setq
*waveform* (cond
((= wave 0) *sine-table*)
((= wave 1) *tri-table*)
((= wave 2) *saw-table*)
((= wave 3) (abs-env (list (pwl 0.0 1.0 0.5 1.0 0.5 -1.0 1.0 -1.0) (hz-to-step
1.0) t)))))
(mult
(hzosc modulation-frequency *waveform*) s)
#|
******************************
******************************
Dynamic
Ring Modulator
******************************
******************************
|#
;nyquist
plug-in
;version 3
;type
process
;name
"Ring Modulation (Dynamic)"
;action
"Ring Modulating (dynamically)..."
;info
"by Mauricio Rodriguez"
;control
wave "Waveform type" choice "Sine, Triangle, Sawtooth,
Square" 0
;control
start-frequency "Start-Frequency [Hz]" real "" 440.0 100.0
2000.0
;control
end-frequency "End-Frequency [Hz]" real "" 1200.0 100.0
2000.0
(setq
*waveform* (cond
((= wave 0) *sine-table*)
((= wave 1) *tri-table*)
((= wave 2) *saw-table*)
((= wave 3)
(abs-env (list (pwl 0.0 1.0 0.5 1.0 0.5 -1.0 1.0 -1.0) (hz-to-step 1.0) t)))))
(mult
(hzosc (pwl 0.0 start-frequency 1.0 end-frequency) *waveform*) s)