I'm looking to write an 'Audio Frequency Shift Keying' (AFSK) encoder and decoder that could be used to transmit and receive data using radio/sound waves.
Bell 202 is the AFSK standard I'm trying to work from it encodes binary data into two tones 1200hz and 2200hz. These two tones stand in for the 1 and 0 in binary.
I'm trying to use win32-sound within ruby to generate those tones, which it does. The issue is that to switch between one tone and move to the other it takes about 1 second to complete which is far too slow for the 1200 baud speed that bell 202 is capable of operating at.
My question is: Is there any other method to create these tones and switch between them faster? Also while I'm here is there a gem that would allow me to decode those tones back into binary data?
I tried to write an AFSK modulator/demodulator in Ruby a while ago. I got a working prototype that could write and read WAV files but came nowhere near real time performance (I optimised it up to about 8x real time if I recall correctly).
Some tips: