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 FILE | the file, and its name |
vocsend tx | standard input (also vocsend tx -) |
| Where it goes | |
|---|---|
vocsend rx | a file with the sender's name if one was sent (never overwriting: key.pub, then key-1.pub), otherwise standard output |
vocsend rx FILE | that file, whatever the sender called it |
vocsend rx - | standard output, always |
| Option | |
|---|---|
--level N | one-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 NAME | with --encrypt: which receiver the message is for |
--timeout SECONDS | receiver: give up if nothing is heard for this long. Default 60; 0 waits for ever. |
--stream | send standard input a line at a time; print each line as it arrives |
--stream-chars | as --stream, without waiting for Enter |
-q, --quiet | print 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):
- The sender calls every few seconds until the receiver answers.
- The sender plays a ramp: a short burst at each speed level. The receiver reports the fastest level that arrived clean.
- 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.
- 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.
| Level | Pitches | Syllable | Bits per second |
|---|---|---|---|
| 1 | 4 | 120 ms | 8 |
| 2 | 8 | 100 ms | 18 |
| 3 | 8 | 80 ms | 25 |
| 4 | 16 | 80 ms | 36 |
| 5 | 16 | 60 ms | 51 |
| 6 | 16 | 50 ms | 64 |
| 7 | 32 | 60 ms | 67 |
| 8 | 32 | 50 ms | 83 |
| 9 | 64 | 55 ms | 91 |
| 10 | 64 | 50 ms | 104 |
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
| 0 | success |
| 1 | the transfer failed, or nothing was heard before the timeout |
| 2 | wrong mode: the sender is negotiating and the receiver is one-way |
| 3 | encryption settings or keys differ |
| 4 | the 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