# gabyfle/soundml architecture

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

- Interactive diagram: https://gitdiagram.com/gabyfle/soundml
- Repository: https://github.com/gabyfle/soundml
- Video tour (about a minute): https://gitdiagram.com/gabyfle/soundml/video

## Overview

SoundML is an OCaml audio-processing library distributed as a core package and a separate audio-file I/O package. Its user-facing capabilities include feature extraction, effects, and audio decoding/encoding, with resampling also documented for the I/O package. The tree identifies the principal implementation modules, but their contents were not sampled; the graph therefore avoids inferring calls or a processing sequence. Relationships shown are limited to README-documented package capabilities and dependencies.

Main entry points: [`soundml/lib/soundml.ml`](https://github.com/gabyfle/soundml/blob/main/soundml/lib/soundml.ml) (SoundML API), [`soundml-io/lib/soundml_io.ml`](https://github.com/gabyfle/soundml/blob/main/soundml-io/lib/soundml_io.ml) (SoundML I/O API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Core DSP"]
  node_soundml["SoundML API<br/>[soundml.ml]"]
  node_pipeline["Processing pipelines<br/>[pipeline.ml]"]
  node_stft["STFT<br/>[stft.ml]"]
  node_spectral["Spectral transforms<br/>[spectral.ml]"]
  node_istft["Inverse STFT<br/>[convert.ml]"]
  node_window["Windows<br/>[window.ml]"]
  node_resample["Resampling<br/>[resample.ml]"]
  node_resample_native["Resampling native code<br/>[resample_stubs.c]"]
  node_effects["Audio effects<br/>[effects.ml]"]
  node_hpss["Harmonic separation<br/>[hpss.ml]"]
end

subgraph group_features["Audio Features"]
  node_mel["Mel features<br/>[mel.ml]"]
  node_chroma["Chroma features<br/>[chroma.ml]"]
  node_cqt["Constant-Q transform<br/>[cqt.ml]"]
  node_energy["Energy features<br/>[energy.ml]"]
  node_onset["Onset features<br/>[onset.ml]"]
  node_contrast["Spectral contrast<br/>[contrast.ml]"]
  node_db["Decibel conversion<br/>[db.ml]"]
end

subgraph group_io["Audio File I/O"]
  node_io_api["SoundML I/O API<br/>[soundml_io.ml]"]
  node_io_native["I/O native bindings<br/>[soundml_io_stubs.c]"]
end

node_user(("Library user"))
node_nx["Nx dependency"]
node_libsndfile["libsndfile"]

node_user -->|"uses"| node_soundml
node_user -->|"uses"| node_io_api
node_soundml -->|"depends on"| node_nx
node_io_api -->|"binds to"| node_libsndfile

click node_soundml "https://github.com/gabyfle/soundml/blob/main/soundml/lib/soundml.ml"
click node_pipeline "https://github.com/gabyfle/soundml/blob/main/soundml/lib/pipeline.ml"
click node_stft "https://github.com/gabyfle/soundml/blob/main/soundml/lib/stft.ml"
click node_spectral "https://github.com/gabyfle/soundml/blob/main/soundml/lib/spectral.ml"
click node_istft "https://github.com/gabyfle/soundml/blob/main/soundml/lib/convert.ml"
click node_window "https://github.com/gabyfle/soundml/blob/main/soundml/lib/window.ml"
click node_resample "https://github.com/gabyfle/soundml/blob/main/soundml/lib/resample.ml"
click node_resample_native "https://github.com/gabyfle/soundml/blob/main/soundml/lib/resample_stubs.c"
click node_effects "https://github.com/gabyfle/soundml/blob/main/soundml/lib/effects.ml"
click node_hpss "https://github.com/gabyfle/soundml/blob/main/soundml/lib/hpss.ml"
click node_mel "https://github.com/gabyfle/soundml/blob/main/soundml/lib/mel.ml"
click node_chroma "https://github.com/gabyfle/soundml/blob/main/soundml/lib/chroma.ml"
click node_cqt "https://github.com/gabyfle/soundml/blob/main/soundml/lib/cqt.ml"
click node_energy "https://github.com/gabyfle/soundml/blob/main/soundml/lib/energy.ml"
click node_onset "https://github.com/gabyfle/soundml/blob/main/soundml/lib/onset.ml"
click node_contrast "https://github.com/gabyfle/soundml/blob/main/soundml/lib/contrast.ml"
click node_db "https://github.com/gabyfle/soundml/blob/main/soundml/lib/db.ml"
click node_io_api "https://github.com/gabyfle/soundml/blob/main/soundml-io/lib/soundml_io.ml"
click node_io_native "https://github.com/gabyfle/soundml/blob/main/soundml-io/lib/soundml_io_stubs.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_soundml,node_pipeline,node_stft,node_spectral,node_istft,node_window,node_resample,node_resample_native,node_effects,node_hpss,node_user toneBlue
class node_mel,node_chroma,node_cqt,node_energy,node_onset,node_contrast,node_db toneAmber
class node_io_api,node_io_native toneMint
class node_nx,node_libsndfile toneIndigo
```

## Components

### Core DSP

- [SoundML API](https://github.com/gabyfle/soundml/blob/main/soundml/lib/soundml.ml): `soundml/lib/soundml.ml`
- [Processing pipelines](https://github.com/gabyfle/soundml/blob/main/soundml/lib/pipeline.ml): `soundml/lib/pipeline.ml`
- [STFT](https://github.com/gabyfle/soundml/blob/main/soundml/lib/stft.ml): `soundml/lib/stft.ml`
- [Spectral transforms](https://github.com/gabyfle/soundml/blob/main/soundml/lib/spectral.ml): `soundml/lib/spectral.ml`
- [Inverse STFT](https://github.com/gabyfle/soundml/blob/main/soundml/lib/convert.ml): `soundml/lib/convert.ml`
- [Windows](https://github.com/gabyfle/soundml/blob/main/soundml/lib/window.ml): `soundml/lib/window.ml`
- [Resampling](https://github.com/gabyfle/soundml/blob/main/soundml/lib/resample.ml): `soundml/lib/resample.ml`
- [Resampling native code](https://github.com/gabyfle/soundml/blob/main/soundml/lib/resample_stubs.c): `soundml/lib/resample_stubs.c`
- [Audio effects](https://github.com/gabyfle/soundml/blob/main/soundml/lib/effects.ml): `soundml/lib/effects.ml`
- [Harmonic separation](https://github.com/gabyfle/soundml/blob/main/soundml/lib/hpss.ml): `soundml/lib/hpss.ml`

### Audio Features

- [Mel features](https://github.com/gabyfle/soundml/blob/main/soundml/lib/mel.ml): `soundml/lib/mel.ml`
- [Chroma features](https://github.com/gabyfle/soundml/blob/main/soundml/lib/chroma.ml): `soundml/lib/chroma.ml`
- [Constant-Q transform](https://github.com/gabyfle/soundml/blob/main/soundml/lib/cqt.ml): `soundml/lib/cqt.ml`
- [Energy features](https://github.com/gabyfle/soundml/blob/main/soundml/lib/energy.ml): `soundml/lib/energy.ml`
- [Onset features](https://github.com/gabyfle/soundml/blob/main/soundml/lib/onset.ml): `soundml/lib/onset.ml`
- [Spectral contrast](https://github.com/gabyfle/soundml/blob/main/soundml/lib/contrast.ml): `soundml/lib/contrast.ml`
- [Decibel conversion](https://github.com/gabyfle/soundml/blob/main/soundml/lib/db.ml): `soundml/lib/db.ml`

### Audio File I/O

- [SoundML I/O API](https://github.com/gabyfle/soundml/blob/main/soundml-io/lib/soundml_io.ml): `soundml-io/lib/soundml_io.ml`
- [I/O native bindings](https://github.com/gabyfle/soundml/blob/main/soundml-io/lib/soundml_io_stubs.c): `soundml-io/lib/soundml_io_stubs.c`

### Other components

- **Library user**
- **Nx dependency**
- **libsndfile**

## Connections

- Library user → SoundML API: uses (evidence: `README.md`)
- Library user → SoundML I/O API: uses (evidence: `README.md`)
- SoundML API → Nx dependency: depends on (evidence: `README.md`)
- SoundML I/O API → libsndfile: binds to (evidence: `README.md`)
