# kamalmostafa/minimodem architecture

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

- Interactive diagram: https://gitdiagram.com/kamalmostafa/minimodem
- Repository: https://github.com/kamalmostafa/minimodem

## Overview

Minimodem is a command-line software FSK modem: users generate or decode audio tones using configurable baud rates and framing, with real-time audio-device or audio-file I/O. The main workflow is command-line configuration, audio input/output, FSK signal processing, and protocol-specific bit/text conversion. The README also documents Bell103, Bell202, RTTY, TTY/TDD, NOAA SAME, and Caller-ID support. Several backend and codec connections are based on the source index or documentation rather than inspected call sites, so those links are marked unverified.

Main entry points: [`src/databits.h`](https://github.com/kamalmostafa/minimodem/blob/master/src/databits.h) (Bit codecs), [`src/minimodem.c`](https://github.com/kamalmostafa/minimodem/blob/master/src/minimodem.c) (CLI modem), [`src/simpleaudio.c`](https://github.com/kamalmostafa/minimodem/blob/master/src/simpleaudio.c) (Audio router), [`src/simpleaudio.h`](https://github.com/kamalmostafa/minimodem/blob/master/src/simpleaudio.h) (Audio interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Modem application"]
  node_app["CLI modem<br/>[minimodem.c]"]
end

subgraph group_signal["Signal processing"]
  node_fsk["FSK engine<br/>[fsk.c]"]
  node_fskapi["FSK interface<br/>[fsk.h]"]
end

subgraph group_protocol["Protocol codecs"]
  node_databits["Bit codecs<br/>[databits.h]"]
  node_ascii["ASCII codec<br/>[databits_ascii.c]"]
  node_binary["Binary codec<br/>[databits_binary.c]"]
  node_baudot["Baudot codec<br/>[baudot.c]"]
  node_baudotapi["Baudot interface<br/>[baudot.h]"]
  node_callerid["Caller ID codec"]
  node_uic["UIC codec<br/>[databits_uic.c]"]
  node_uiccodes["UIC messages<br/>[uic_codes.c]"]
end

subgraph group_audio["Audio I/O"]
  node_audioapi["Audio interface<br/>[simpleaudio.h]"]
  node_audio["Audio router<br/>[simpleaudio.c]"]
  node_sndfile["Audio files"]
  node_alsa["ALSA backend<br/>[simpleaudio-alsa.c]"]
  node_pulse["PulseAudio backend"]
  node_sndio["sndio backend"]
  node_tone["Tone generator"]
end

node_user(("Operator"))

node_user -->|"configures"| node_app
node_app -.->|"processes FSK"| node_fsk
node_app -.->|"converts bits"| node_databits
node_app -.->|"reads and writes"| node_audioapi
node_app -->|"emits tones"| node_tone
node_fsk -->|"implements"| node_fskapi
node_databits -->|"declares codec"| node_ascii
node_databits -->|"declares codec"| node_binary
node_databits -->|"declares decoder"| node_callerid
node_databits -->|"declares decoder"| node_uic
node_databits -->|"uses interface"| node_baudotapi
node_baudot -.->|"implements"| node_baudotapi
node_uic -->|"uses codes"| node_uiccodes
node_audioapi -->|"implemented by"| node_audio
node_audio -->|"dispatches to"| node_sndfile
node_audio -->|"dispatches to"| node_alsa
node_audio -->|"dispatches to"| node_pulse
node_audio -->|"dispatches to"| node_sndio
node_tone -.->|"writes samples"| node_audioapi

click node_app "https://github.com/kamalmostafa/minimodem/blob/master/src/minimodem.c"
click node_fsk "https://github.com/kamalmostafa/minimodem/blob/master/src/fsk.c"
click node_fskapi "https://github.com/kamalmostafa/minimodem/blob/master/src/fsk.h"
click node_databits "https://github.com/kamalmostafa/minimodem/blob/master/src/databits.h"
click node_ascii "https://github.com/kamalmostafa/minimodem/blob/master/src/databits_ascii.c"
click node_binary "https://github.com/kamalmostafa/minimodem/blob/master/src/databits_binary.c"
click node_baudot "https://github.com/kamalmostafa/minimodem/blob/master/src/baudot.c"
click node_baudotapi "https://github.com/kamalmostafa/minimodem/blob/master/src/baudot.h"
click node_callerid "https://github.com/kamalmostafa/minimodem/blob/master/src/databits_callerid.c"
click node_uic "https://github.com/kamalmostafa/minimodem/blob/master/src/databits_uic.c"
click node_uiccodes "https://github.com/kamalmostafa/minimodem/blob/master/src/uic_codes.c"
click node_audioapi "https://github.com/kamalmostafa/minimodem/blob/master/src/simpleaudio.h"
click node_audio "https://github.com/kamalmostafa/minimodem/blob/master/src/simpleaudio.c"
click node_sndfile "https://github.com/kamalmostafa/minimodem/blob/master/src/simpleaudio-sndfile.c"
click node_alsa "https://github.com/kamalmostafa/minimodem/blob/master/src/simpleaudio-alsa.c"
click node_pulse "https://github.com/kamalmostafa/minimodem/blob/master/src/simpleaudio-pulse.c"
click node_sndio "https://github.com/kamalmostafa/minimodem/blob/master/src/simpleaudio-sndio.c"
click node_tone "https://github.com/kamalmostafa/minimodem/blob/master/src/simple-tone-generator.c"

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 toneBlue
class node_fsk,node_fskapi toneAmber
class node_databits,node_ascii,node_binary,node_baudot,node_baudotapi,node_callerid,node_uic,node_uiccodes toneMint
class node_audioapi,node_audio,node_sndfile,node_alsa,node_pulse,node_sndio,node_tone toneRose
class node_user toneIndigo
```

## Components

### Modem application

- [CLI modem](https://github.com/kamalmostafa/minimodem/blob/master/src/minimodem.c): `src/minimodem.c`

### Signal processing

- [FSK engine](https://github.com/kamalmostafa/minimodem/blob/master/src/fsk.c): `src/fsk.c`
- [FSK interface](https://github.com/kamalmostafa/minimodem/blob/master/src/fsk.h): `src/fsk.h`

### Protocol codecs

- [Bit codecs](https://github.com/kamalmostafa/minimodem/blob/master/src/databits.h): `src/databits.h`
- [ASCII codec](https://github.com/kamalmostafa/minimodem/blob/master/src/databits_ascii.c): `src/databits_ascii.c`
- [Binary codec](https://github.com/kamalmostafa/minimodem/blob/master/src/databits_binary.c): `src/databits_binary.c`
- [Baudot codec](https://github.com/kamalmostafa/minimodem/blob/master/src/baudot.c): `src/baudot.c`
- [Baudot interface](https://github.com/kamalmostafa/minimodem/blob/master/src/baudot.h): `src/baudot.h`
- [Caller ID codec](https://github.com/kamalmostafa/minimodem/blob/master/src/databits_callerid.c): `src/databits_callerid.c`
- [UIC codec](https://github.com/kamalmostafa/minimodem/blob/master/src/databits_uic.c): `src/databits_uic.c`
- [UIC messages](https://github.com/kamalmostafa/minimodem/blob/master/src/uic_codes.c): `src/uic_codes.c`

### Audio I/O

- [Audio interface](https://github.com/kamalmostafa/minimodem/blob/master/src/simpleaudio.h): `src/simpleaudio.h`
- [Audio router](https://github.com/kamalmostafa/minimodem/blob/master/src/simpleaudio.c): `src/simpleaudio.c`
- [Audio files](https://github.com/kamalmostafa/minimodem/blob/master/src/simpleaudio-sndfile.c): `src/simpleaudio-sndfile.c`
- [ALSA backend](https://github.com/kamalmostafa/minimodem/blob/master/src/simpleaudio-alsa.c): `src/simpleaudio-alsa.c`
- [PulseAudio backend](https://github.com/kamalmostafa/minimodem/blob/master/src/simpleaudio-pulse.c): `src/simpleaudio-pulse.c`
- [sndio backend](https://github.com/kamalmostafa/minimodem/blob/master/src/simpleaudio-sndio.c): `src/simpleaudio-sndio.c`
- [Tone generator](https://github.com/kamalmostafa/minimodem/blob/master/src/simple-tone-generator.c): `src/simple-tone-generator.c`

### Other components

- **Operator**

## Connections

- Operator → CLI modem: configures (evidence: `README`)
- CLI modem → FSK engine: processes FSK
- CLI modem → Bit codecs: converts bits (evidence: `src/minimodem.c`)
- CLI modem → Audio interface: reads and writes (evidence: `src/minimodem.c`)
- CLI modem → Tone generator: emits tones (evidence: `src/minimodem.c`)
- FSK engine → FSK interface: implements (evidence: `src/fsk.c`)
- Bit codecs → ASCII codec: declares codec (evidence: `src/databits_ascii.c`)
- Bit codecs → Binary codec: declares codec (evidence: `src/databits_binary.c`)
- Bit codecs → Caller ID codec: declares decoder (evidence: `src/databits_callerid.c`)
- Bit codecs → UIC codec: declares decoder (evidence: `src/databits_uic.c`)
- Bit codecs → Baudot interface: uses interface (evidence: `src/databits.h`)
- Baudot codec → Baudot interface: implements
- UIC codec → UIC messages: uses codes (evidence: `src/databits_uic.c`)
- Audio interface → Audio router: implemented by (evidence: `src/simpleaudio.c`)
- Audio router → Audio files: dispatches to (evidence: `src/simpleaudio.c`)
- Audio router → ALSA backend: dispatches to (evidence: `src/simpleaudio.c`)
- Audio router → PulseAudio backend: dispatches to (evidence: `src/simpleaudio.c`)
- Audio router → sndio backend: dispatches to (evidence: `src/simpleaudio.c`)
- Tone generator → Audio interface: writes samples (evidence: `src/simple-tone-generator.c`)
