AFSK generator?

9/14/16 edit: (trying to find a good place to put this)…, Since Nyquist and audacity are known for its wonderful waveform generators such as the DTMF, tone, as well has the handy dandy Nyquist prompt, was just wondering if anyone could give some programming via an Audio frequency shift keying (such as used in packet radio and such)

there are any options of doing so, but the two below are the most common ways to do it.
1st option:

  1. with varying frequency boxes for each of the binary 1s and 0s (mark and spaces),
  2. The frequencies can have various cycles per shift
  3. and the 1s and 0s can be put into an endless scrolling text box, entering as many as you want which can generate the AFSK tones at those desired frequencies.
  4. There should also be an option of gaussian filtering, which can make transistions smoother between shifts, and remove harmonics.

2nd option:
Or, since AFSK is generated traditonally via a binary pulse coded wave, modulated a bit, with some amplitude cutting or whatever the causes, can also generate AFSK tones. This means the resulting waveform is modulated via a modem, making it much easier.

ill try to provide pictures for option 1, as long as my computer can co-operate with displaying them in these forums.

Finally, since I seem all over the place, i’m trying to be as directive as I can on this so it makes sense.

NOTE: I am using LISP for this one, not SAL.

Audacity has a DTMF generator included: http://manual.audacityteam.org/o/man/generate_menu.html#dtmf

DTMF I know that. Ive used that plenty of times for experimentation. It actually creates a similar spectrum even though the frequencies are different, and there are less peaks throughout the higher harmonics.

In case you’ve not noticed, I know little about FSK :wink:
One of these Nyquist generators could be a good place to start: http://wiki.audacityteam.org/wiki/Nyquist_Generate_Plug-ins#DTMF_Tones_.28random.29

AFSK stands for audio frequency shift keying, which uses audio tones at two different frequencies to be sent via a radio link for decoding as a message. Think of packet radio on 144.39 MHz in the US. That type of modulation is Bell 202 AFSK 1200 baud.

There are many types that are used throughout all the RF bands, all at different baud rates and shifts.

There’s also MFSK (multiple frequency, similar to DTMF you were talking about)

The baud rate is how many bits per second that the resulting waveform is transmitting at.

Like I’ve said in the beginning post, (last edited 8/14/2016) ther are many options for generating these types. (which I know youve listed below already).

The DTMF randomizer is also very cool, sometimes even randomized dtmf can bring up some odd numbers or words depending on which decoder you have, (not sure which ones would work) but it might be cool to recognize it.

It sounds like it should be possible (though arduous) to generate the type of tones you require using the built-in functions in Audacity (tone generator, speed change effect, etc.)
If that is possible, then I’d expect that it could be done in a Nyquist script. Can it be done ‘manually’? If so, could you give step by step instructions, including a short example WAV file to illustrate the end result, then I’ll know what the Nyquist script needs to do.

8/14/2016: It is very hard to do traditionally, but there are simple ways of doing it tradtionally through the arduous way. One of them is, and is usually done by me

  1. Type any binary number format in Some text document either in notepad or some other word program
  2. open audacity
  3. window audacity and stretch it to be narrow horizontally (this would make it be a narrow horizontal window)
  4. Stretch the text document that was just filled with the numbers, stretching it to be a reasonable width, narrow it like the audacity window
  5. Look carefully at the beginning binary number
  6. Generate an audio tone for the binary 1 or 0, at a reasonable SAMPLE amount, use samples because that way it will be more efficient at higher baud rates, (ex, (1200 baud)for a 48000 hz binary 1, should be a 1200 hz sine wave at 40 samples), and a binary 0, (66 samples for one binary 0). Just make sure its a reasonable sample rate, and a sample amount to match an entire cycle.
  7. it can be very stressful at first, but it could get a bit faster afterwords, it might take even longer just for the string of binary numbers to completely be “encoded”, or generated the right way.

So what are the steps?

I’m willing to help you with Nyquist coding, but I don’t have the time or inclination to do the “legwork” :wink:

POST NEEDS DELETING…

here’s one of the ways ive been doing it, its simple but take longer:

For help uploading images to the forum, see: https://forum.audacityteam.org/t/how-to-attach-files-to-forum-posts/24026/1

I actually sent this photo as an email attachment, it shows on my PC, but if it doesnt on yours then ill try the alternate routes through the forum post you posted here instead. Plus this photo is very large, about 1600*1200 to be exact, so it might not show the entire thing.

I did start a bit of the coding, from a file shown below from the describing, (which for me is easy peasy, surprisingly)

I am going to modify the code from the “ringmod.ny”, since it uses audio tones to create a ringing tone, which of course would use similar formatting if a binary stream were to be implemented. I could also copy and paste some code via the DTMF.ny file that I also downloaded, (which I should have a long time ago), to get the “Binary text box” going.

I am going to need a bit of help with some, not all, of the coding involved, or some help for me to create the code necessary, so as to make it a lot less of a hassle for Roger, “Kini Hemanth” (one of Rogers students) and you, steve. Remember this is from two files I am going to modify, so no “new file” is to be created from scratch. Hopefully this will resolve all problems, the “smart” way.

Finally references catch up with my analysis.

I hope this resolves most of the stupidity problems i’m facing with this plugin.

I’ve uploaded a new version of dtmf.ny on the Audacity wiki: Missing features - Audacity Support

It is functionally identical to the original, but the code is less repetitive and hopefully more readable (easier to work out how what it is doing and how it works).

Something that I noticed when uploading it is that there is a bug/limitation in MediaWiki (the wiki software), in that it insists on capitalizing the first letter of file names. The convention for XLISP / Nyquist files is that file names should be lower case. Unfortunately in Audacity we currently disregard that convention, so you will need to be a bit careful when updating files if you want to avoid duplicate effects. Audacity will see “ThisFile.ny” and “thisfile.ny” and “THISFILE.NY” as three separate files / plug-ins. By convention, the correct name should be “thisfile.ny” (all lower case).

Usually most plugins I download do contain some capital letters, so of course, I will try to name it “afskgenerate.ny”

Ive never seen a function for a binary bit stream, whereas, such as binary numbers are used in lisp/sal functions. Might need to define or not. I’ll look at the DTMF random file to see what it looks like.

Problem is with randomness, its just random, with no text box, lest if there is one.

Entering numbers require a text box of some sort.

Plus im gonna have to add a Gaussian filter somehow, that I know there is a function somewhere around there

You could read “1’s” and “0’s” with something like this:

;control inputstring "Enter binary data as 1's and 0's" string "" "101"

(setf outputstring "")  ;an empty string

(dotimes (i (length inputstring) outputstring)
  (cond
    ((char= (char inputstring i) #\1)
      (setf outputstring (format nil "~atrue, " outputstring)))
    ((char= (char inputstring i) #\0)
      (setf outputstring (format nil "~afalse, " outputstring)))))

I think this example is pretty straightforward, but let me know if you need some explanation.

9/14/16 7:43PM EDT, UPDATE, still not reading nils. If its not in the list its not going to read. and throw error :bad argument type “NIL”

The “space” character is already defined in Nyquist.
Example, if you want to use spaces instead of “0’s” in the previous code that I posted, replace #\0 with #\Space
The "#" indicates that it is a “character” (which is a different data type to a “string”).
To represent a “string” value, you simply enclose the string in double quotes.

Example:

(setf test #\space)
(cond
  ((characterp test) (format nil "\"~a\" is a character" test))
  ((stringp test) (format nil  "\"~a\" is a string" test))
  ( T (format nil  "\"~a\" is neither a character or a string" test)))



(setf test " ")
(cond
  ((characterp test) (format nil "\"~a\" is a character" test))
  ((stringp test) (format nil  "\"~a\" is a string" test))
  ( T (format nil  "\"~a\" is neither a character or a string" test)))



(setf test 'x )
(cond
  ((characterp test) (format nil "\"~a\" is a character" test))
  ((stringp test) (format nil  "\"~a\" is a string" test))
  ( T (format nil  "\"~a\" is neither a character or a string" test)))

This is very badly coded, but I thought you might find it interesting / useful.
I has a quick play with this AFSK example from Wikipedia:
Audio sample: https://upload.wikimedia.org/wikipedia/commons/2/27/AFSK_1200_baud.ogg
Web page: https://en.wikipedia.org/wiki/Frequency-shift_keying

Here’s the (bad) example decoder:

(clip
  (sum -0.5
    (s-max 0.5
          (mult 8
                (lowpass8 (mult (highpass2 *track* 1200)
                                 *track*)
                          1200))))
  0.8)

and a zoomed in screenshot of the output:
firsttrack001.png

Man I need to learn my coding better.

I still have yet to master nyquist and its functions, ill try to use what you are using.

Since demodulation is required, its also nice you provided the “pulse coded” waveform that is the demodulated raw data.

Note, for you SP users, this plugin is not being used to send messages via “Packet radio” or anything like that, it is experimental, unless if you want to send a randomized-baud rate AFSK with varying frequencies. Which could unfortunately, take a while, SP users.

The AFSK 1200 baud is the more common one used throughout the radio spectra.

I still have a long way to go. The ringmod seemed a bit helpful, but saw almost no use for it.