REQ: R1 MF ("Blue box") Tone Generator

Using Nyquist scripts in Audacity.
Post and download new plug-ins.

If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like

Re: REQ: R1 MF ("Blue box") Tone Generator

Permanent link to this post Posted by Annabelle3985 » Sun Oct 25, 2015 6:14 pm

So for example, the headers and code would probably be something like the one in this file?
You do not have the required permissions to view the files attached to this post.
Annabelle3985
 
Posts: 53
Joined: Sat Oct 24, 2015 1:17 am
Operating System: Windows 7

Re: REQ: R1 MF ("Blue box") Tone Generator

Permanent link to this post Posted by Robert J. H. » Mon Oct 26, 2015 4:25 am

Annabelle3985 wrote:So for example, the headers and code would probably be something like the one in this file?

I Would probably take a newer example such as:
Code: Select all
;nyquist plug-in
;version 4
;type generate
;categories "http://lv2plug.in/ns/lv2core#GeneratorPlugin"
;name "Click Track..."
;action "Generating Click Track..."
;info "For help, select one of two help screens in 'Action choice' below."
;author "Dominic Mazzoni"
;copyright "Released under terms of the GNU General Public License version 2"



From this, you can create your own template - a text file on the desktop for instance - and copy it into each new plug-in.

A few remarks:
The first two lines should never change.
Version 4 plug-ins have the most features, thus, I would stick to it.
The type might change, there are also process and analyze available.
;categories is not really necessary - it's a bit confusing to find the right type online.
;name and ;action have to be adapted for each new plug-in.
Action is what will be displayed on the progress bar when executing an effect.

;info seems to be no longer in use, I cannot see any text displayed in the Dialog.

;author and ;copyright appear under the manage menu (alt+m) of the effect dialog, under "about" to be more specific.
Confusingly enough, they are renamed:
;author --> Vendor
;copyright --> Description

Robert
Robert J. H.
 
Posts: 1813
Joined: Thu May 31, 2012 8:33 am
Operating System: Windows 7

Re: REQ: R1 MF ("Blue box") Tone Generator

Permanent link to this post Posted by steve » Mon Oct 26, 2015 8:39 am

As Robert says, better to use a newer example.

Each line of the header begins with a single semicolon followed by a keyword and then one or more parameters. The following four headers are required (essential) for all plug-ins. The keyword must always be typed in lower case. The parameters must also be lower case unless the parameter is quoted text (such as the name of the effect).

;nyquist plug-in
This tells Audacity that it is a Nyquist plug-n

;version 4
Plug-ins may be version 1 to 4. Version 4 is the most recent and as Robert says, has the most features. New plug-ins should use the most recent version number.

;type process
or
;type generate
or
;type analyze
The type tells Audacity which menu to put the plug-in into. Process type plug-ins go in the Effect menu, Generate type plug-ins go into the Generate menu and analyze type plug-ins go into the Analyze menu. As a general rule, plug-ins that process audio and return audio to the track should be ;type process, plug-ins that generate audio should be ;type generate, and plug-ins that analyze audio or create labels should be ;type generate.

;name "Quoted name of track"
This is the name that appears in the Audacity menu. Try to use a short but descriptive name. If the plug-in has an interface the name should end with three dots. If the plug-in acts immediately without showing an interface the name should not have the three dots. The name must be in quotes and is usually in Titles Case.

Those are the 4 essential headers.

The ;categories and ;info headers are not currently used by Audacity (ignored).
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45302
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: REQ: R1 MF ("Blue box") Tone Generator

Permanent link to this post Posted by steve » Mon Oct 26, 2015 9:13 am

Plug-in headers are documented here: http://wiki.audacityteam.org/wiki/Nyqui ... -in_Header
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45302
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: REQ: R1 MF ("Blue box") Tone Generator

Permanent link to this post Posted by Annabelle3985 » Wed Oct 28, 2015 3:17 pm

I think this might be what the plugin should look like. Look carefully at this and tell me if it looks right to you. Tell me if there's anything in the code that I may need to change.
You do not have the required permissions to view the files attached to this post.
Annabelle3985
 
Posts: 53
Joined: Sat Oct 24, 2015 1:17 am
Operating System: Windows 7

Re: REQ: R1 MF ("Blue box") Tone Generator

Permanent link to this post Posted by steve » Wed Oct 28, 2015 6:39 pm

The headers look OK except that there are 4 spaces at the start of each line. The header lines should really start at the beginning of the line.
Also, there would usually be an empty line separating the header lines from main plug-in code.

However, it will not work as a plug-in because the code is incomplete. If you try to run it using the Debug button you will get an error beginning with:

error: unknown character name - "KP"
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45302
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: REQ: R1 MF ("Blue box") Tone Generator

Permanent link to this post Posted by Annabelle3985 » Wed Oct 28, 2015 7:09 pm

How's this?
You do not have the required permissions to view the files attached to this post.
Annabelle3985
 
Posts: 53
Joined: Sat Oct 24, 2015 1:17 am
Operating System: Windows 7

Re: REQ: R1 MF ("Blue box") Tone Generator

Permanent link to this post Posted by steve » Wed Oct 28, 2015 7:50 pm

Annabelle3985 wrote:How's this?

That's got rid of the spaces at the start of the lines.

Normally when writing LISP code (and Nyquist is a type of LISP code), some lines are indented by spaces so that the code is more readable (for sighted users). I realise that can be difficult, and of no benefit, if you can't see the code, so don't worry about indenting the code. If necessary I can add appropriate indentation for any plug-ins that we wish to upload to the Audacity wiki.

The code is still incomplete, so it still does not run. Specifically, in the first line of Nyquist code you have:

(setf low (if (member key

but "key" has not been defined. I'm guessing that "key" would be an input variable, but currently there are no input controls.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45302
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: REQ: R1 MF ("Blue box") Tone Generator

Permanent link to this post Posted by steve » Wed Oct 28, 2015 7:55 pm

By the way, I notice that there are error in the code that Robert posted earlier in this post: viewtopic.php?p=205709#p205709
To specify a character, the correct syntax is a hash symbol followed by a backslash followed by the character. For example, for the character "A" :
#\A

In several places the backslash is missing.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45302
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: REQ: R1 MF ("Blue box") Tone Generator

Permanent link to this post Posted by steve » Wed Oct 28, 2015 8:37 pm

Here is Robert's code with corrections:

Code: Select all
;; A test input:
(setf input "01 234 567 89")

;; the recursive function
(defun number-to-tone (num-stream &aux low-high dur)
  (setf current (pop num-stream))
  (unless current (return-from number-to-tone s))
  (setf dur (if (equal current #\>) 0.1 0.068))
  (setf low-high
        (case current
              (#\> '(1100 1700)); KP
              (#\< '(1500 1700)); ST
              (#\1 '(700 900))
              (#\2 '(700 1100))
              (#\3 '(900 1100))
              (#\4 '(700 1300))
              (#\5 '(900 1300))
              (#\6 '(1100 1300))
              (#\7 '(700 1500))
              (#\8 '(900 1500))
              (#\9 '(1100 1500))
              (#\0 '(1300 1500))
              (t nil)))
  (seq (number-to-tone num-stream)
       (if low-high
           (sim (osc (hz-to-step (first low-high)) dur)
                (osc (hz-to-step (second low-high)) dur)
                (s-rest 0.136))
           (s-rest 0))))

;;; Start of the main program
(setf *sr* *sound-srate*)
; initialize s to 0 length
(setf s (s-rest 0))

; String to chars
(setf numbers
      (cons #\<  ; append st
            (reverse (cons #\>  ; append kp
                     (get-output-stream-list
                        (make-string-input-stream input))))))

; Return sound
(abs-env (mult 0.4 (number-to-tone numbers)))



and for ease of downloading, here it is as a text file:
robert-r1mf-code.txt
You do not have the required permissions to view the files attached to this post.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45302
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

PreviousNext

Return to Nyquist



Who is online

Users browsing this forum: Bing [Bot] and 2 guests