Welcome to bytebang » The blog about all and nothing » RTTY File transmission via soundcard

RTTY File transmission via soundcard

Oct 11 2014

The Problem

If you have to transmit a file from A to B then the most common methods are to use any kind of network (wired or wireless) or a shared storage medium like an USB stick. What if everything fails and you have to transmit data from computer A to computer B then you still have an option: Transmit the data via the soundcard !

The Solution

Under Linux it is very simple to transmit data via the soundcard. The program minimodem can do exactly that: On the senders computer it converts data to a sound which is played back via the default soundcard and on the receivers computer this sound is converted back to the initial text. Here is a quick example:

Senders ComputerReceivers Computer 
$ minimodem --tx rtty$ minimodem --rx rtty

Whenever you type a line into the senders computer (e.g. "The quick Brown Fox") and you press enter then the entered text is converted and played back by the soundcard. The receiving computer decodes the tones and shows the entered characters like this:

### CARRIER 45.45 @ 1590.0 Hz ###
THE QUICK BROWN FOX
### NOCARRIER ndata=3 confidence=1.560 ampl=0.003 bps=45.45 (0.0% slow) ###

The kind of sound that is produced with the upper command is called RTTY and it is very slow (only 45.45 bps, transmitted in a 5 bit code - so you can not use the whole ASCII Table to transmit data). This makes it useable in a very noisy environment like radio communications. 

Be sure to send a checksum of your data when you are finished and verify it on the receiver, because there is neither a FEC nor any other kind of guarantee that the received data is correct.

If we take a closer look at the previous example then we can see that all the letters that where received are converted to UPPER CASE. This is mainly because we are using RTTY and its 5 Bit code. Fortunately minimodem can understand other modulation types too:

usage: minimodem [--tx|--rx] [options] {baudmode}
     -t, --tx, --transmit, --write
     -r, --rx, --receive,  --read     (default)
 [options]
     -a, --auto-carrier
     -i, --inverted
     -c, --confidence {min-confidence-threshold}
     -l, --limit {max-confidence-search-limit}
     -8, --ascii  ASCII  8-N-1
     -7,   ASCII  7-N-1
     -5, --baudot Baudot 5-N-1
     -f, --file {filename.flac}
     -b, --bandwidth {rx_bandwidth}
     -v, --volume {amplitude or 'E'}
     -M, --mark {mark_freq}
     -S, --space {space_freq}
     --startbits {n}
     --stopbits {n.n}
     --sync-byte {0xXX}
     -q, --quiet
     -R, --samplerate {rate}
     -V, --version
     -A, --alsa[=plughw:X,Y]
     --lut={tx_sin_table_len}
     --float-samples
     --rx-one
     --benchmarks
     --binary-output
     --print-filter
 {baudmode}
     any_number_N       Bell-like      N bps --ascii
     1200       Bell202     1200 bps --ascii
      300       Bell103      300 bps --ascii
      rtty       RTTY       45.45 bps --baudot --stopbits=1.5
      same       NOAA SAME 520.83 bps --sync-byte=0xAB ...
  callerid       Bell202 CID 1200 bps

While the intermediate result is already pretty cool (you can transmit text unidiractional via the soundcard) it doesnt solve our problem yet. We want to transmit arbitary files over the air - including binary ones.

To be able to transmit binary files we have do use another modulation scheme which supports the whole 8 Bit ASCII characterset. Aditionaly we can encode our binary data into base64 on the fly to be sure that there are only ASCII caracters used. To make a long story short: Here is my solution for the problem:

Receivers ComputerSenders Computer 
$minimodem --rx-once --quiet 300 | base64  --decode > output.bin
$ cat input.bin | base64 | minimodem --tx 300 

On the senders side the file input.bin is base64 coded (so you can transmit any kind of characters and you can be sure that it fits into the ASCII alphabet) and finally handed over to minimodem which converts it to 300 baud ASCII modem sound.

On the recievers computer all decoding statusmessages are suppressed (--quiet option) and once the data is recieved the program is shutdown (--rx-once option). The agreed modulation scheme is ASCII 300 Baud (which is not as failure tolerant as RTTY but still does its job). Finally the base64 encoded caracters are decoded and written to the outputfile.

Final Remarks

If you dont have two computers at hand then you can try it on one computer and 2 different shells as well. (Dont forget to enable the MIC and the SPEAKER)

Of course this is not very reliable but it is interesting to know that you can use (HAM) radio technology to transmit data from your pc to another by just using the soundcard. If you now think "Well thats cool - can i set up a whole network like this ?" ... YES you can. One promising solution seems to be soundmodem which will be covered in another blog post.

Since you can set the mark and the space frequency (these are the frequencies that represent a 1 or a 0) you can propably use minimodem to produce ultrasound (frequencies > 19kHz) which is no longer hearable by the human ear. So you can transfer data out of a computer without beeing detected. (Idea taken from this Hackaday article about ultrasound datatransmission with gunradio and this article about ultrasound networking - but not verified yet).

Get Social


(c) 2024, by bytebang e.U. - Impressum - Datenschutz / Nutzungsbedingungen
-