title: Data to audio and back. Modulation / demodulation with source code
body: <p>I have a stream of binary data and want to convert it to raw waveform sound data, which I can send to the speakers.</p>
  
  <p>This is what the old-school modems did in order to transfer binary data over the phone line (producing the typical modemish sound). It is called modulation.</p>
  
  <p>Then I need a reverse process - from the raw waveform samples, I want to obtain the exact binary data. This is called demodulation.</p>
  
  <ul>
  <li>Any bitrate will work for a start.</li>
  <li>The sound is played using computer speakers and sampled using a microphone.</li>
  <li>Bandwidth would be quite low (low quality microphone).</li>
  <li>There is some background noise but not much.</li>
  </ul>
  
  <p>I found one particular way to do this - <a href="http://en.wikipedia.org/wiki/Frequency-shift_keying" rel="nofollow noreferrer">Frequency shift keying</a>. The problem is I can't find any source code.</p>
  
  <p>Can you please point me to an implementation of FSK in any language?<br>
  Or offer any alternative encoding binary&lt;->sound with available source code?</p>