If you've found this worth your time, please consider donating via PayPal.
A dial-up softmodem in Rust. Everything a modem does — the tones, the handshakes, the error control, the compression — is code, and the line is a sound card. No DSP chip, no driver blob, and none of a winmodem's dependence on one vendor's Windows.
Written against the ITU-T Recommendations, with clause numbers cited in the source for every normative constant, and against the RFCs for everything carried over the top of them. 2175 tests.
It places and answers real calls. Every modulation in the table below has connected to real modems and providers' servers over a VoIP trunk, from Bell 103 to V.90, and full interactive sessions on public dial-up gateways have crossed it with V.42 error control and V.42bis compression, byte for byte correct including the ANSI. Where a far end answers no XID at all and simply announces compression in band, that is followed too, and 1957 octets of one board's screen are kept as a test vector. No far end ever has answered one, in any of twelve recorded calls, and reading those calls back through the whole modem said why: our XID broke four of the Recommendation's rules at once, and the worst of them put a length in front of the V.44 offer where 12.2.1.3 says there is none, so no far end could read the offer and no conformant answer to it would have been read here either. All four are fixed.
V.32bis runs to 14 400. One trellis code serves 7200, 9600, 12 000 and 14 400 — Figure 1/V.32bis draws it once, with four parallel lines each labelled by the rates it exists for — and only the number of bits riding through untouched changes, from one to four. The redundant bit buys nine decibels at every one of them, which is why 14 400 fits in the channel 4800 does.
V.34 works on real calls. Through a VoIP trunk to real modems it has come up at 28 800 to 33 600 and carried login banners and PPP without an error. The recordings of those calls replay through the modem to the same banners, and in them it answers the far end's rate renegotiation and follows the jitter buffer's slips, both in the start-up and once connected. Phase 2 reads the far end's probe for 300 ms rather than the full 500 V.34 allows, because a real modem that needed the difference to hear our reply stalled three times running without it.
V.90 works both ways round. The analogue modem, the half that dials a provider, reads a real server's start-up the way the Recommendation writes it -- CM and JM, INFO0d and INFO1d, Ja, TRN1d, Jd and the DIL -- and connects in PCM to real providers' servers over the VoIP trunk. The digital modem, the half a provider runs, answers too, so two of these connect at full PCM rates over a virtual cable. Against a simulated G.711 network -- A-law and μ-law, a robbed bit, a pad, noise, a second's round trip, a sound card 120 ppm out, a jitter buffer slipping every few seconds and a softphone's gain control -- it connects at 52 000 to 56 000, renegotiates and retrains from either end, notices a far end that has hung up, and falls back to V.34 on a route that would carry less as PCM. Where the top of the band is cut, as a codec or a VoIP path cuts it, the analogue modem asks for spectral shaping the way a real one does, so the server sends next to nothing where the cut is.
Every constellation was read off the figures by position rather than out of extracted text, which loses the sign of each coordinate and shuffles the axis labels through the rows. tools/read_constellation.py takes the scale from the spacing of the ticks and the origin from the constellation's own quarter-turn symmetry. Run on V.32bis Figure 2-3 it gives back exactly the thirty-two points read off V.32's Figure 3 by hand, which had been checked three other ways: two documents, two methods, one table.
| Modulations | Bell 103 (300), V.21 (300), V.22 (1200), V.22bis (1200/2400), V.32 (4800/9600, both codings), V.32bis (7200/12000/14400), V.34 (4800 to 33600: shell mapping, 16/32/64-state 4D trellis codes, precoding, non-linear encoding), V.90 analogue and digital modems (28000 to 56000 PCM down, V.34 up: DIL analysis, modulus encoding, spectral shaping, rate renegotiation; the digital one answers through a softphone) |
| Negotiation | V.8 CM/JM/CI/CJ and ANSam; V.25 answer tone told apart from it |
| Error control | V.42 LAPM — detection, HDLC, XID, REJ/SREJ, mod-128 |
| Compression | V.44 (LZJH) and V.42bis (BTLZ), both offered in one XID and the far end picks; V.42bis also followed in band |
| Commands | V.250 AT: +MS, +ES, +DS, +DS44, +ER, +DR, S-registers, +++ |
| Terminal | ANSI/CP437 with mouse reporting; telnet (RFC 854) to use it alone |
| Settings | remembered between runs, so the modem comes back where it was left |
| Files | ZMODEM send and receive |
| Fax | T.30 group 3, sending and receiving; V.17 (7200 to 14 400), V.29 (4800/7200/9600) and V.27 ter (2400/4800); Super G3 -- V.8, then T.30 Annex F on V.34's half-duplex mode at up to 33 600; T.4 Modified Huffman and Modified READ, T.6 MMR, T.85 JBIG; T.30 Annex A error correction mode; any number of pages in a call, each drawn as it arrives; a PDF sent a page to a sheet at its printed size, and the pages received saved as a PDF |
| Network | PPP (RFC 1661/1662) with LCP, PAP and CHAP, and IPCP, Van Jacobson header compression (RFC 1144), and a ping over it; a dial-in login prompt, and a login script for dialling out |
| Internet | our own TCP (RFC 9293) and an HTTP/HTTPS proxy (RFC 9112): pages straight to the internet through a provider, or through a far BinModem that has it |
| Line | full-duplex sound card, or a WAV to replay |
It is a fax machine as well. A picture loaded in the Fax window becomes a group 3 page, and a PDF becomes one for each of its pages, drawn at their printed size; they go out under T.30. A public fax service over the same VoIP trunk accepts the training check and confirms the page, and a page it sends back arrives and saves as a PDF or a PNG. V.29 carries it at 9600 and 7200, falling back to V.27 ter at 4800 and 2400, and every point and training sequence of both was read off the figures -- the extracted text turns the square root of two into "2". What finally let a real machine's page in was twenty milliseconds of silence that its transmitter puts in front of every training sequence on purpose, and that this end had been taking for the end of the burst. V.17 carries it at 14 400 down to 7200 between two of these; no real machine has been tried at V.17 yet. Super G3 -- V.8 in front of the call and the page over V.34's half-duplex mode at up to 33 600, with T.30's frames on its 1200 bit/s control channel -- goes between two of these too, over the VoIP line's delay and slips, and a real Super G3 fax has sent one a page at 33 600 on 3429 baud, in JBIG. Sending to one has yet to get through.
Between two of these the page goes under T.30's error correction mode: numbered frames, and a partial page request for any the far end could not read. A tenth of a second of loud noise dropped onto a page costs a few frames sent again, and the page arrives exactly as it left; without error correction the same noise prints as streaks. That in turn lets the page go in MMR, T.6's coding, which has no end-of-line codes to find its place again by and comes to under half the size of the Modified Huffman every machine reads. A page arriving is drawn a row at a time as it comes in, the way slow-scan television is.
It dials a real provider. The Network panel brings up PPP, logs in if the
far end asks, is given an address, and an ICMP echo crosses and comes back
with a round trip on it. Tick carry web traffic, set the browser's HTTP
proxy to 127.0.0.1:8080 for http and https, and pages come straight from the
internet: the request is read on this machine and the connection goes to the
web server's own address, with this program's own TCP, through the
provider's router. Between two of these, the machine that answered offers its
internet instead, and the proxy finds out which kind of far end it has by
itself.
The answering end can be a dial-in server, the way a provider's modem pool
was. A caller gets a banner, login: and Password:, and a prompt where ppp
starts PPP; the calling end's Log in, then PPP answers those prompts by
itself. A dialler that skips the text and starts PPP straight away is asked for
the same account over CHAP or PAP (RFC 1994, RFC 1334), so something other than
another BinModem can dial in.
TCP is ours, written against RFC 9293: the eleven states, retransmission with RFC 6298's estimator, Nagle, delayed acknowledgements, zero-window probing, out-of-order reassembly, and RFC 5681's fast retransmit. Almost nothing in the path belongs to the operating system — the browser's socket to the proxy, and the name lookups — and there is no driver, no adapter, no route and no administrator.
The tallest test does the whole of it against a simulated line: V.8, V.22bis, V.42, V.42bis, PPP, IPCP, TCP, the proxy, and a real web server on the loopback. Connected six seconds into the call, network phase at seven, a page back at 2400 bit/s — and it runs without a sound card.
The window is a modem's faceplate: the lamps, the level, the rate it connected at, and the keys that dial and answer. Under it are the terminal, with a strip that says how far the call has got and how long each step took, a transcript of every frame both ends sent, and the scopes: a card that names what the receiver is slicing and its margin and then goes down the receive chain a stage at a time, beside the constellation, an oscilloscope, a waterfall and a spectrum that label their own peak, noise floor and occupied band. A recording of somebody else's call replays through the same scopes, as far as one tap on the line lets it be followed. What the echo canceller is taking out, and where on the line it found the reflection, are on the panel too — on a two-wire pair that decides everything and is otherwise invisible, since a constellation full of noise looks the same whether the noise is the line or this modem listening to itself.
There is a SIP caller in it now, written the same way as everything else here -- against RFC 3261, 3550 and 4566, with no third-party stack -- so a call can be placed without a virtual cable and a softphone in the path. That middle stretch was doing three things a modem never wants: resampling 48 kHz to 8 and back, running an adaptive jitter buffer that inserts about 20 ms of audio every few seconds, and applying gain control. The first ruins a V.90 server's codewords, which are the far end's actual symbols; the second was measured putting a V.34 receiver out of lock for 1.3 seconds. With the softphone out of the way the codewords arrive as they were sent, and the losses that remain are counted rather than concealed -- so a failed call now says whether it failed in the modem or in the network.
It has a dialler of its own: a keypad, a number box, a Call button, and a form
for the account -- SIP server, username, password, and UDP or TCP -- so a trunk
can be set up without editing a file. Call types ATD at the terminal rather
than reaching past it, so there is one path that places a call and it can be
watched. T.38 is not there yet: a far end that asks for it is declined and the
call stays on G.711, where the fax modulations already work. Compiled and
tested against a fake trunk that challenges, refuses, retransmits and
renegotiates -- and, since 2026-09-23, over a real trunk: it registers, places
a call, carries it in mu-law, and the modem works over it. TCP has been
exercised only against the fake trunk so far.
Portable in principle — cpal for the audio, eframe for the window, no
OS-specific code — but only built and run on Windows so far.
-
V.90 between two of these through softphones falls back to V.34. The server's codewords are resampled on their way into its softphone and requantised, which leaves noise at about 1.7% of every codeword; a real provider's server puts exact codewords on the network, which is why a real modem gets 56k on the same line.
-
V.ARC, a wideband mode of our own for a sound card and not a telephone line; both ends have to be BinModem. A multicarrier modulation loaded a carrier at a time, and QAM and baseband levels that fill the card's band (
AT+VARCsets their baud, code and grid by hand).AT+VARCBISlists it in V.8 bis, so an ordinary call between two BinModems finds it. Over SIP, linear PCM at 8 to 48 kHz carries it exactly, and EasySip is that with no account: type the other end's address.AT+MS=VARCor the window's mode box selects it andATDandATAplace and answer the call.- Through a real lead between a Realtek line output and its line input at 192 kHz: 1.4 Mbit/s with no octet wrong. A call is one signal, the same on both channels.
- A call starts with a handshake at 200 bit/s in the voice band, where each end says what its sound cards are, so ends that differ agree on what to run and do not just fail.
- It starts on a line it knows nothing about, with a signal that needs any 2.3 kHz of the band, and loads only where the line is.
- Each end tells the other what it hears, and a sender that is too loud turns itself down.
- An end that cannot hear the other says so, and the far end slows the modulation by halves until it can; codes from 0.93 down to 0.25 for lines with little to spare. One direction has been out of a loudspeaker and into a microphone: 20 kbit/s.
AT+MS=VARC2Wis the same mode on one pair of wires, with an echo canceller. Each end learns its echo with the line to itself first; two ends sharing a virtual cable connect at 327 kbit/s and pass 75 dB.- Between two SIP accounts that say
linear = yesthe call carries sixteen-bit samples exactly and the samples are the data, at 200 kbit/s.
It has never been run between two machines, and the two-wire mode has never met a real two-wire line. See docs/design/v-arc.md.
V.33 -- the same trellis code as V.32bis again, on a leased line.
V.92 carries data between two of these modems: AT+MS=V92 at both ends with
BINMODEM_V92_PCM_UP=1, PCM both ways, 48 000 up and up to 56 000 down over a
pair of virtual cables. It has not carried a call with a real V.92 modem yet,
and the calling side still wants a line with no echo and one clock. A second
V.92 call to the same number starts up the short way (9.2 and 9.4, "quick
connect"): QC1a and QCA1d in place of V.8's menus, a Phase 2 with no line
probe, and no ODP/ADP, which takes about three seconds off the sixteen;
BINMODEM_V92_QC=0 turns it off and always asks every server. Eighteen agents read the Recommendation clause by clause off
the rendered pages, with V.8, V.8 bis and V.250's +P commands beside it, and
four more read what the V.90 code here already does; the notes they wrote and
the plan built from them are in docs/design/v92 -- 62 work
packages in 18 waves, each with the files it may touch and the tests that will
prove it. The first milestone is a spike that has to show PCM upstream can
carry data at all before any of the state machines are written, because sending
codewords up the line is the one thing V.90 never does. Two waves are built
and merged so far: the shared numbers, the V.92 sequences, the upstream
encoder, precoder and transmitter, the quick-connect signals and the
impairments a softphone puts on the upstream. Every package is written by one
agent and then read by another against the pages again, which is how the
project's own capture turned out to be worth more than expected: it is a quick
connect, with no V.8 in it at all, and one of its frames decodes byte for byte
into what the reading of the Recommendation had predicted. That modem declined
PCM upstream, so no recording here contains the upstream signals, and the tests
that would want one say so rather than pretending.
cargo run -p gui --release -- --liveOr dist.bat, which leaves a single dist\binmodem.exe holding the scope, the
terminal, an answering board and a capture to replay, with nothing to install.
docs/usage.md has the rest — the AT interface, the live-line
setup, ZMODEM and the telnet terminal.
The releases are Windows executables; CI builds the Linux one on every change but does not run it, so reports from people who do are what this section is kept right by. For Debian or Ubuntu; other distributions want the same things under their own names.
Sound goes through the sound server when there is one (PipeWire or
PulseAudio), so a device BinModem is using stays usable by everything else.
BINMODEM_AUDIO_HOST=alsa opens the hardware through ALSA instead, which takes
the device for BinModem alone.
What it needs: a Rust toolchain recent enough for the 2024 edition (1.85 or later), a C linker, and ALSA's headers for the sound card. The window comes up on X11 or Wayland through OpenGL, which a desktop install already has.
sudo apt install build-essential pkg-config libasound2-dev libxkbcommon0 libgl1curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shOpen a new terminal so that cargo is on the path, then:
git clone https://github.com/CasualArclamp/BinModem.gitcd BinModemcargo build --release -p guiThat leaves one file, target/release/binmodem. To see it work with no line
and no sound card, replay the capture that comes with it:
./target/release/binmodem --captureAnd then the real thing:
./target/release/binmodem --devices./target/release/binmodemThe first lists the audio devices the machine has; the second opens the modem
on a line. --telnet is a board over a socket and --sip <account> a call
over a SIP trunk, neither of which needs a sound card.
docs/usage.md has every flag.
GPL-3.0-or-later. The ITU-T Recommendations themselves are not redistributed
here; tools/fetch_specs.sh downloads them.
