1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 07:39:42 +02:00
audacity/plug-ins/rissetdrum.ny
lllucius 41083f74cc Another round of effects bashing.
I've added some of the new plugin stuff to LV2, Nyquist, and
Vamp so that they play better in the new system.  They no
longer get bunched in with the Audacity effects when sorting
or grouping the menus.  They have not been fully converted
but they should be good for 2.1.0.

Nyquist plugins now include ";author" and ";copyright"
statements.

Added the 4 new Nyquist plugins to the Windows build.

Audiounits are still coming...had to push them to the back
burner to get this other stuff out of the way.

Scanning for new plugins has been improved so that newly
discovered ones will be shown to the user when Audacity starts.

Effects menu sorting has been fixed and improved.

Disabling effect types in Preferences works again and you
no longer have to restart Audacity for them the change to work.

Effect usage in chains works again.

Plugin registration dialog code simplified a bit.

Group names in the pluginregistry are now base64 encoded.  I
never really thought about it, but wxFileConfig group names
are case insensitive and since I was using the group name as
the plugin ID, I ran into a conflict on Linux where there
were two plugins with the same name, just different case.  (And
they were different plugins.)  Hoping all of this will change
when/if the config file gets converted to XML.  (wx3 if finally
including XML support)

A fair amount of cleanup of this new code has been done and
will continue as more stuff is converted.
2014-11-19 06:58:44 +00:00

78 lines
2.4 KiB
Common Lisp

;nyquist plug-in
;version 3
;type generate
;categories "http://lv2plug.in/ns/lv2core#GeneratorPlugin"
;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.
;; Released under terms of the GNU General Public License version 2:
;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
;;
;; For information about writing and modifying Nyquist plug-ins:
;; 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 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
;control gain "Amplitude (0 - 1)" real "" 0.8 0 1
(defun sanitise (val minx maxx)
(min (max val minx) maxx))
(setq freq (sanitise freq 1 (/ *sound-srate* 2)))
(setq decay (sanitise decay 0.1 600))
(setq cf (sanitise cf 1 (/ *sound-srate* 2)))
(setq bw (sanitise bw 10 1000))
(setq noise (sanitise (/ noise 100) 0 1))
(setq gain (sanitise gain 0 1))
(setq *rdrum-table*
(list
(mult 0.17
(sum
(scale 1.00 (build-harmonic 10 2048))
(scale 1.50 (build-harmonic 16 2048))
(scale 2.00 (build-harmonic 22 2048))
(scale 1.50 (build-harmonic 23 2048))))
(hz-to-step 1) t))
(defun log2 (n)
(/ (log (float n))(log 2.0)))
(defun percussion-env (decay)
(let* ((half-life (expt 2.0 (- (log2 decay) 3))))
(exp-dec 0 half-life decay)))
(defun risset-drum (freq decay cf bw noise-gain)
(let* ((decay2 (* decay 0.50))
(low-note (* freq 0.10))
(tone-gain (- 1 noise-gain)))
(setf pink (lowpass6 (noise decay2) bw))
(setf rdrum
(mult tone-gain
(osc (hz-to-step low-note) decay2 *rdrum-table*)))
(setf noise-band
(mult noise-gain
(sine (hz-to-step cf) decay2)
pink))
(sum
(mult
(percussion-env decay2)
(sum noise-band rdrum ))
(mult tone-gain
(percussion-env decay)
(sine (hz-to-step freq) decay)))))
;; Generate and normalize
(let* ((output (risset-drum freq decay cf bw noise))
(peakval (peak output ny:all)))
(scale (/ gain peakval) output))