vocsend
← Web app

vocsend on the command line

The desktop and server version: one small program for Linux, macOS and Windows. It speaks the same protocol as the web app, so a terminal on one side and a phone on the other works too.

receiver$ vocsend rx
sender$ vocsend tx id_ed25519.pub

Download a release Source on GitHub

Install

Download a binary for your system from the releases page, or build it from source with a Rust toolchain:

git clone https://github.com/tcreswick/vocsend
cd vocsend
cargo build --release

That produces target/release/vocsend. On Linux the build needs the ALSA development headers (libasound2-dev on Debian and Ubuntu, alsa-lib-devel on Fedora, alsa-lib on Arch).

It uses the system's default speaker and microphone. Nothing else needs setting up.

Examples

In these, sender$ and receiver$ are the prompts on the two machines. Start the receiver first unless it says otherwise.

Quick-send a public key from one box to another

One-way: the receiving machine never makes a sound.

receiver$ vocsend rx
sender$ vocsend tx ~/.ssh/id_ed25519.pub

The receiver saves id_ed25519.pub in its current directory. Both sides print the same short fingerprint, so you can see it arrived intact.

Send a file, negotiated

The two machines agree on the fastest speed the path can take, and every block is acknowledged and repeated if needed. Start them in either order.

receiver$ vocsend rx negotiate
sender$ vocsend tx negotiate release.sig

Send to several machines at once

A one-way transmission is a broadcast: every receiver in earshot gets its own copy.

receiver-1$ vocsend rx
receiver-2$ vocsend rx
receiver-3$ vocsend rx
sender$ vocsend tx ca-certificate.pem

Send with encryption

Both sides are asked for the shared key, which is never shown or sent.

receiver$ vocsend rx --encrypt
Key:
sender$ vocsend tx secret.txt --encrypt
Key:

Send to one machine among several

With encryption, --address names the receiver a message is for. The others ignore it.

laptop$ vocsend rx --encrypt --address laptop
desktop$ vocsend rx --encrypt --address desktop
sender$ vocsend tx notes.txt --encrypt --address laptop

Stream between hosts

Each line is sent when you press Enter and appears on the other side. End with Ctrl-D.

receiver$ vocsend rx --stream
sender$ vocsend tx --stream

Pipe anything

receiver$ vocsend rx | sha256sum
sender$ gpg --export --armor me@example.com | vocsend tx

To or from a phone

Open the web app on the phone. To send from a terminal to the phone, press Receive now on the phone and run vocsend tx. To send from the phone, run vocsend rx and press Send now. With negotiate on the terminal, switch Negotiate on in the app's send settings, or leave Allow replies on when receiving.

Usage

vocsend tx [negotiate] [FILE]     send
vocsend rx [negotiate] [FILE]     receive
vocsend tx test | rx test         find out which speeds work between two machines
vocsend help                      everything, in detail
What is sent
vocsend tx FILEthe file, and its name
vocsend txstandard input (also vocsend tx -)
Where it goes
vocsend rxa file with the sender's name if one was sent (never overwriting: key.pub, then key-1.pub), otherwise standard output
vocsend rx FILEthat file, whatever the sender called it
vocsend rx -standard output, always
Option
--level None-way speed, 1 (slowest, most robust) to 10 (fastest). Default 4. --level last reuses the level the last negotiation ended on.
--encrypt [KEY]encrypt with a shared key. With no key you are asked for it.
--address NAMEwith --encrypt: which receiver the message is for
--timeout SECONDSreceiver: give up if nothing is heard for this long. Default 60; 0 waits for ever.
--streamsend standard input a line at a time; print each line as it arrives
--stream-charsas --stream, without waiting for Enter
-q, --quietprint nothing unless something goes wrong

One-way or negotiated

One-way (the default) sends sound in one direction only. A one-way receiver never opens the speaker, so it cannot transmit; if the sender tries to negotiate with it, it stops with an error and stays silent. The price is that nothing can be asked for again, so the sender uses a cautious speed and cannot know whether the message arrived.

Negotiated (negotiate on both sides):

  1. The sender calls every few seconds until the receiver answers.
  2. The sender plays a ramp: a short burst at each speed level. The receiver reports the fastest level that arrived clean.
  3. The sender plays a longer test at that level. The receiver confirms it, asks for more error correction, or steps down a level, whichever is fastest overall.
  4. The data goes in blocks of about 30 seconds, each acknowledged. A block that fails is sent again one level slower, up to three times.

Only the sender-to-receiver direction is trained. Everything the receiver says uses the slowest, most robust setting.

Speed levels

The level is more than a speed. Higher levels use more pitches, packed closer together, in shorter syllables, with less error correction. Lower levels make the signal itself simpler, which is what carries it through noise.

LevelPitchesSyllableBits per second
14120 ms8
28100 ms18
3880 ms25
41680 ms36
51660 ms51
61650 ms64
73260 ms67
83250 ms83
96455 ms91
106450 ms104

Finding out what works

receiver$ vocsend rx test
sender$ vocsend tx test

The sender loops through the levels with a known burst at each. The receiver shows a live table of how each one is arriving, so you can move the machines or change the volume and watch what happens:

level  pitches  syllable  bits/s   last run           recent average   verdict
                          (net)    wrong   loudness   (up to 3 runs)
    6       16     50 ms      64     0.0%    -21 dB      0.0%           solid
    7       32     60 ms      67     1.7%    -21 dB      2.5%           marginal
    8       32     50 ms      83     6.7%    -21 dB      6.7%           fails

bursts heard: 6.  Fastest solid level so far: 6  (use: vocsend tx --level 6)

The web app's speed test does the same thing, and either side can be the app.

Encryption

--encrypt on both sides encrypts and authenticates every block with ChaCha20-Poly1305, using a key derived from the shared passphrase by Argon2id. The file name is encrypted along with the data. Every packet says whether encryption is in use, so a mismatch is reported at once instead of producing garbage, and a recorded transmission cannot be replayed into the same session.

Give the key as --encrypt KEY, in the VOCSEND_KEY environment variable, or leave it off to be asked. A key on the command line is visible to other users of the machine and ends up in shell history.

Anyone who can hear a transmission can record it, and a shared passphrase is only as strong as it is long. For anything that matters, encrypt and sign the data with an established tool before sending it as well.

Checking it arrived

Both sides print a short fingerprint of the data, such as 3f9a-c21d-77b0. If they match, both have the same bytes. Every block already carries a checksum and error correction, so a mismatch should never happen; the fingerprint is for peace of mind, and for one-way transfers, where the sender otherwise hears nothing back.

Exit status

0success
1the transfer failed, or nothing was heard before the timeout
2wrong mode: the sender is negotiating and the receiver is one-way
3encryption settings or keys differ
4the two sides' versions are not compatible

Shell completion

vocsend completions bash > ~/.local/share/bash-completion/completions/vocsend
vocsend completions zsh  > "${fpath[1]}/_vocsend"
vocsend completions fish > ~/.config/fish/completions/vocsend.fish

vocsend on GitHub Open the web app