Buzz tone generator

https://wiki.audacityteam.org/wiki/Nyquist_Generate_Plugins#Buzz_tone_generator
Downloading buzz.ny gives a text instead of .ny file.
And its direct test on audacity 2.3.0 (Nyquist Prompt) gives syntax errors.

I wonder if there is a new version or I missed something to do in testing it.

Thank you.
Kerim

Nyquist plug-ins are plain text files, but have the filename extension “.ny”

If you are using Firefox, right click on the link and select “Save link as …”, then save the file as “buzz.ny”

I’ve just tested this plug-in and it works in Audacity 2.3.0.

Here IE11. This is exactly how I got buzz.ny

;nyquist plug-in ;version 1 ;type generate ;name "Buzz tone..." ;action "Generating  Buzz tone..." ;info "by David R. Sky\nReleased under terms of GNU Public License"  ;control fm "Frequency or MIDI number" int "0=freq 1=MIDI" 1 0 1 ;control freq  "Frequency" real "hz" 110.0 20.0 5000.0 ;control midi-note "MIDI note" int "MIDI  number" 45 16 127 ;control n "Number of harmonics" int "harmonics" 12 1 60 ;control  dur "buzz tone duration" real "seconds" 5.0 0.1 120.0 ;control level "Volume" int  "percent" 95 0 100 ; Buzz Generator by David R. Sky September 17, 2004 ; simplified  January 6, 2006 ; Released under terms of the GNU Public License ;  http://www.opensource.org/licenses/gpl-license.php ; if note is 100 hz with 4  harmonics, ; the output will consist of 4 frequencies: ; 100, 200, 300 and 400 hz ;  with equal amplitude. ; make sure note to send to the buzz function ; is a MIDI  number (setf note (if (= fm 1) midi-note (hz-to-step freq))) ; from Audacity  nyquist.lsp ; with broken 'avoid divide by zero' line ; fixed by Dominic Mazzoni  (defun buzz (n pitch modulation) (let ((modulation-srate (snd-srate modulation)) (hz  (step-to-hz (+ pitch (get-transpose))))) (cond ((< *SOUND-SRATE* modulation-srate)  (format t "Warning: down-sampling modulation in buzz~%") (setf modulation (snd-down  *SOUND-SRATE* modulation)))) (cond ((> hz (/ *SOUND-SRATE* 2)) (format t "Warning:  buzz nominal frequency (~A hz) will alias at current sample rate (~A hz).\n" hz  *SOUND-SRATE*))) (setf n (max n 1)) ; avoid divide by zero problem (scale-db (get- loud) (snd-buzz n ; number of harmonics *SOUND-SRATE* ; output sample rate hz ;  output hz (local-to-global 0) ; starting time modulation)))) ; freq. modulation ;  generating buzz tone (mult 0.01 level (pwl 0.002 1 (- dur 0.002) 1 dur) (buzz n note  (s-rest dur)))

I copied it and pasted it on Notepad. Then I named its file ‘buzz.ny’. I put a copy of it in the folder “…\Plug-Ins”. Audacity detected it as ‘New’ so I enabled it.
Although it is displayed (though grayed) on the ‘Effect’ menu, there is no sign of it on the ‘Generate’ menu.

So I wonder what the next step(s) could be to activate it. Thank you.

Repeated:
;nyquist plug-in ;version 1 ;type generate ;name “Buzz tone…” ;action “Generating Buzz tone…” ;info “by David R. Sky\nReleased under terms of GNU Public License” ;control fm “Frequency or MIDI number” int “0=freq 1=MIDI” 1 0 1 ;control freq “Frequency” real “hz” 110.0 20.0 5000.0 ;control midi-note “MIDI note” int “MIDI number” 45 16 127 ;control n “Number of harmonics” int “harmonics” 12 1 60 ;control dur “buzz tone duration” real “seconds” 5.0 0.1 120.0 ;control level “Volume” int “percent” 95 0 100 ; Buzz Generator by David R. Sky September 17, 2004 ; simplified January 6, 2006 ; Released under terms of the GNU Public License ; http://www.opensource.org/licenses/gpl-license.php ; if note is 100 hz with 4 harmonics, ; the output will consist of 4 frequencies: ; 100, 200, 300 and 400 hz ; with equal amplitude. ; make sure note to send to the buzz function ; is a MIDI number (setf note (if (= fm 1) midi-note (hz-to-step freq))) ; from Audacity nyquist.lsp ; with broken ‘avoid divide by zero’ line ; fixed by Dominic Mazzoni (defun buzz (n pitch modulation) (let ((modulation-srate (snd-srate modulation)) (hz (step-to-hz (+ pitch (get-transpose))))) (cond ((< SOUND-SRATE modulation-srate) (format t “Warning: down-sampling modulation in buzz~%”) (setf modulation (snd-down SOUND-SRATE modulation)))) (cond ((> hz (/ SOUND-SRATE 2)) (format t “Warning: buzz nominal frequency (~A hz) will alias at current sample rate (~A hz).\n” hz SOUND-SRATE))) (setf n (max n 1)) ; avoid divide by zero problem (scale-db (get- loud) (snd-buzz n ; number of harmonics SOUND-SRATE ; output sample rate hz ; output hz (local-to-global 0) ; starting time modulation)))) ; freq. modulation ; generating buzz tone (mult 0.01 level (pwl 0.002 1 (- dur 0.002) 1 dur) (buzz n note (s-rest dur)))

Don’t use NotePad, it messes up line endings and character encoding. “Sometimes” you can get away with it, but it is unpredictable.
A good editor to use on Windows is NotePad++ (https://notepad-plus-plus.org/)
but to save time, see if you can download this as “buzz.ny”:
buzz.ny (1.84 KB)

I downloaded your buzz.ny file and put it in place of the older one (in “…\Plug-Ins”).
Nothing changed :frowning: (To be sure, I closed/opened Audacity and disable/enable buzz.ny several times)

On the other hand, I copied buzz.ny (the older one) into the folder “Nyquist” instead of “Plug-Ins” by mistake. Since Audacity detected it too, on my Nyquist list there are now two entries of buzz.ny. They both exist on the list now though I deleted the one in the folder “Nyquist”. Naturally I enabled only one which is in “Plug-Ins”.

Let us assume that buzz.ny will be installed properly, how could I know it was done and activate it? Thank you.

Do you have other custom plug-ins installed? If not, I’m going to suggest that we reset Audacity and start again with this, because I’m confused, and it sounds like Audacity is confused too :wink:

I guess you mean uninstall/re-install Audacity, unless there is a function for ‘Reset’; as in sat receiver’s software :wink: .
I don’t mind resetting Audacity.

Edit1:
I am reading now “How do I reset my Audacity configuration settings?” :slight_smile:

Edit2:
I guess I should do this in C:\ Users > your username > Appdata > Roaming > audacity :

To reset just your plug-ins

Navigate to that audacity folder with Windows Explorer and delete the: 
pluginregistry.cfg file
pluginsettings.cfg file
Plug-Ins folder

Then restart Audacity

right?

Edit3:
This reset worked. ‘Buzz’ is on the “Generate” menu. Thank you.

Off topic.
I made a copy of your “buzz.ny” as “buzz.txt” and read it on Notepad. As expected, Notepad messed the line endings.
Then I copied the content of “buzz.txt” and pasted it on WordPad. This is what I got:

;nyquist plug-in
;version 1
;type generate
;name "Buzz tone..."
;action "Generating Buzz tone..."
;info "by David R. Sky\nReleased under terms of GNU Public License"

;control fm "Frequency or MIDI number" int "0=freq 1=MIDI" 1 0 1 
;control freq "Frequency" real "hz" 110.0 20.0 5000.0
;control midi-note "MIDI note" int "MIDI number" 45 16 127
;control n "Number of harmonics" int "harmonics" 12 1 60 
;control dur "buzz tone duration" real "seconds" 5.0 0.1 120.0
;control level "Volume" int "percent" 95 0 100

; Buzz Generator by David R. Sky September 17, 2004
; simplified January 6, 2006
; Released under terms of the GNU Public License
; http://www.opensource.org/licenses/gpl-license.php
; if note is 100 hz with 4 harmonics,
; the output will consist of 4 frequencies:
; 100, 200, 300 and 400 hz
; with equal amplitude.

; make sure note to send to the buzz function
; is a MIDI number
(setf note (if (= fm 1) midi-note
(hz-to-step freq)))

; from Audacity nyquist.lsp
; with broken 'avoid divide by zero' line
; fixed by Dominic Mazzoni
(defun buzz (n pitch modulation)
(let ((modulation-srate (snd-srate modulation))
(hz (step-to-hz (+ pitch (get-transpose)))))
(cond ((< *SOUND-SRATE* modulation-srate)
(format t "Warning: down-sampling modulation in buzz~%")
(setf modulation (snd-down *SOUND-SRATE* modulation))))
(cond ((> hz (/ *SOUND-SRATE* 2))
(format t "Warning: buzz nominal frequency (~A hz) will alias at current sample rate (~A hz).\n"
hz *SOUND-SRATE*)))
(setf n (max n 1)) ; avoid divide by zero problem
(scale-db (get-loud)
(snd-buzz n                   ; number of harmonics
*SOUND-SRATE*       ; output sample rate
hz                  ; output hz
(local-to-global 0) ; starting time
modulation))))      ; freq. modulation
                        

; generating buzz tone
(mult 0.01 level (pwl 0.002 1 (- dur 0.002) 1 dur)
(buzz n note (s-rest dur)))

I am just curious to know if Audacity can read it too.

I would highly recommend using NotePad++ when you need plain text.

In addition to not messing up line endings and character encoding, it also supports parentheses matching (click on one “(” or “)” and it will highlight the matching half of the pair), and it supports syntax highlighting for a lot of computer languages, including LISP (which is closely related to Nyquist). It is also free.

I heard of NotePad++ since long. But since you recommend it, I think it is time for me to use it instead of NotePad.