This is the text inside the randompitch.ny file (I’ve reformatted it so that the code is easier to read):
;nyquist plug-in
;version 1
;type process
;name "Random Pitch Modulation..."
;action "Randomly warping your audio..."
;info "Random Pitch Modulation by David R. Sky"
;control depth "Warping depth" real "depth" 0.100 0.001 2.000
;control maxspeed "Max sweep speed" real "Hz" 0.50 0.01 20.00
;control factor "Sweep depth factor" int "factor" 80 1 300
;control maxdepth "Max pitch mod depth" real "depth" 0.50 0.01 3.00
;; Random pitch Modulation by David R. Sky October 1, 2004
;; As in previous random plug-ins,
;; maxspeed and factor are inversely proportional
;;
;; works on mono and stereo audio
;; if stereo, each channel will have different random modulation
(defun ransiglin (offset factor maxspeed)
(sum offset (lp (mult factor (lp (noise) maxspeed)) (mult 0.5
maxspeed))))
(setf offset (mult 0.50 maxdepth))
(if (arrayp s)
(vector (snd-tapv (aref s 0)
offset
(mult depth (ransiglin offset factor maxspeed))
maxdepth)
(snd-tapv (aref s 1)
offset
(mult depth (ransiglin offset factor maxspeed))
maxdepth))
(snd-tapv s
offset
(mult depth (ransiglin offset factor maxspeed))
maxdepth))
The first part contains “headers” to tell Audacity what kind of plug-in it is:
;nyquist plug-in
;version 1
;type process
;name "Random Pitch Modulation..."
;action "Randomly warping your audio..."
;info "Random Pitch Modulation by David R. Sky"
The next part tells Audacity what controls to add to the plug-in interface:
;control depth "Warping depth" real "depth" 0.100 0.001 2.000
;control maxspeed "Max sweep speed" real "Hz" 0.50 0.01 20.00
;control factor "Sweep depth factor" int "factor" 80 1 300
;control maxdepth "Max pitch mod depth" real "depth" 0.50 0.01 3.00
The next part just contains some comments (comments are ignored by Audacity and Nyquist):
;; Random pitch Modulation by David R. Sky October 1, 2004
;; As in previous random plug-ins,
;; maxspeed and factor are inversely proportional
;;
;; works on mono and stereo audio
;; if stereo, each channel will have different random modulation
The final part is the actual code:
(defun ransiglin (offset factor maxspeed)
(sum offset (lp (mult factor (lp (noise) maxspeed)) (mult 0.5
maxspeed))))
(setf offset (mult 0.50 maxdepth))
(if (arrayp s)
(vector (snd-tapv (aref s 0)
offset
(mult depth (ransiglin offset factor maxspeed))
maxdepth)
(snd-tapv (aref s 1)
offset
(mult depth (ransiglin offset factor maxspeed))
maxdepth))
(snd-tapv s
offset
(mult depth (ransiglin offset factor maxspeed))
maxdepth)
The function “ransiglin” (“random signal in” ??) generates the random waveform.
Looking at “ransiglin” more closely:
(defun ransiglin (offset factor maxspeed)
(sum offset (lp (mult factor (lp (noise) maxspeed)) (mult 0.5
maxspeed))))
The three parameters; offset, factor, and maxspeed, are derived from these three controls:
;control maxspeed "Max sweep speed" real "Hz" 0.50 0.01 20.00
;control factor "Sweep depth factor" int "factor" 80 1 300
;control maxdepth "Max pitch mod depth" real "depth" 0.50 0.01 3.00
where “offset” is half of “maxdepth”
(setf offset (mult 0.50 maxdepth))
Using those three parameters, “ransiglin” filters white noise to create the random waveform.
Because “ransiglin” uses a low-pass filter applied to white noise, the average frequency of the random waveform will be between 0 and “maxspeed” (in Hz).
If you want an average, say, between 10 Hz and 50 Hz, you could modify the plug-in to have both a maximum and minimum frequency, and then in “ransiglin” you would apply a high-pass filter at the minimum frequency, and a low-pass filter at the maximum frequency.
See also: https://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference