For fun and work I've to implement a java based application that can Encode text or data to sound and transmit using PC's speaker and on the receiving side is a microphone with decoder software.

I was thinking of using FSK (syn or async or suggest) for the implementation:

Text (data) ---modulate---> 10khz-20khz audio carrier wave ---> Over the air transmission ---> microphone -> demodulate ---> Display text or data.

My main considerations are:

  • ~200bps bandwidth if not more
  • resilient to noise upto certain level
  • preferably 16khz - 20khz carrier wave with 44.1khz sampling (there's less noise in this area and its not really audible to older people and mics, speakers are cheap, readily available in laptops)
  • Not too complex coding logic.

What Modulation would work best with least coding efforts? Any recommendations on libraries/samples for achieving FSK/BFSK/PSK or DSSS using java?

  • 3
    $\begingroup$ You could just use one of the old modem standards, e.g. V21 which was very simple, 300 baud, full duplex. There should be plenty of documentation and source code out there. You can shift the baseband up to 17 kHz using mixing if needed. $\endgroup$
    – Paul R
    Feb 1, 2013 at 11:28
  • 1
    $\begingroup$ Careful with pushing the carrier frequency too high. Most commercial acoustic devices start to have frequency response characteristics that are not well defined as you approach 20Khz. For some devices, 16Khz may be a challenge. Is is acceptable for your scheme to have a parameter that sets the carrier frequency / band? $\endgroup$
    – user2718
    Feb 1, 2013 at 23:06
  • 1
    $\begingroup$ To add to @PaulR 's comment, you can take a spec like V21 and adapt it to match your chosen carrier frequency range. If you want to pursue that, I'm sure there is enough expertise on this site to help with the adaptation. $\endgroup$
    – user2718
    Feb 1, 2013 at 23:09
  • $\begingroup$ @PaulR Can you give me an example implementation in java? $\endgroup$
    – geeknizer
    Feb 3, 2013 at 18:28
  • 1
    $\begingroup$ Sure - just give me a few days to write it for you... $\endgroup$
    – Paul R
    Feb 3, 2013 at 19:51

2 Answers 2


This is actually a really tough problem because of the channel characteristics. Most computer speakers have fairly limited bandwidth, have significant non-linearities and the room acoustics are often time variant.

Life becomes A LOT easier if you can just run a cable from the headphone output of one PC into the line input of the other.

  • 2
    $\begingroup$ I've been working on a very similar communication scheme: audio fsk modulation/demodulation and I've just found a linux audio modem implementation using fsk. This sw can reach 300 and 1200 baud using the audio channel as commucation link between two pc and fsk. It could be a very good starting point (my implementation fairly reaches 200 baud in a noisy environment using frequencies around 500-4000 Hz for issues related to frequency response of pc audio devices). link $\endgroup$
    – Yozek
    Feb 2, 2013 at 19:59
  • $\begingroup$ @Yozek can you point me to that source code? $\endgroup$
    – geeknizer
    Feb 3, 2013 at 18:27
  • 1
    $\begingroup$ The url for the minimodem implementation is here: whence.com/minimodem/minimodem-0.16.1.tar.gz I'm still working on a personal simple implementation of AFSK in java and objective-C, but I'm having some troubles with ambiental/background noise and low transmission rate limit: about 100/200 baud (or bit/sec), not very much at all. But I don't know if the cause is a practical/physiological limitation or it's a my 'not so smart enough implementation' problem. I think the second one... $\endgroup$
    – Yozek
    Feb 3, 2013 at 19:27

Yes you should definitely use FSK but it has to asynchronical and here is why. Demodulating FSK synchronically is called coherent demodulation. Demodulating FSK coherently requires incoming carrier phase locking (phase synchronization), which is normally done with Phase lock Loops (PLL) which don´t work well unless you have a Signal to Noise Ratio (SNR) of at least 10 dB or so. Normally audio broadcast doesn´t have such a high SNR, so forget about coherent demodulation. Besides in practice with electromagnetic signals the noncoherent FSK requires, atmost, only 1 dB more Eb/No than that for coherent FSK for Pb ≤ 10−4 (this means that for obtaining the same bit error probability Pb you only need to transmit an extra dB of power in each bit). Yet the noncoherent FSK demodulator is considerably easier to build since coherent reference signals need not be generated. Therefore in practical systems almost all of the FSK receivers use noncoherent demodulation because everyone prefers transmitting an extra dB of power instead of getting in all that sync problems.

Answering to your main considerations:

200bps bandwidth if not more: I've achieved 200 bps using a continious phase orthogonal carriers 8fsk, setting the smartphone 1 m away from the speaker.

Resilient to noise upto certain level: I've implemented a BCH error correcting code, with the ability to repair up to 8 error per data block. BCH codes have their biggest coding gains when there is a 25 to 50% redundancy added

preferably 16khz - 20khz carrier wave with 44.1khz sampling : I would suggest increasing the sampling frequency up to 48 kHz (which is quite common nowadays in smartphones) and limiting your operation bandwith between 17.5 or 18 and 21.5 kHz. If you use 44.1 then you have to work between 17.5 or 18 and 20.5 kHz. But you have to be very careful with the speaker and microphone you select as not all of them operate at this high frequencies. You have to make a frequency reponse analysis of them. If you're using a PC I would recommend ARTA or Audacity or if you are a programmer Matlab or Octave. If you are using a smartphone I would recommed any audio spectrum analysis app

Not too complex coding logic: I would recommend the non coherent correlation quadrature fsk demodulator. Much lighter than any fft based implementation. Specially if you are less than 1 m away where doppler and multipath don´t afect you so much


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.