# windytan/redsea architecture

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

- Interactive diagram: https://gitdiagram.com/windytan/redsea
- Repository: https://github.com/windytan/redsea

## Overview

redsea is a command-line FM-RDS decoder: it accepts MPX audio or encoded RDS bit/group inputs, processes and decodes RDS groups, then emits JSON lines or raw hex. The graph preserves the signal-processing, group/station decoding, and TMC traffic-message branches. Some orchestration and subsystem implementations were not shown; uncertain links are dashed, and unsampled documented capabilities use their exact source directory paths.

Main entry points: [`src/station.cc`](https://github.com/windytan/redsea/blob/master/src/station.cc) (Station decoder), [`src/channel.cc`](https://github.com/windytan/redsea/blob/master/src/channel.cc) (Channel processor), [`src/tmc/tmc.cc`](https://github.com/windytan/redsea/blob/master/src/tmc/tmc.cc) (TMC service), [`src/io/input.cc`](https://github.com/windytan/redsea/blob/master/src/io/input.cc) (MPX reader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Input and signal"]
  node_mpx["MPX reader<br/>[input.cc]"]
  node_bitinput["Bit and hex input<br/>[input.cc]"]
  node_subcarrier["Subcarrier DSP<br/>[subcarrier.cc]"]
  node_sync["Block synchronizer<br/>[block_sync.cc]"]
end

subgraph group_decode["RDS decoding"]
  node_channel["Channel processor<br/>[channel.cc]"]
  node_group["RDS group model<br/>[group.cc]"]
  node_station["Station decoder<br/>[station.cc]"]
  node_options["CLI options<br/>[options.cc]"]
  node_tables["RDS tables<br/>[tables.cc]"]
  node_rdsstring["RDS text<br/>[rdsstring.cc]"]
end

subgraph group_traffic["Traffic messages"]
  node_tmcservice["TMC service<br/>[tmc.cc]"]
  node_tmcmessage["TMC message decoder<br/>[message.cc]"]
  node_eventdb[("TMC event data<br/>[eventdb.cc]")]
  node_events["Event definitions<br/>[events_data.cc]"]
  node_locationdb[("Location databases<br/>[locationdb.cc]")]
end

subgraph group_output["Output and encoding"]
  node_output["JSON and hex output<br/>[output.cc]"]
  node_iconv["Character conversion<br/>[iconv.hpp]"]
end

node_user(("CLI user"))

node_user -->|"provides audio"| node_mpx
node_user -->|"provides RDS"| node_bitinput
node_mpx -.->|"feeds samples"| node_subcarrier
node_bitinput -->|"feeds bits"| node_channel
node_subcarrier -.->|"yields bits"| node_channel
node_channel -->|"pushes bits"| node_sync
node_sync -.->|"forms groups"| node_group
node_channel -->|"processes groups"| node_group
node_channel -->|"decodes station"| node_station
node_station -->|"assembles text"| node_rdsstring
node_station -.->|"dispatches TMC"| node_tmcservice
node_tmcservice -->|"decodes messages"| node_tmcmessage
node_tmcservice -->|"loads event data"| node_eventdb
node_eventdb -.->|"reads definitions"| node_events
node_tmcservice -->|"uses locations"| node_locationdb
node_station -->|"looks up codes"| node_tables
node_station -->|"emits decoded data"| node_output
node_user -->|"sets options"| node_options
node_rdsstring -->|"converts encoding"| node_iconv
node_output -->|"prints JSON or hex"| node_user

click node_mpx "https://github.com/windytan/redsea/blob/master/src/io/input.cc"
click node_bitinput "https://github.com/windytan/redsea/blob/master/src/io/input.cc"
click node_subcarrier "https://github.com/windytan/redsea/blob/master/src/dsp/subcarrier.cc"
click node_sync "https://github.com/windytan/redsea/blob/master/src/block_sync.cc"
click node_channel "https://github.com/windytan/redsea/blob/master/src/channel.cc"
click node_group "https://github.com/windytan/redsea/blob/master/src/group.cc"
click node_station "https://github.com/windytan/redsea/blob/master/src/station.cc"
click node_options "https://github.com/windytan/redsea/blob/master/src/options.cc"
click node_tables "https://github.com/windytan/redsea/blob/master/src/tables.cc"
click node_rdsstring "https://github.com/windytan/redsea/blob/master/src/text/rdsstring.cc"
click node_tmcservice "https://github.com/windytan/redsea/blob/master/src/tmc/tmc.cc"
click node_tmcmessage "https://github.com/windytan/redsea/blob/master/src/tmc/message.cc"
click node_eventdb "https://github.com/windytan/redsea/blob/master/src/tmc/eventdb.cc"
click node_events "https://github.com/windytan/redsea/blob/master/src/tmc/events_data.cc"
click node_locationdb "https://github.com/windytan/redsea/blob/master/src/tmc/locationdb.cc"
click node_output "https://github.com/windytan/redsea/blob/master/src/io/output.cc"
click node_iconv "https://github.com/windytan/redsea/blob/master/ext/iconvpp/iconv.hpp"

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_mpx,node_bitinput,node_subcarrier,node_sync,node_user toneBlue
class node_channel,node_group,node_station,node_options,node_tables,node_rdsstring toneAmber
class node_tmcservice,node_tmcmessage,node_eventdb,node_events,node_locationdb toneMint
class node_output,node_iconv toneRose
```

## Components

### Input and signal

- [MPX reader](https://github.com/windytan/redsea/blob/master/src/io/input.cc): `src/io/input.cc`
- [Bit and hex input](https://github.com/windytan/redsea/blob/master/src/io/input.cc): `src/io/input.cc`
- [Subcarrier DSP](https://github.com/windytan/redsea/blob/master/src/dsp/subcarrier.cc): `src/dsp/subcarrier.cc`
- [Block synchronizer](https://github.com/windytan/redsea/blob/master/src/block_sync.cc): `src/block_sync.cc`

### RDS decoding

- [Channel processor](https://github.com/windytan/redsea/blob/master/src/channel.cc): `src/channel.cc`
- [RDS group model](https://github.com/windytan/redsea/blob/master/src/group.cc): `src/group.cc`
- [Station decoder](https://github.com/windytan/redsea/blob/master/src/station.cc): `src/station.cc`
- [CLI options](https://github.com/windytan/redsea/blob/master/src/options.cc): `src/options.cc`
- [RDS tables](https://github.com/windytan/redsea/blob/master/src/tables.cc): `src/tables.cc`
- [RDS text](https://github.com/windytan/redsea/blob/master/src/text/rdsstring.cc): `src/text/rdsstring.cc`

### Traffic messages

- [TMC service](https://github.com/windytan/redsea/blob/master/src/tmc/tmc.cc): `src/tmc/tmc.cc`
- [TMC message decoder](https://github.com/windytan/redsea/blob/master/src/tmc/message.cc): `src/tmc/message.cc`
- [TMC event data](https://github.com/windytan/redsea/blob/master/src/tmc/eventdb.cc): `src/tmc/eventdb.cc`
- [Event definitions](https://github.com/windytan/redsea/blob/master/src/tmc/events_data.cc): `src/tmc/events_data.cc`
- [Location databases](https://github.com/windytan/redsea/blob/master/src/tmc/locationdb.cc): `src/tmc/locationdb.cc`

### Output and encoding

- [JSON and hex output](https://github.com/windytan/redsea/blob/master/src/io/output.cc): `src/io/output.cc`
- [Character conversion](https://github.com/windytan/redsea/blob/master/ext/iconvpp/iconv.hpp): `ext/iconvpp/iconv.hpp`

### Other components

- **CLI user**

## Connections

- CLI user → MPX reader: provides audio (evidence: `README.md`)
- CLI user → Bit and hex input: provides RDS (evidence: `README.md`)
- MPX reader → Subcarrier DSP: feeds samples
- Bit and hex input → Channel processor: feeds bits
- Subcarrier DSP → Channel processor: yields bits
- Channel processor → Block synchronizer: pushes bits (evidence: `src/channel.cc`)
- Block synchronizer → RDS group model: forms groups
- Channel processor → RDS group model: processes groups (evidence: `src/channel.cc`)
- Channel processor → Station decoder: decodes station (evidence: `src/channel.cc`)
- Station decoder → RDS text: assembles text (evidence: `src/station.cc`)
- Station decoder → TMC service: dispatches TMC
- TMC service → TMC message decoder: decodes messages (evidence: `src/tmc/tmc.cc`)
- TMC service → TMC event data: loads event data (evidence: `src/tmc/tmc.cc`)
- TMC event data → Event definitions: reads definitions
- TMC service → Location databases: uses locations (evidence: `src/tmc/tmc.cc`)
- Station decoder → RDS tables: looks up codes (evidence: `src/station.cc`)
- Station decoder → JSON and hex output: emits decoded data
- CLI user → CLI options: sets options
- RDS text → Character conversion: converts encoding (evidence: `src/text/rdsstring.cc`)
- JSON and hex output → CLI user: prints JSON or hex (evidence: `README.md`)
