Plug-in to test Nyquist code

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Plug-in to test Nyquist code

David R. Sky
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.


;nyquist plug-in
;version 2
;type generate
;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

; Generate Nyquist Result by David R. Sky, December 3, 2005
; Thanks to Steven Jones and Edgar Franke
; for pieces of the Nyquist code puzzle
; Released under terms of the GNU Public License

;control choice "Text or sound" int "0=text 1=sound" 0 0 1
;control code1 "Line 1" string ""
;control code2 "Line 2" string ""
;control code3 "Line 3" string ""
;control code4 "Line 4" string ""
;control code5 "Line 5" string ""

; 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
(s-rest 0)

; combine 5 lines of code into one string (thanks Edgar)
(setq nyquist-code
(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
(cue result))

This email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
Audacity-nyquist mailing list
[hidden email]