The following is a Nyquist plug-in I have wanted for a long time:
something to evaluate Nyquist code such as (hz-to-step 20) and give
me a text result (with minimum of steps such as generating audio,
selecting in Audacity, choosing Nyquist prompt from effects menu,
typing code and clicking on 'okay') to help in creating plug-ins.
This plug-in can be used to test generate and process Nyquist code,
instructions are commented below.
Thanks Steven Jones and Edgar Franke for help during the past
couple years which led 'accidentally' to this plug-in.
;name "Generate Nyquist result in text or sound..."
;action "Processing Nyquist code..."
;info "by David R. Sky\nPressing 'enter' will activate plug-in, use
cut & paste to move text\nReleased under terms of GNU Public
; make sure the above ;info line is not word wrapped
; Use this plug-in to process Nyquist code and give back a text or
; sound result
; e.g., with 'text' selected and (hz-to-step 440) result is
; 'Nyquist result is 69'
; with 'sound' selected and (hzosc 440) result is
; a 1 second 440Hz sine wave tone in Audacity
; This plug-in can also be used to test process code:
; select some audio in Audacity, select this plug-in from generate
; menu, select 'text or sound', type in code,
; hit 'enter' or click on 'debug'
; plug-in does not fully work without an actual generated 'sound'
; so silence of duration 0 is generated
; combine 5 lines of code into one string (thanks Edgar)
(format NIL "~a ~a ~a ~a ~a" code1 code2 code3 code4 code5))
; evaluate code (thanks Steven) and assign to 'result'
(setq result (eval (read (make-string-input-stream nyquist-code))))
(if (= choice 0) ; if 'text' is selected,
; generate text result
(format nil "Nyquist result is ~a ~%" result)
; otherwise generate sound result