Another program to encode and decode data in audio form, this time using a chirp spread spectrum
Go to file
Fluora Eigenwire 4320e50a7a converted everything to float, which is faster apparently 2020-03-16 10:36:55 -05:00
src converted everything to float, which is faster apparently 2020-03-16 10:36:55 -05:00
.gitignore initial commit; preliminary working state 2020-03-08 09:28:02 -05:00
Cargo.lock converted everything to float, which is faster apparently 2020-03-16 10:36:55 -05:00
Cargo.toml converted everything to float, which is faster apparently 2020-03-16 10:36:55 -05:00
README.md tried to do multithreading, but that didn't work, so just did an overhaul of the demod and made it a bit better instead 2020-03-14 23:24:32 -05:00
test.txt initial commit; preliminary working state 2020-03-08 09:28:02 -05:00

README.md

Threnodyne

More audio-based data transmission! This time it's using chirp spread spectrum

What this is

Threnodyne is another thing for making a sound card work as a silly budget SDR, in the same vein as transgride. To work on radio waves, it probably needs some kind of upconverter, unless you're into VLF.

The use case we have in mind is just plugging it into a radio set that is designed to handle audio. We are also hoping it will work for other audio data encoding purposes, like storing data on cassette tapes, or even transmitting data between computers using sound.

How it works

Modulation is simple: you simply select an audio frequency center and deviation, and the program generates a series of chirps - tones with linearly-changing frequency - centered on the specified frequency and traversing the specified deviation. A rising chirp encodes a 1 bit, and a falling chirp encodes a 0 bit.

Demodulation is accomplished by taking the cross-correlation of the template chirp signals with the incoming received signal, then searching for the sharp spikes in either of the results which correspond to the two possible symbols.

How to use it

As usual for Rust projects, you can build it (after installing the toolchain) with cargo build --release, which will emit an executable into target/release. Run that executable with --help for the detailed usage information:

Threnodyne is program for transmitting and receiving data in chirp-sequence spread-spectrum form 
using your computer's audio card.  

Chirps can provide substantial resistance to unfavorable channel conditions, which makes this 
program potentially suitable for transmitting data over channels intended for narrowband voice 
communication.  

Audio input/output is in raw 16-bit little-endian PCM format.  
Data input/output is arbitrary binary data, which can be text, file contents, or whatever else.  

Usage:  
<mode> (string) - Either 'e' to encode/enmodulate, or 'd' to decode/demodulate.  
-i, --input (default stdin) - Filelike object from which to read input.  
-o, --output (default stdout) - Filelike object into which to write output.  
-s, --sample-rate (default 48000.0) - Sample rate in Hertz, used for calculating modulation 
frequencies.  
-b, --bit-rate (default 50.0) - Data rate, in chirps (bits) per second. Be aware that lower values 
will increase system load.  
-f, --center-frequency (default 4000.0) - Center frequency of the signal in Hertz.  
-d, --deviation (default 2000.0) - Maximum range traversed above and below the center frequency by 
the signal.  
-t, --squelch (default 20) - Minimum signal amplitude for demodulation, from 0 (accept all) to 
65535 (ignore all).  
-a, --ascii-only - When demodulating, suppress all output that is not an ASCII character. Possibly
useful if searching for text on a noisy channel.  

-g, --debug (default 0) - If specified when demodulating, emits every nth correlation value in f32
form to threnodyne_rise.dat and threnodyne_fall.dat.  

Is it useful?

Maybe? The use case we have in mind is relatively low-rate (a handful of bytes per second) digital radio communication, mainly for using voice-oriented radios as text-mode transceivers. This will not be especially useful for fast data transfer, but may help when trying to cram data through a janky channel with heavy interference and tight bandwidth limits. Data transfer rate will be very slow - you'll be lucky to get 300 bits/sec over the air, and luckier still to get 100 bits/sec over a tight analog voice link - but this is still reasonable enough for plaintext messages.

Origin of name

A threnody is a song of mourning, similar to a lament. In earlier versions of this project, we were expecting the sound it produced to be more musical, perhaps with the warble characteristic of PSK, but then we settled on chirp spread spectrum instead, and now it sounds like a cicada. It is what it is, we guess. It's a pretty name and we don't feel like changing it now.