# marklindstorff/image2wave architecture

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

- Interactive diagram: https://gitdiagram.com/marklindstorff/image2wave
- Repository: https://github.com/marklindstorff/image2wave

## Overview

Image2Wave is a CLI converter that turns an image into a wavetable-ready WAV. The user supplies an image and may specify an output path; the CLI loads the image, converts it to a grayscale heightmap, samples columns into waveform frames, normalizes them, and exports the concatenated frames as mono WAV. The README identifies synthesizers such as Serum as intended consumers. The sampled source shows the CLI’s calls and conversion details; the synthesizer handoff is documented rather than implemented here.

Main entry points: [`image2wave/main.py`](https://github.com/marklindstorff/image2wave/blob/main/image2wave/main.py) (CLI workflow), [`image2wave/exporter.py`](https://github.com/marklindstorff/image2wave/blob/main/image2wave/exporter.py) (WAV export), [`image2wave/image_loader.py`](https://github.com/marklindstorff/image2wave/blob/main/image2wave/image_loader.py) (Image loader), [`image2wave/heightmap.py`](https://github.com/marklindstorff/image2wave/blob/main/image2wave/heightmap.py) (Heightmap conversion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Input and CLI"]
  node_cli["CLI workflow<br/>[main.py]"]
  node_loader["Image loader<br/>[image_loader.py]"]
end

subgraph group_conversion["Signal conversion"]
  node_heightmap["Heightmap conversion<br/>[heightmap.py]"]
  node_frames["Frame sampling<br/>[wavetable.py]"]
end

subgraph group_output["WAV output"]
  node_normalize["Global normalization<br/>[exporter.py]"]
  node_export["WAV export<br/>[exporter.py]"]
  node_wav["WAV file"]
end

node_user(("User"))
node_synth["Wavetable synthesizer"]

node_user -->|"runs"| node_cli
node_cli -->|"loads image"| node_loader
node_cli -->|"converts image"| node_heightmap
node_cli -->|"slices frames"| node_frames
node_cli -->|"normalizes frames"| node_normalize
node_cli -->|"exports frames"| node_export
node_export -->|"writes WAV"| node_wav
node_wav -->|"imports as wavetable"| node_synth

click node_cli "https://github.com/marklindstorff/image2wave/blob/main/image2wave/main.py"
click node_loader "https://github.com/marklindstorff/image2wave/blob/main/image2wave/image_loader.py"
click node_heightmap "https://github.com/marklindstorff/image2wave/blob/main/image2wave/heightmap.py"
click node_frames "https://github.com/marklindstorff/image2wave/blob/main/image2wave/wavetable.py"
click node_normalize "https://github.com/marklindstorff/image2wave/blob/main/image2wave/exporter.py"
click node_export "https://github.com/marklindstorff/image2wave/blob/main/image2wave/exporter.py"

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_loader,node_user toneBlue
class node_heightmap,node_frames toneAmber
class node_normalize,node_export,node_wav toneMint
class node_synth toneIndigo
```

## Components

### Input and CLI

- [CLI workflow](https://github.com/marklindstorff/image2wave/blob/main/image2wave/main.py): `image2wave/main.py`
- [Image loader](https://github.com/marklindstorff/image2wave/blob/main/image2wave/image_loader.py): `image2wave/image_loader.py`

### Signal conversion

- [Heightmap conversion](https://github.com/marklindstorff/image2wave/blob/main/image2wave/heightmap.py): `image2wave/heightmap.py`
- [Frame sampling](https://github.com/marklindstorff/image2wave/blob/main/image2wave/wavetable.py): `image2wave/wavetable.py`

### WAV output

- [Global normalization](https://github.com/marklindstorff/image2wave/blob/main/image2wave/exporter.py): `image2wave/exporter.py`
- [WAV export](https://github.com/marklindstorff/image2wave/blob/main/image2wave/exporter.py): `image2wave/exporter.py`
- **WAV file**

### Other components

- **User**
- **Wavetable synthesizer**

## Connections

- User → CLI workflow: runs (evidence: `README.md`)
- CLI workflow → Image loader: loads image (evidence: `image2wave/main.py`)
- CLI workflow → Heightmap conversion: converts image (evidence: `image2wave/main.py`)
- CLI workflow → Frame sampling: slices frames (evidence: `image2wave/main.py`)
- CLI workflow → Global normalization: normalizes frames (evidence: `image2wave/main.py`)
- CLI workflow → WAV export: exports frames (evidence: `image2wave/main.py`)
- WAV export → WAV file: writes WAV (evidence: `image2wave/exporter.py`)
- WAV file → Wavetable synthesizer: imports as wavetable (evidence: `README.md`)
