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 steve » Mon Sep 19, 2016 7:12 am

weldo5 wrote:Thus only leaving minimum maximum for the two inputs.

That's where it goes wrong. A "string input" widget does not use minimum / maximum vales. A "string input" widget is for inputting text - the variable is set to the value of the entered text. It does not make sense to have max/min values - what if the user entered "yellow frog" as the input text? It makes to sense to ask if the string literal "yellow frog" is greater than 600 and less than 6000.

In this documentation: http://wiki.audacityteam.org/wiki/Nyqui ... put_Widget
Code: Select all
;control variable-name "text-left" string "text-right" "initial-string"

Notice there is no minimum or maximum value. The final parameter sets the initial value.

If you want a widget for inputting numeric data, then you need to use one of the numeric widgets, either an integer (whole numbers) or float (floating point) input widget. The documentation is on the same page: http://wiki.audacityteam.org/wiki/Nyqui ... in_Widgets
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 46969
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 10:21 am

I'm going to use floats since that seems more useful. 32 bit floats seem to describe the waveform a bit better, and could actually generate "it".

Now, on to others, since I don't want to create any more hassle, the programming for Nils is unreadable(in the binary programming), something else must be used, Because the debugger says it's an invalid argument type. It's not readable, and all it does is just generate a rather odd ended curve, even when multiple numbers are used.


**Which was why I said I haven't programmed in a while. A good 4 months out of the school, just after graduation, seems to be getting in the way of programming plans. I know Nyquist is very simple to program. Just difficult to master.
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 » Mon Sep 19, 2016 12:02 pm

weldo5 wrote:the programming for Nils is unreadable (in the binary programming)

What do you mean? What are "Nils" ?
What "binary programming"?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 46969
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 6:20 pm

I want to have somebody else in this forum explain what I'm talking about to you because obviously, the code I posted in previous posts, (maybe pg 2 or 3 of this topic)were edited for making more sense. And provided some explanation via how the debugger is reading that the format that the two strings (inputstring and outputstring) ex: #\0 and #\1, were formatted as:

NILs, not in the list, or invalid characters. They are ignored by Nyquist usually, and I think I said that at least a good 3 times in some previous posts. The debugger said it was an invalid argument type. If I edited those posts, than contradiction possible here.

You even said that in the decoder that it was "bad", when clearly it decoded the raw bits. Contradiction there?

Your code was usable, it just has errors in it. Strings print out characters in outputs, and the float prints out 32 bit floats, which I'm going to use instead of strings. String just being readable text as long as in quotations.
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 » Mon Sep 19, 2016 6:35 pm

weldo5 wrote:I want to have somebody else in this forum explain what I'm talking about to you because obviously, the code I posted in previous posts, (maybe pg 2 or 3 of this topic)were edited for making more sense

OK, I'll leave this for someone else to reply to, though you may be waiting a while as there are not many Nyquist experts on the forum.

weldo5 wrote:Your code was usable, it just has errors in it.

I doubt it, but please feel free to point out the errors.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 46969
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: AFSK generator?

Permanent link to this post Posted by Robert J. H. » Mon Sep 19, 2016 10:31 pm

weldo5 wrote:I want to have somebody else in this forum explain what I'm talking about to you because obviously, the code I posted in previous posts, (maybe pg 2 or 3 of this topic)were edited for making more sense. And provided some explanation via how the debugger is reading that the format that the two strings (inputstring and outputstring) ex: #\0 and #\1, were formatted as:

NILs, not in the list, or invalid characters. They are ignored by Nyquist usually, and I think I said that at least a good 3 times in some previous posts. The debugger said it was an invalid argument type. If I edited those posts, than contradiction possible here.

You even said that in the decoder that it was "bad", when clearly it decoded the raw bits. Contradiction there?

Your code was usable, it just has errors in it. Strings print out characters in outputs, and the float prints out 32 bit floats, which I'm going to use instead of strings. String just being readable text as long as in quotations.


Perhaps I'm as dumb as Steve (sorry old man) :Grin:

I can't see the actual problem, I have to admit.
Am I right that the input is a string with just zeros and ones?
I presume that you want them to be rendered into another format type and store them e.g. in an array (vector) or list.
That is really not hard to do but there may be too much possibilities to do it...
- Firstly, you could convert the string into a stream object and convert it to a list with characters.

Something like that:
Code: Select all
;nyquist plug-in
;version 4
;type generate
;control input "Binary Serie" string "" "10110110abc"
(setq out (make-string-output-stream))
(format out input)
(setf output (get-output-stream-list out))
(setf output (remove-if-not #'(lambda (x) (member x '(#\0 #\1))) output))
(format nil "~a" output)


Note how only zeros and ones are remaining.

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 » Mon Sep 19, 2016 11:58 pm

It was originally a stream of strings yes, and you are right about having way too many options for creating a stream of numbers such as binary.
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. » Tue Sep 20, 2016 3:13 pm

weldo5 wrote:It was originally a stream of strings yes, and you are right about having way too many options for creating a stream of numbers such as binary.


Let's summarize the purpose of your plug-in before going on:
The GUI should display:
1. text box for the message
2. mark frequency
3. space frequency
4. baud
5. (optionally) type of FSK

I think the message should be entered as text and not as individual zeros and ones.
This means that we would translate the ASCII characters into integer numbers, then in bytes and finally into individual bits--the symbols as you call it.

AFSK seems to shift between two frequencies, ie we will have a sine tone whose pitch alters. The baud rate determines how long a symbol is, e.g. 1200 symbols per second.
Let's assume that a mark has 4 cycles and a space 3. Then, the mark frequency would be 4800 Hz and the space frequency 3600 Hz.
A start phase of 0 ° would always result in clean transitions without clicks, am I wrong?
This is at least the case if we replace the previously found binary sequence with the appropriate waveforms for a symbol (3 or for cycles of the required frequency).
It is possible to use frequency modulation directly and one gives a modulation index for the mark frequency.

Anyway, so far we do not have any harmonics in the waveform, as far as I can see and there isn't the necessity for a gauss filter either.

There are the functions "sampler" and "siosc" which could probably be used to create the wave form--although I'd use the direct way of appending symbols sequentially.

So, where do you want to go from here?

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 » Tue Sep 20, 2016 3:50 pm

Now mentioned, I think translating them to ASCII characters seems easier. I did think about that before posting this on here..

remember, this plugin also needs to have various Baud (bits/sec) rates too, various cycles for marks and spaces, and various frequencies for the mark and spaces (Steve described this part I think somewhere as integers)There are ways to make that possible, just need the right coding. the "#\" in that context does stands for an ASCII character, in Nyquist readtable functions. Steve did use it for the two 0s and 1s, which I should have found out but deleted and ignored completely ,(sorry Steve) The box can be a bit larger than normal so as to make more room for text.

Phase at 0° (phase-continuous) is usually the default waveform, before the gaussian filter is applied. Usually 1200 Baud AFSK is using 1200 hz and 2200hz (but is actually using 1 mark, 2 spaces, between shifts, hence bell 202 modem, and the usage of the g.f.

Il try what seems simpler.

I'll use that and see what happens.

I'm just fixing and debugging code to see what fits in this convolved recursive plugin.
Last edited by weldo5 on Wed Sep 21, 2016 12:14 am, edited 1 time in total.
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. » Tue Sep 20, 2016 10:15 pm

OK, based on my previous code, we have the following:
- message (text) as input box (it's not resizeable btw)
- is converted to ASCII code
- then to bits

The output you'll see is the bit stream as a list of integers.
Code: Select all
;nyquist plug-in
;version 4
;type process
;control message "Message" string "" "Hello"
(setq out (make-string-output-stream))
(format out message)
;
(defun dec2bin (x)
  (do ((i 8 (1- i)) (x x (/ x 2))
       (bits nil (cons (logand x 1) bits)))
      ((zerop i) bits)))
;;;
(setf output (get-output-stream-list out)); string to characters
(setf output (mapcar 'char-int output)); characters to ASCII code
(setf output (apply 'nconc (mapcar #'dec2bin output))); ...and to list of bits
; send to *standard-output*
(format nil "~a" output)


You can now put the frequency/baud controls into it as well.
Optionally, you can have a choice box where you can choose between message as text or as bit stream.

I'm not 100 % sure about the modulation itself.

Either creating a sequence of waveforms or a pulse train that modulates the carrier.
It depends on the sample rate and the other parameters, I guess.
For instance, the standard uses 1200 and 2200 Hz and they do not fit into a sample rate of 44100.
We can overcome this by oversampling and the factor is:
Code: Select all
(/ 1200 (gcd (truncate *sound-srate*) 1200))

= 4 for a sample rate of 44.1 kHz.

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

PreviousNext

Return to Nyquist



Who is online

Users browsing this forum: No registered users and 1 guest