Is there a software FSK encoder API for PC using no addtl hardware?

Started by Tomer August 27, 2003
Hi All,

We need an API module to allow us to send data using the FSK
(Frequency Shift Keying) modulation. This module is to run on a PC and
may use no additional hardware except for the built in sound card.

The module will allow us to convert ASCII characters to their FSK
sound and play that on the PC sound card.

The inputs to the module: a string of characters. 
The output of the module: FSK modulated audio emitted through the PC's
built in sound-card.

The output will be fed into a conventional FSK decoder to verify that
it has encoded the characters correctly.

Does anyone know if such a thing exists or do I have to code it up
myself?
Tomer wrote:
> > Hi All, > > We need an API module to allow us to send data using the FSK > (Frequency Shift Keying) modulation. This module is to run on a PC and > may use no additional hardware except for the built in sound card. > > The module will allow us to convert ASCII characters to their FSK > sound and play that on the PC sound card. > > The inputs to the module: a string of characters. > The output of the module: FSK modulated audio emitted through the PC's > built in sound-card. > > The output will be fed into a conventional FSK decoder to verify that > it has encoded the characters correctly. > > Does anyone know if such a thing exists or do I have to code it up > myself?
FSK what? FSK pretty much defines the layer-one, physical thingadoo being mussed about. Above that are any of a number of possibilities. A modem in 300 baud mode ( among others, for all I know ) will do this. Modems are even cheaper than soundcards. If you have to do it in software, it's pretty simple, given a couple of sampled wave files at the desired frequencies and just modulating them into.... what was that character format, again? -- Les Cargill
A "conventional FSK decoder"? Well, the commonest one these days would
be a GSM handset, wouldn't it? Is that what you mean? No? Perhaps you
should say what you really do mean.

Regards,
Steve


tomerp55@hotmail.com (Tomer) wrote in message
news:<11d3cf88.0308271133.4b62a45e@posting.google.com>...
 
> The output will be fed into a conventional FSK decoder to verify that > it has encoded the characters correctly. > > Does anyone know if such a thing exists or do I have to code it up > myself?
Vladimir Vassilevsky wrote:
> > Tomer wrote: > >>The transmission of the characters has to be at a rate of 520.83 bits >>per second. Mark frequency is 2083.3 Hz and space frequency is 1562.5 >>Hz. Mark and space time must be 1.92 milliseconds. >> > > Obviously mark is 4 times and space is 3 times bitrate, which allows for > very simple modulator and demodulator. But why such a weird bit rate?
If you take 24 hours in a day and 3600 seconds in an hour, then 45e6 bits per day works out to 520.83 bits per second. Now, why 45 million bits per day??? Patience, persistence, truth, Dr. mike -- Mike Rosing www.beastrider.com BeastRider, LLC SHARC debug tools
tomerp55@hotmail.com (Tomer) wrote in message
news:<11d3cf88.0308271133.4b62a45e@posting.google.com>...
> Hi All,
> Does anyone know if such a thing exists or do I have to code it up > myself?
Yes... ;-) Go to my site and look for Objective Real-Time Software on the ADSP21xx, online tutorial. It has a chapter on generating DTMF tones using a look-up table. You can use the same technique on a PC to generate arbitrary tones. Regarding FSK itself: There are many, many standards eg. Minimal Shift FSK, Dual Tone FSK, Multi Tone FSK, DTMF, RTTY and so on and many variations of each. So, you first have to read up a bit, then come back with a more specific question. Cheers, Herman http://www.AerospaceSoftware.com
Les Cargill <lcargill@worldnet.att.net> wrote in message
news:<3F4D1572.BEAB0607@worldnet.att.net>...
> Tomer wrote: > > > > Hi All, > > > > We need an API module to allow us to send data using the FSK > > (Frequency Shift Keying) modulation. This module is to run on a PC and > > may use no additional hardware except for the built in sound card. > > > > The module will allow us to convert ASCII characters to their FSK > > sound and play that on the PC sound card. > > > > The inputs to the module: a string of characters. > > The output of the module: FSK modulated audio emitted through the PC's > > built in sound-card. > > > > The output will be fed into a conventional FSK decoder to verify that > > it has encoded the characters correctly. > > > > Does anyone know if such a thing exists or do I have to code it up > > myself? > > FSK what? FSK pretty much defines the layer-one, physical thingadoo > being mussed about. Above that are any of a number of possibilities. > > A modem in 300 baud mode ( among others, for all I know ) will do > this. Modems are even cheaper than soundcards. > > If you have to do it in software, it's pretty simple, given a > couple of sampled wave files at the desired frequencies and > just modulating them into.... what was that character format, > again?
Thanks for your reply. Basically I guess I dont have all the information just yet. I do know that the FSK signal will have to adhere to the following criteria: The transmission of the characters has to be at a rate of 520.83 bits per second. Mark frequency is 2083.3 Hz and space frequency is 1562.5 Hz. Mark and space time must be 1.92 milliseconds. Characters are ASCII seven bit characters as defined in ANSI X3.4-1977 ending with an eighth null bit (either 1 or 0) to constitute a full eight-bit byte. Can I do all that on a PC soundcard with no additional hardware? I am missing a way to test that the signal I will output is correct since the target system is not available. However I thought I could find some device that will take in the FSK signal that the PC soundcard would produce and reproduce the characters. This way I will know my modulation is correct.
Thanks for your reply.

Basically, as I wrote in another reply on the group (and I will now
repeat myself just to make sure you get all the info), I do know that
the FSK signal will have to
adhere to the following criteria:

The transmission of the characters has to be at a rate of 520.83 bits
per second.  Mark frequency is 2083.3 Hz and space frequency is 1562.5
Hz.  Mark and space time must be 1.92 milliseconds.  Characters are
ASCII seven bit characters as defined in ANSI X3.4-1977 ending with an
eighth null bit (either 1 or 0) to constitute a full eight-bit byte.

Now, assuming I can do the above on a PC SoundCard, I will still have
to test my work. I am missing a way to test that the signal I will
output is correct
since the target system is not available. However I thought I could
find some device that will take in the FSK signal that the PC
soundcard would produce and reproduce the characters. This way I will
know my modulation is correct.

steveu@coppice.org (Steve Underwood) wrote in message
news:<80bddbd7.0308271716.7e002600@posting.google.com>...
> A "conventional FSK decoder"? Well, the commonest one these days
would
> be a GSM handset, wouldn't it? Is that what you mean? No? Perhaps you > should say what you really do mean. > > Regards, > Steve > > > tomerp55@hotmail.com (Tomer) wrote in message
news:<11d3cf88.0308271133.4b62a45e@posting.google.com>...
> > > The output will be fed into a conventional FSK decoder to verify that > > it has encoded the characters correctly. > > > > Does anyone know if such a thing exists or do I have to code it up > > myself?
Tomer wrote:
> > Les Cargill <lcargill@worldnet.att.net> wrote in message
news:<3F4D1572.BEAB0607@worldnet.att.net>...
> > Tomer wrote: > > > > > > Hi All, > > > > > > We need an API module to allow us to send data using the FSK > > > (Frequency Shift Keying) modulation. This module is to run on a PC
and
> > > may use no additional hardware except for the built in sound card. > > > > > > The module will allow us to convert ASCII characters to their FSK > > > sound and play that on the PC sound card. > > > > > > The inputs to the module: a string of characters. > > > The output of the module: FSK modulated audio emitted through the
PC's
> > > built in sound-card. > > > > > > The output will be fed into a conventional FSK decoder to verify
that
> > > it has encoded the characters correctly. > > > > > > Does anyone know if such a thing exists or do I have to code it up > > > myself? > > > > FSK what? FSK pretty much defines the layer-one, physical thingadoo > > being mussed about. Above that are any of a number of possibilities. > > > > A modem in 300 baud mode ( among others, for all I know ) will do > > this. Modems are even cheaper than soundcards. > > > > If you have to do it in software, it's pretty simple, given a > > couple of sampled wave files at the desired frequencies and > > just modulating them into.... what was that character format, > > again? > > Thanks for your reply. Basically I guess I dont have all the > information just yet. I do know that the FSK signal will have to > adhere to the following criteria: > > The transmission of the characters has to be at a rate of 520.83 bits > per second. Mark frequency is 2083.3 Hz and space frequency is 1562.5 > Hz.
So it's Dual Tone FSK.
> Mark and space time must be 1.92 milliseconds.
... which is extraordinarily close to (1/520.83) :)
> Characters are > ASCII seven bit characters as defined in ANSI X3.4-1977 ending with an > eighth null bit (either 1 or 0) to constitute a full eight-bit byte. >
Is the eighth bit a parity bit?
> Can I do all that on a PC soundcard with no additional hardware? >
I'd think so. I am not current on what sort of timer support Windows has, but you'll need sub-millisecond timer resolution. You might need DMA - depends. If you're conversant with Tcl, I'd look to the SNACK toolkit to see what sorta source code you can borrow from that.
> I am missing a way to test that the signal I will output is correct > since the target system is not available. However I thought I could > find some device that will take in the FSK signal that the PC > soundcard would produce and reproduce the characters. This way I will > know my modulation is correct.
Unless you have some other, objectively proven receiver for this, you'll need to develop it yourself. You can use something like CoolEdit to capture the actual .wav data, but that's in essence bit-by-bit verification. The part I'm muddled about is the actual tone recognition - telling mark from space. I'm not very DSP. Thinking further, you can use CoolEdit to generate a test signal, then run that against the receiver to test the receiver. Not to stress CoolEdit too hard, I just know it'll do what you need. -- Les Cargill

Tomer wrote:
> > The transmission of the characters has to be at a rate of 520.83 bits > per second. Mark frequency is 2083.3 Hz and space frequency is 1562.5 > Hz. Mark and space time must be 1.92 milliseconds.
Obviously mark is 4 times and space is 3 times bitrate, which allows for very simple modulator and demodulator. But why such a weird bit rate?
> Characters are > ASCII seven bit characters as defined in ANSI X3.4-1977 ending with an > eighth null bit (either 1 or 0) to constitute a full eight-bit byte. > Now, assuming I can do the above on a PC SoundCard, I will still have > to test my work. I am missing a way to test that the signal I will > output is correct.
You can easily modulate and demodulate this FSK with any microcontroller with comparator input. Or with PC soundcard if you like. This is a very simple task. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com

Les Cargill wrote:
> > > Can I do all that on a PC soundcard with no additional hardware? > I'd think so. I am not current on what sort of timer support > Windows has, but you'll need sub-millisecond timer resolution. > You might need DMA - depends.
The Win32 wave API takes care about all timing issues. The only drawback is the buffering delay which should be at least 100ms to get a reliable work. I didn't try Windows DirectSound or WDM API. It is declared that you can have the delay as low as 10ms in those modes. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
tomerp55@hotmail.com (Tomer) wrote in message
news:<11d3cf88.0308291008.570118dc@posting.google.com>...
> HermanZA8@netscape.net (Herman Oosthuysen) wrote in message
news:<25c456ac.0308281400.257e7800@posting.google.com>...
> > tomerp55@hotmail.com (Tomer) wrote in message
news:<11d3cf88.0308271133.4b62a45e@posting.google.com>...
> > > Hi All, > > > > Does anyone know if such a thing exists or do I have to code it up > > > myself? > > > > Regarding FSK itself: There are many, many standards eg. Minimal Shift > > FSK, Dual Tone FSK, Multi Tone FSK, DTMF, RTTY and so on and many > > variations of each. So, you first have to read up a bit, then come > > back with a more specific question. > > > > Cheers, > > > > Herman > > http://www.AerospaceSoftware.com > > Well here is as specific as it gets: > The transmission of the characters has to be at a rate of 520.83 bits > per second. Mark frequency is 2083.3 Hz and space frequency is 1562.5 > Hz. Mark and space time must be 1.92 milliseconds. Characters are > ASCII seven bit characters as defined in ANSI X3.4-1977 ending with an > eighth null bit (either 1 or 0) to constitute a full eight-bit byte. > > Sounds like a dual tone FSK to me... any ideas on how to do this in software?
Read this carefully and you'll get the idea: http://www.aerospacesoftware.com/dtmf.htm It is very simple to do. Yes, it is ADSP assembler, but that is easy to follow since it is C like. You just step through the table, get the samples and add them. Cheers, Herman

Tomer wrote:
> > > This actually isnt a school project, but rather a commercial project. > I am willing to pay a fair price for an existing well tested > implementation of the above FSK protocol, so I can concentrate of the > higher levels of the software that I need to implement.
I would be glad to help you with Windows based FSK encoder/decoder. Call (580)336-7949 or email vlv@abvolt.com
> This is a slow binary FSK - a nice project. > > There are PC audio oscilloscope software toys on the shareware sites. > You could use that to test your transmitter, using another PC as a > receiver. > What is not mentioned, is whether the FSK should be phase continuous > or not. If your professor did not specify that, then you could cut a > corner and record two WAV files, one for each tone and simply play > them to generate the FSK. Since the baud rate is so low, the signal > need not be phase continuous to be demodulated.
This actually isnt a school project, but rather a commercial project. I am willing to pay a fair price for an existing well tested implementation of the above FSK protocol, so I can concentrate of the higher levels of the software that I need to implement.
> > There are actually shareware floating around that does exactly that > too, for the purpose of DTMF teledialers. > > However, for better marks, I suggest that you look at my site and use > my example C code to make a phase continuous FSK transmitter.
I have looked at your site, but it seems to be low level ADSP code as opposed to PC code. I need something that will do the above on a PC sound card running windows. Thanks, Tomer
> > Cheers, > > Herman > http://www.AerospaceSoftware.com
HermanZA8@netscape.net (Herman Oosthuysen) wrote in message
news:<25c456ac.0308281400.257e7800@posting.google.com>...
> tomerp55@hotmail.com (Tomer) wrote in message
news:<11d3cf88.0308271133.4b62a45e@posting.google.com>...
> > Hi All, > > > Does anyone know if such a thing exists or do I have to code it up > > myself? > > Regarding FSK itself: There are many, many standards eg. Minimal Shift > FSK, Dual Tone FSK, Multi Tone FSK, DTMF, RTTY and so on and many > variations of each. So, you first have to read up a bit, then come > back with a more specific question. > > Cheers, > > Herman > http://www.AerospaceSoftware.com
Well here is as specific as it gets: The transmission of the characters has to be at a rate of 520.83 bits per second. Mark frequency is 2083.3 Hz and space frequency is 1562.5 Hz. Mark and space time must be 1.92 milliseconds. Characters are ASCII seven bit characters as defined in ANSI X3.4-1977 ending with an eighth null bit (either 1 or 0) to constitute a full eight-bit byte. Sounds like a dual tone FSK to me... any ideas on how to do this in software?

Mike Rosing wrote:
> > >>The transmission of the characters has to be at a rate of 520.83 bits > >>per second. Mark frequency is 2083.3 Hz and space frequency is 1562.5 > >>Hz. Mark and space time must be 1.92 milliseconds.
> > Obviously mark is 4 times and space is 3 times bitrate, which allows for > > very simple modulator and demodulator. But why such a weird bit rate? > > If you take 24 hours in a day and 3600 seconds in an hour, then 45e6 bits > per day works out to 520.83 bits per second. Now, why 45 million bits per > day???
Behold the greatest fundamental equation of nature: PI squared equals to the free fall acceleration on the Earth (in SI). However a lot of equipment supports the standard rates 300/600/1200 etc. Also the standard rates and frequencies can be derived from standard crystals. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Tomer wrote:
> > Vladimir Vassilevsky <vlv@abvolt.com> wrote in message
news:<3F4E931A.F2125669@abvolt.com>...
> > Les Cargill wrote: > > > > > > > Can I do all that on a PC soundcard with no additional
hardware?
> > > I'd think so. I am not current on what sort of timer support > > > Windows has, but you'll need sub-millisecond timer resolution. > > > You might need DMA - depends. > > > > The Win32 wave API takes care about all timing issues. The only drawback > > is the buffering delay which should be at least 100ms to get a reliable > > work. > > I didn't try Windows DirectSound or WDM API. It is declared that you can > > have the delay as low as 10ms in those modes. > > > > Vladimir Vassilevsky > > > > DSP and Mixed Signal Design Consultant > > > > http://www.abvolt.com > > Dont laugh, but will something like this work on a WinNT PC? (Beep is > a win32 api function): > > static char buff[]="ZCZC-CIV-SFW-12334"; > > //send the above buffer in FSK > void sendbuff_fsk() > { > //convert buffer to bits > int buffsize=sizeof(buff)/sizeof(char); > for (int j=0;j<buffsize;j++) { > char c=buff[j]; > for (int i=0;i<8;i++) { > if (c & (0x80>>i) ) { > Beep(2083,2); > } else { > Beep(1563,2); > } > } > } > } > > basically it converts the buffer to bits. if the bit is 1 it beeps > with a frequency of 2083 hz for 2ms. if it is 0, it beeps with > frequency of 1563 for 2 ms
I don't think you have enough timing resolution with that approach. -- Les Cargill
tomerp55@hotmail.com (Tomer) wrote in message
news:<11d3cf88.0308281412.75b0db00@posting.google.com>...
> Thanks for your reply. > > Basically, as I wrote in another reply on the group (and I will now > repeat myself just to make sure you get all the info), I do know that > the FSK signal will have to > adhere to the following criteria: > > The transmission of the characters has to be at a rate of 520.83 bits > per second. Mark frequency is 2083.3 Hz and space frequency is 1562.5 > Hz. Mark and space time must be 1.92 milliseconds. Characters are > ASCII seven bit characters as defined in ANSI X3.4-1977 ending with an > eighth null bit (either 1 or 0) to constitute a full eight-bit byte. > > Now, assuming I can do the above on a PC SoundCard, I will still have > to test my work. I am missing a way to test that the signal I will > output is correct > since the target system is not available. However I thought I could > find some device that will take in the FSK signal that the PC > soundcard would produce and reproduce the characters. This way I will > know my modulation is correct. >
This is a slow binary FSK - a nice project. There are PC audio oscilloscope software toys on the shareware sites. You could use that to test your transmitter, using another PC as a receiver. I would suggest that you also output a stream of data to a file and graph it using a spreadsheet, eg OpenOffice.org Calc. What is not mentioned, is whether the FSK should be phase continuous or not. If your professor did not specify that, then you could cut a corner and record two WAV files, one for each tone and simply play them to generate the FSK. Since the baud rate is so low, the signal need not be phase continuous to be demodulated. There are actually shareware floating around that does exactly that too, for the purpose of DTMF teledialers. However, for better marks, I suggest that you look at my site and use my example C code to make a phase continuous FSK transmitter. Cheers, Herman http://www.AerospaceSoftware.com

Tomer wrote:
> > > Dont laugh, but will something like this work on a WinNT PC? (Beep is > a win32 api function): > > static char buff[]="ZCZC-CIV-SFW-12334"; > > //send the above buffer in FSK > void sendbuff_fsk() > { > //convert buffer to bits > int buffsize=sizeof(buff)/sizeof(char); > for (int j=0;j<buffsize;j++) { > char c=buff[j]; > for (int i=0;i<8;i++) { > if (c & (0x80>>i) ) { > Beep(2083,2); > } else { > Beep(1563,2); > } > } > } > } > > basically it converts the buffer to bits. if the bit is 1 it beeps > with a frequency of 2083 hz for 2ms. if it is 0, it beeps with > frequency of 1563 for 2 ms
I don't think that will work well because it takes some arbitrary time to start every Beep(). Also the transition from Beep(2083,) to Beep(1563,) is not going to be continuos phase. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Vladimir Vassilevsky <vlv@abvolt.com> wrote in message
news:<3F4E931A.F2125669@abvolt.com>...
> Les Cargill wrote: > > > > > Can I do all that on a PC soundcard with no additional hardware? > > I'd think so. I am not current on what sort of timer support > > Windows has, but you'll need sub-millisecond timer resolution. > > You might need DMA - depends. > > The Win32 wave API takes care about all timing issues. The only drawback > is the buffering delay which should be at least 100ms to get a reliable > work. > I didn't try Windows DirectSound or WDM API. It is declared that you can > have the delay as low as 10ms in those modes. > > Vladimir Vassilevsky > > DSP and Mixed Signal Design Consultant > > http://www.abvolt.com
Dont laugh, but will something like this work on a WinNT PC? (Beep is a win32 api function): static char buff[]="ZCZC-CIV-SFW-12334"; //send the above buffer in FSK void sendbuff_fsk() { //convert buffer to bits int buffsize=sizeof(buff)/sizeof(char); for (int j=0;j<buffsize;j++) { char c=buff[j]; for (int i=0;i<8;i++) { if (c & (0x80>>i) ) { Beep(2083,2); } else { Beep(1563,2); } } } } basically it converts the buffer to bits. if the bit is 1 it beeps with a frequency of 2083 hz for 2ms. if it is 0, it beeps with frequency of 1563 for 2 ms

Les Cargill wrote:
> > > Can I do all that on a PC soundcard with no additional hardware? > I'd think so. I am not current on what sort of timer support > Windows has, but you'll need sub-millisecond timer resolution. > You might need DMA - depends.
The Win32 wave API takes care about all timing issues. The only drawback is the buffering delay which should be at least 100ms to get a reliable work. I didn't try Windows DirectSound or WDM API. It is declared that you can have the delay as low as 10ms in those modes. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com