# sobmachine/audio-codec architecture

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

- Interactive diagram: https://gitdiagram.com/sobmachine/audio-codec
- Repository: https://github.com/sobmachine/audio-codec

## Overview

BLOS is a small single-file C audio codec. Its user workflow is command-line WAV encoding to `.blos`, or `.blos` decoding back to WAV. The graph separates the two directions and the major documented codec stages, while keeping implementation paths at the only source file. The excerpts show command dispatch and portions of encoding and decoding; some stage relationships are based on README descriptions rather than sampled call sites.

Main entry points: [`src/main.c`](https://github.com/sobmachine/audio-codec/blob/main/src/main.c) (Encode file)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Command interface"]
  node_cli["CLI dispatch<br/>[main.c]"]
end

subgraph group_encode["Encoding"]
  node_encode_file["Encode file<br/>[main.c]"]
  node_lpc["LPC analysis<br/>[main.c]"]
  node_mid_side["Mid/side coding<br/>[main.c]"]
  node_residual["Residual coding<br/>[main.c]"]
end

subgraph group_decode["Decoding"]
  node_decode_file["Decode file<br/>[main.c]"]
  node_reconstruct["Frame reconstruction<br/>[main.c]"]
end

node_user(("User"))
node_wav_input["WAV input"]
node_blos_stream["BLOS stream"]
node_wav_output["WAV output"]

node_user -->|"invokes"| node_cli
node_cli -->|"dispatches"| node_encode_file
node_cli -->|"dispatches"| node_decode_file
node_wav_input -->|"reads"| node_encode_file
node_encode_file -->|"analyzes frames"| node_lpc
node_encode_file -->|"transforms stereo"| node_mid_side
node_encode_file -->|"codes residuals"| node_residual
node_encode_file -->|"writes"| node_blos_stream
node_blos_stream -->|"reads"| node_decode_file
node_decode_file -->|"reconstructs frames"| node_reconstruct
node_decode_file -->|"writes"| node_wav_output

click node_cli "https://github.com/sobmachine/audio-codec/blob/main/src/main.c"
click node_encode_file "https://github.com/sobmachine/audio-codec/blob/main/src/main.c"
click node_lpc "https://github.com/sobmachine/audio-codec/blob/main/src/main.c"
click node_mid_side "https://github.com/sobmachine/audio-codec/blob/main/src/main.c"
click node_residual "https://github.com/sobmachine/audio-codec/blob/main/src/main.c"
click node_decode_file "https://github.com/sobmachine/audio-codec/blob/main/src/main.c"
click node_reconstruct "https://github.com/sobmachine/audio-codec/blob/main/src/main.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_cli,node_user toneBlue
class node_encode_file,node_lpc,node_mid_side,node_residual toneAmber
class node_decode_file,node_reconstruct toneMint
class node_wav_input,node_blos_stream,node_wav_output toneIndigo
```

## Components

### Command interface

- [CLI dispatch](https://github.com/sobmachine/audio-codec/blob/main/src/main.c): `src/main.c`

### Encoding

- [Encode file](https://github.com/sobmachine/audio-codec/blob/main/src/main.c): `src/main.c`
- [LPC analysis](https://github.com/sobmachine/audio-codec/blob/main/src/main.c): `src/main.c`
- [Mid/side coding](https://github.com/sobmachine/audio-codec/blob/main/src/main.c): `src/main.c`
- [Residual coding](https://github.com/sobmachine/audio-codec/blob/main/src/main.c): `src/main.c`

### Decoding

- [Decode file](https://github.com/sobmachine/audio-codec/blob/main/src/main.c): `src/main.c`
- [Frame reconstruction](https://github.com/sobmachine/audio-codec/blob/main/src/main.c): `src/main.c`

### Other components

- **User**
- **WAV input**
- **BLOS stream**
- **WAV output**

## Connections

- User → CLI dispatch: invokes (evidence: `README.md`)
- CLI dispatch → Encode file: dispatches (evidence: `src/main.c`)
- CLI dispatch → Decode file: dispatches (evidence: `src/main.c`)
- WAV input → Encode file: reads (evidence: `README.md`)
- Encode file → LPC analysis: analyzes frames (evidence: `README.md`)
- Encode file → Mid/side coding: transforms stereo (evidence: `README.md`)
- Encode file → Residual coding: codes residuals (evidence: `README.md`)
- Encode file → BLOS stream: writes (evidence: `src/main.c`)
- BLOS stream → Decode file: reads (evidence: `README.md`)
- Decode file → Frame reconstruction: reconstructs frames (evidence: `src/main.c`)
- Decode file → WAV output: writes (evidence: `README.md`)
