# teceer/screechnet architecture

> Architecture diagram of the GitHub repository teceer/screechnet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/teceer/screechnet
- Repository: https://github.com/teceer/screechnet
- Video tour (about a minute): https://gitdiagram.com/teceer/screechnet/video

## Overview

Screechnet is a browser-based acoustic modem: users exchange messages by playing modem audio through a phone call and decoding it on the other side, without a server. The main path runs from composing a message through optional encryption and modem encoding to speaker output, then microphone capture, parallel demodulation, frame/block assembly, optional decryption, and display. The README also documents multiple FSK/MFSK modes, local echo, and a synthesized dial-up handshake. The map follows the supplied source excerpts and README; some UI and audio wiring is only partially sampled.

Main entry points: [`app.js`](https://github.com/teceer/screechnet/blob/main/app.js) (Compose and display), [`rx-worklet.js`](https://github.com/teceer/screechnet/blob/main/rx-worklet.js) (Audio receiver worklet), [`demod.js`](https://github.com/teceer/screechnet/blob/main/demod.js) (FSK and MFSK demodulators), [`modem.js`](https://github.com/teceer/screechnet/blob/main/modem.js) (Modes and framing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Browser interface"]
  node_app["Compose and display<br/>[app.js]"]
  node_audio["Browser audio I/O"]
end

subgraph group_transmission["Modem transmission"]
  node_modem["Modes and framing<br/>[modem.js]"]
  node_fec["TANK error correction<br/>[fec.js]"]
end

subgraph group_reception["Modem reception"]
  node_worklet["Audio receiver worklet<br/>[rx-worklet.js]"]
  node_demod["FSK and MFSK demodulators<br/>[demod.js]"]
  node_parsers["Frame and block assembly<br/>[modem.js]"]
end

subgraph group_security["Private line"]
  node_crypto["Room-key encryption<br/>[crypto.js]"]
end

node_user(("User"))
node_acoustic_line["Phone-call audio line"]

node_user -->|"composes message"| node_app
node_app -.->|"derives key / seals"| node_crypto
node_app -->|"encodes payload"| node_modem
node_modem -->|"encodes TANK blocks"| node_fec
node_app -->|"synthesizes handshake"| node_modem
node_app -->|"plays samples"| node_audio
node_audio -->|"sends audio"| node_acoustic_line
node_acoustic_line -->|"carries audio"| node_audio
node_audio -->|"feeds microphone samples"| node_worklet
node_worklet -->|"pushes samples"| node_demod
node_demod -->|"decodes TANK blocks"| node_fec
node_worklet -->|"posts receive events"| node_app
node_app -->|"pushes received bytes"| node_parsers
node_demod -->|"reports decoded blocks"| node_parsers
node_app -.->|"opens ciphertext"| node_crypto
node_app -->|"displays received text"| node_user

click node_app "https://github.com/teceer/screechnet/blob/main/app.js"
click node_modem "https://github.com/teceer/screechnet/blob/main/modem.js"
click node_fec "https://github.com/teceer/screechnet/blob/main/fec.js"
click node_crypto "https://github.com/teceer/screechnet/blob/main/crypto.js"
click node_worklet "https://github.com/teceer/screechnet/blob/main/rx-worklet.js"
click node_demod "https://github.com/teceer/screechnet/blob/main/demod.js"
click node_parsers "https://github.com/teceer/screechnet/blob/main/modem.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_audio,node_user toneBlue
class node_modem,node_fec toneAmber
class node_worklet,node_demod,node_parsers toneMint
class node_crypto toneRose
class node_acoustic_line toneIndigo
```

## Components

### Browser interface

- [Compose and display](https://github.com/teceer/screechnet/blob/main/app.js): `app.js`
- **Browser audio I/O**

### Modem transmission

- [Modes and framing](https://github.com/teceer/screechnet/blob/main/modem.js): `modem.js`
- [TANK error correction](https://github.com/teceer/screechnet/blob/main/fec.js): `fec.js`

### Modem reception

- [Audio receiver worklet](https://github.com/teceer/screechnet/blob/main/rx-worklet.js): `rx-worklet.js`
- [FSK and MFSK demodulators](https://github.com/teceer/screechnet/blob/main/demod.js): `demod.js`
- [Frame and block assembly](https://github.com/teceer/screechnet/blob/main/modem.js): `modem.js`

### Private line

- [Room-key encryption](https://github.com/teceer/screechnet/blob/main/crypto.js): `crypto.js`

### Other components

- **User**
- **Phone-call audio line**

## Connections

- User → Compose and display: composes message
- Compose and display → Room-key encryption: derives key / seals
- Compose and display → Modes and framing: encodes payload
- Modes and framing → TANK error correction: encodes TANK blocks
- Compose and display → Modes and framing: synthesizes handshake
- Compose and display → Browser audio I/O: plays samples
- Browser audio I/O → Phone-call audio line: sends audio
- Phone-call audio line → Browser audio I/O: carries audio
- Browser audio I/O → Audio receiver worklet: feeds microphone samples
- Audio receiver worklet → FSK and MFSK demodulators: pushes samples
- FSK and MFSK demodulators → TANK error correction: decodes TANK blocks
- Audio receiver worklet → Compose and display: posts receive events
- Compose and display → Frame and block assembly: pushes received bytes
- FSK and MFSK demodulators → Frame and block assembly: reports decoded blocks
- Compose and display → Room-key encryption: opens ciphertext
- Compose and display → User: displays received text
