# cynthefer/nelva architecture

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

- Interactive diagram: https://gitdiagram.com/cynthefer/nelva
- Repository: https://github.com/cynthefer/nelva

## Overview

Nelva is a minimal Linux DAW: the user launches it with an optional WAV, controls playback and tempo in an X11 window, and hears audio through ALSA. The visible runtime path runs from main through the UI and audio engine; the engine loads WAV samples, reads shared transport state, and renders blocks to the device. The README also lists a sine test voice, master meter/gain, and JSON project save/load, but their implementation is not established by the excerpts. The graph preserves these documented capabilities without asserting unshown connections.

Main entry points: [`src/main.c`](https://github.com/cynthefer/nelva/blob/main/src/main.c) (Application entry), [`src/audio/engine.c`](https://github.com/cynthefer/nelva/blob/main/src/audio/engine.c) (Audio engine), [`src/ui/window.c`](https://github.com/cynthefer/nelva/blob/main/src/ui/window.c) (X11 window), [`src/audio/device.c`](https://github.com/cynthefer/nelva/blob/main/src/audio/device.c) (ALSA device)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application UI"]
  node_main["Application entry<br/>[main.c]"]
  node_window["X11 window<br/>[window.c]"]
  node_font["Bitmap font<br/>[font.c]"]
end

subgraph group_audio["Audio runtime"]
  node_engine["Audio engine<br/>[engine.c]"]
  node_transport["Playback transport<br/>[transport.c]"]
  node_device["ALSA device<br/>[device.c]"]
end

subgraph group_media["Media and DSP"]
  node_wav["WAV loader<br/>[wav.c]"]
  node_sample["Audio sample<br/>[sample.h]"]
  node_osc["Sine oscillator<br/>[osc.c]"]
  node_project["JSON project save/load"]
end

subgraph group_foundation["Core services"]
  node_log["Logging<br/>[log.c]"]
  node_time["Clock service<br/>[time.c]"]
  node_result["Error results<br/>[result.c]"]
end

node_user(("DAW user"))
node_alsa(("ALSA audio"))

node_user -->|"launches"| node_main
node_main -->|"creates"| node_engine
node_main -->|"loads WAV"| node_engine
node_main -->|"gets transport"| node_transport
node_main -->|"runs UI"| node_window
node_window -->|"dispatches callbacks"| node_main
node_main -->|"controls playback"| node_transport
node_main -->|"draws controls"| node_window
node_window -->|"renders text"| node_font
node_engine -->|"advances state"| node_transport
node_engine -->|"starts callback"| node_device
node_device -->|"requests audio"| node_engine
node_engine -->|"loads sample"| node_wav
node_wav -->|"fills sample"| node_sample
node_device -->|"outputs audio"| node_alsa
node_engine -.->|"uses voice"| node_osc
node_user -.->|"saves or loads"| node_project
node_engine -->|"logs status"| node_log
node_window -->|"reads clock"| node_time

click node_main "https://github.com/cynthefer/nelva/blob/main/src/main.c"
click node_window "https://github.com/cynthefer/nelva/blob/main/src/ui/window.c"
click node_font "https://github.com/cynthefer/nelva/blob/main/src/ui/font.c"
click node_engine "https://github.com/cynthefer/nelva/blob/main/src/audio/engine.c"
click node_transport "https://github.com/cynthefer/nelva/blob/main/src/audio/transport.c"
click node_device "https://github.com/cynthefer/nelva/blob/main/src/audio/device.c"
click node_wav "https://github.com/cynthefer/nelva/blob/main/src/io/wav.c"
click node_sample "https://github.com/cynthefer/nelva/blob/main/include/nelva/model/sample.h"
click node_osc "https://github.com/cynthefer/nelva/blob/main/src/dsp/osc.c"
click node_log "https://github.com/cynthefer/nelva/blob/main/src/core/log.c"
click node_time "https://github.com/cynthefer/nelva/blob/main/src/core/time.c"
click node_result "https://github.com/cynthefer/nelva/blob/main/src/core/result.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_main,node_window,node_font,node_user toneBlue
class node_engine,node_transport,node_device toneAmber
class node_wav,node_sample,node_osc,node_project toneMint
class node_log,node_time,node_result toneRose
class node_alsa toneIndigo
```

## Components

### Application UI

- [Application entry](https://github.com/cynthefer/nelva/blob/main/src/main.c): `src/main.c`
- [X11 window](https://github.com/cynthefer/nelva/blob/main/src/ui/window.c): `src/ui/window.c`
- [Bitmap font](https://github.com/cynthefer/nelva/blob/main/src/ui/font.c): `src/ui/font.c`

### Audio runtime

- [Audio engine](https://github.com/cynthefer/nelva/blob/main/src/audio/engine.c): `src/audio/engine.c`
- [Playback transport](https://github.com/cynthefer/nelva/blob/main/src/audio/transport.c): `src/audio/transport.c`
- [ALSA device](https://github.com/cynthefer/nelva/blob/main/src/audio/device.c): `src/audio/device.c`

### Media and DSP

- [WAV loader](https://github.com/cynthefer/nelva/blob/main/src/io/wav.c): `src/io/wav.c`
- [Audio sample](https://github.com/cynthefer/nelva/blob/main/include/nelva/model/sample.h): `include/nelva/model/sample.h`
- [Sine oscillator](https://github.com/cynthefer/nelva/blob/main/src/dsp/osc.c): `src/dsp/osc.c`
- **JSON project save/load**

### Core services

- [Logging](https://github.com/cynthefer/nelva/blob/main/src/core/log.c): `src/core/log.c`
- [Clock service](https://github.com/cynthefer/nelva/blob/main/src/core/time.c): `src/core/time.c`
- [Error results](https://github.com/cynthefer/nelva/blob/main/src/core/result.c): `src/core/result.c`

### Other components

- **DAW user**
- **ALSA audio**

## Connections

- DAW user → Application entry: launches (evidence: `README.md`)
- Application entry → Audio engine: creates (evidence: `src/main.c`)
- Application entry → Audio engine: loads WAV (evidence: `src/main.c`)
- Application entry → Playback transport: gets transport (evidence: `src/main.c`)
- Application entry → X11 window: runs UI (evidence: `src/main.c`)
- X11 window → Application entry: dispatches callbacks (evidence: `src/ui/window.c`)
- Application entry → Playback transport: controls playback (evidence: `src/main.c`)
- Application entry → X11 window: draws controls (evidence: `src/main.c`)
- X11 window → Bitmap font: renders text (evidence: `src/ui/window.c`)
- Audio engine → Playback transport: advances state (evidence: `src/audio/engine.c`)
- Audio engine → ALSA device: starts callback (evidence: `src/audio/engine.c`)
- ALSA device → Audio engine: requests audio (evidence: `src/audio/engine.c`)
- Audio engine → WAV loader: loads sample (evidence: `src/audio/engine.c`)
- WAV loader → Audio sample: fills sample
- ALSA device → ALSA audio: outputs audio
- Audio engine → Sine oscillator: uses voice
- DAW user → JSON project save/load: saves or loads (evidence: `README.md`)
- Audio engine → Logging: logs status (evidence: `src/audio/engine.c`)
- X11 window → Clock service: reads clock (evidence: `src/ui/window.c`)
