AFSK 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: AFSK generator?

Permanent link to this post Posted by weldo5 » Sat Sep 10, 2016 2:19 am

I cant seem to find a text box function in the DTMF.ny, the built in plugin provides one with the ability for just "typing" the letters/numbers, without spaces.
Does the text boxes have to be tables or whatever? I know there is some way to add text boxes in the prompt somehow..
weldo5
 
Posts: 52
Joined: Fri Nov 15, 2013 10:18 pm
Operating System: Windows 10

Re: AFSK generator?

Permanent link to this post Posted by Robert J. H. » Sat Sep 10, 2016 3:19 am

Do you need that?
Code: Select all
;; gauss-filter
(setf sigma 3.0)
(setf width 11)
(setf impulse-response
(do ((ir (make-array width)) (sum 0) (n 0 (1+ n)) (x (- 0 (/ (1- width) 2.0)) (+ x 1.0)))
((>= x (/ width 2.0)) (mult (/ 1.0 sum) (snd-from-array 0 *sound-srate* ir)))
(setf sum (+ sum
(setf (aref ir n) (* (/ 1.0 (sqrt (* 2 pi))) sigma 
(exp (- (/ (expt x 2.0) (* 2.0 (expt sigma 2.0)))))))))))
;; apply to track
(convolve *track* impulse-response)


Sorry, it isn't formatted...
Normally, it would go into a function and the kernel of the filter returned--or the filtered pulse train.
I think I took the DC gain for normalization but it can be changed to e.g. the highest sample=1.

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

Re: AFSK generator?

Permanent link to this post Posted by weldo5 » Sat Sep 10, 2016 3:26 am

God once again need to learn my code... Thank you so much!

Not to go off-topic, you seem to have my dad's first name and middle initial. A good reference.

Gaussian filters will once again make transitions to the shifts more smoother, and will actually create hidden harmonics.

I'll copy and paste these codings tomorrow. Need to bed.
weldo5
 
Posts: 52
Joined: Fri Nov 15, 2013 10:18 pm
Operating System: Windows 10

Re: AFSK generator?

Permanent link to this post Posted by Robert J. H. » Sat Sep 10, 2016 6:12 am

weldo5 wrote:God once again need to learn my code... Thank you so much!

Not to go off-topic, you seem to have my dad's first name and middle initial. A good reference.

The J stands for John. A combination of the first names of my grandpas. Although I believe Mom choose Robert because of Robert Mitchum or another actor...

weldo5 wrote:Gaussian filters will once again make transitions to the shifts more smoother, and will actually create hidden harmonics.

I'll copy and paste these codings tomorrow. Need to bed.


I've not followed this topic intensively. The Gauss filter is just a low pass with some nice properties and should actually remove harmonics. If I don't err, it is used in order to reduce the total energy for broadcasting.
The Gauss is also one of the few wave forms that have the same shape in time and frequency domain--a bell.

It seems to work (tested with audio, with sigma 10 and width 1001).

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

Re: AFSK generator?

Permanent link to this post Posted by steve » Sat Sep 10, 2016 8:33 am

weldo5 wrote:I cant seem to find a text box function in the DTMF.ny, the built in plugin provides one with the ability for just "typing" the letters/numbers, without spaces.
Does the text boxes have to be tables or whatever? I know there is some way to add text boxes in the prompt somehow..

In Nyquist plug-ins, the Nyquist programming language provides the processing functions, but it is Audacity (not Nyquist) that creates the graphical interface (if the plug-in has an interface). When writing a Nyquist plug-in, you use "header" commands to tell Audacity that the file is a Nyquist plug-in, what type of plug-in it is, what version of Nyquist plug-in, and what controls ("widgets") you require (if any) in the interface.

"Header" commands always start with one semicolon. The semicolon is the "comment" character in Nyquist, which tells Nyquist to ignore the rest of that line. When Audacity loads a Nyquist plug-in, it looks at all of the "commented" lines to see if they are header commands. After reading all of the header commands, Audacity creates the necessary interface and runs the Nyquist code.

For example:

Code: Select all
;This line is a comment.
;;;This line is also a comment.
;The next line is a header command that tells Audacity to make a text input widget
;control variablename "Text to display before the text box" string "Text after" "Default input"


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

Re: AFSK generator?

Permanent link to this post Posted by weldo5 » Sun Sep 18, 2016 7:34 pm

The compiler does not read nil's (not in the list) types of formats, as they are ignored by nyquist fully, so basically, it is not reading the 1s and 0s because they are nils. But I could test the space "test" function that steve provided.
I have tried using some other types of formats of strings such as *standard-input*, and others, but those dont seem to work either. I did however manage to get one of the frequency inputs within the function, but is only changeable in the file. The other frequency was ignored, but programmed the same way as the other.

Code: Select all
(read [10 [, 1 [, 0]]])


But if it reads that, then it gives out "true, false" in the output function. instead of "10". It could output that if that extra code, wasnt there. but it sounds like with that extra code it should read it.

I actually found a much simpler way to generate a binary stream via a readtable macro:
[code]
#b<> ==/code]
It would be much easier to define the mark and space as "symbols", as that is what they are defined as and is what I should have mentioned earlier.

I did however manage to get one of the frequency inputs within the function, but is only changeable in the file, and is only treated as a string. The other frequency was ignored, but programmed the same way as the other.
Attachments
prompt1.PNG
prompt1.PNG (6.3 KiB) Viewed 982 times
weldo5
 
Posts: 52
Joined: Fri Nov 15, 2013 10:18 pm
Operating System: Windows 10

Re: AFSK generator?

Permanent link to this post Posted by steve » Sun Sep 18, 2016 10:16 pm

Is there a question in your last post?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 46985
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: AFSK generator?

Permanent link to this post Posted by weldo5 » Sun Sep 18, 2016 11:29 pm

Are you talking about this one, or are you referring to another post I made?

I did find a LOT of useful functions, and I tried coding them as best as I could, I also added a frequency range to both the mark/space, and they surprisingly showed up.

Ill show the code I currently have in my file, via some of the text itself. And a photo of the generator itself.

All im doing is analyzing and modifying to fit this plugin. And ive made some headway.

I did have a question regarding how it generates. It does not output to the waveform, instead it outputs the numbers themselves to the output prompt, and it says in the debugger its not reading the NIL argument type. Any reasons there? I did want to do it with 2 mins of silence, to see if I could get the exact samples.

CODE BELOW:

For the mark/space frequency ranges:
Code: Select all
;control variablename "mark" string "frequency"  60, 6000
;control variablename "space" string "frequency"  60, 6000


For the samples provider, because in samples it seems "easier" (for me at least), exact periods:
Code: Select all
(snd-samples mark 40, 8000)

  (snd-samples space 44, 8800)
for some reason it does not appear.

For the "modified" binary generator:

;control inputstring "Enter binary to modulate" string "space" "101"

Code: Select all
(setf outputstring "space")

(dotimes (i (length inputstring) outputstring)
  (cond
    ((char= (char inputstring i) #b1)
      (setf outputstring (format nil "~atrue, " outputstring)))
    ((char= (char inputstring i) #b0)
      (setf outputstring (format nil "~afalse, " outputstring)))))


There needs to be another format type other than nil, its non readable, and its invalid.
weldo5
 
Posts: 52
Joined: Fri Nov 15, 2013 10:18 pm
Operating System: Windows 10

Re: AFSK generator?

Permanent link to this post Posted by steve » Sun Sep 18, 2016 11:49 pm

weldo5 wrote:For the mark/space frequency ranges:

Code: Select all
;control variablename "mark" string "frequency" 60, 6000
;control variablename "space" string "frequency" 60, 6000


Firstly that code is wrong.
The correct syntax for a string input widget is given in the documentation: http://wiki.audacityteam.org/wiki/Nyqui ... put_Widget

Do you understand what a "variable" is in computer programming?
You have used "variablename" twice. If your code did work, then first line of your code tells Audacity to set the variable which you have called "variablename" to a value selected by the user, then the second line tells Audacity to set the same variable to a value. To be able to use two string input controls, you must use a different, unique name for each of the variables.

For example (try running this in the Nyquist Prompt, and be sure to enter this code exactly as shown here):
Code: Select all
;control hz "First string" string "frequency" "ABC"
;control fred "Second string" string "frequency" "123"
;control mychoice "Select which string to display" choice "First string,Second string" 0

(if (= mychoice 0)
    (print hz)
    (print fred))
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 46985
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: AFSK generator?

Permanent link to this post Posted by weldo5 » Mon Sep 19, 2016 12:45 am

Im using verison 4, along with audacity 2.1.x type of software. And, steve, I did look at that exact section before you posted the link to that section of nyquist headers. And I know what a variable is, I just havent done programming in a while and need to get used to it again.
A type of object notable to change/adaptation.

The "initial-value" was opted out for simplicity for the future verisons of audacity, 2.1.x type, which is what im using. Thus only leaving minimum maximum for the two inputs.

If this code is wrong once again (hopefully, not get frustrated) ill use the prompt to generate the "practice strings". Note, i'm still testing it! I also don't have a visualizer for coding like visual studio to analyze and fix the "errors" before putting in audacity.
Code: Select all
;control variable "mark" string "frequency"  300 4500
;control  variable-name "space" string "frequency"  300 9000


and the other one relating to samples

Code: Select all
  (snd-samples mark 40 8000)

  (snd-samples space 44 8800)


If you want steve, you can see the file yourself, ill send it to you in a message or something like that.
weldo5
 
Posts: 52
Joined: Fri Nov 15, 2013 10:18 pm
Operating System: Windows 10

PreviousNext

Return to Nyquist



Who is online

Users browsing this forum: No registered users and 4 guests