# sathurshan03/swaratone architecture

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

- Interactive diagram: https://gitdiagram.com/sathurshan03/swaratone
- Repository: https://github.com/sathurshan03/swaratone

## Overview

SwaraTone is a lightweight audio decomposition and source-separation toolkit. Its visible entry flow accepts a file path, parses command-line options, and invokes core processing; the README identifies decomposition as the product goal. The source tree also contains WAV/MP3 handling, spectral transforms, HPSS and REPET features, reconstruction, and visualization. Several processing and format implementations are unsampled, so their connections to core processing are shown as unverified rather than asserted; edges reflect only visible calls, indexed references, or README claims.

Main entry points: [`src/core/coreLogic.cpp`](https://github.com/sathurshan03/swaratone/blob/main/src/core/coreLogic.cpp) (Core processing), [`src/main.cpp`](https://github.com/sathurshan03/swaratone/blob/main/src/main.cpp) (Application main), [`src/features/hpss.cpp`](https://github.com/sathurshan03/swaratone/blob/main/src/features/hpss.cpp) (HPSS separation), [`src/features/repet/repet.cpp`](https://github.com/sathurshan03/swaratone/blob/main/src/features/repet/repet.cpp) (REPET separation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_main["Application main<br/>[main.cpp]"]
  node_arguments["Argument parsing<br/>[argParser.cpp]"]
  node_core["Core processing<br/>[coreLogic.cpp]"]
  node_sample["Sample data<br/>[sampleData.cpp]"]
end

subgraph group_audio["Audio input"]
  node_mp3["MP3 decoding<br/>[mp3.cpp]"]
  node_minimp3["MP3 codec<br/>[minimp3.h]"]
  node_wav["WAV encoding<br/>[wav_encoding.cpp]"]
end

subgraph group_analysis["Signal analysis"]
  node_spectrum["Spectrum analysis<br/>[spectrum.cpp]"]
  node_fft["Forward FFT<br/>[fft.cpp]"]
end

subgraph group_separation["Separation methods"]
  node_hpss["HPSS separation<br/>[hpss.cpp]"]
  node_mask["HPSS masks<br/>[hpssMask.cpp]"]
  node_repet["REPET separation<br/>[repet.cpp]"]
  node_beat_spectrum["Beat spectrum<br/>[beat_spectrum.cpp]"]
  node_repeating_period["Repeating period"]
  node_soft_mask["Beat soft mask<br/>[beat_soft_mask.cpp]"]
end

subgraph group_output["Reconstruction and display"]
  node_reconstruction["Signal reconstruction"]
  node_ifft["Inverse FFT<br/>[ifft.cpp]"]
  node_visualization["Plots and graphs<br/>[plot.cpp]"]
  node_heatmap["Heat-map graph<br/>[heatMapGraph.cpp]"]
  node_linegraph["Line graph<br/>[lineGraph.cpp]"]
end

subgraph group_foundation["Shared foundations"]
  node_matrix["Matrix operations<br/>[matrix.hpp]"]
  node_statistics["Statistics helpers<br/>[stats.h]"]
end

node_user(("CLI user"))

node_user -->|"runs"| node_main
node_main -->|"parses options"| node_arguments
node_main -->|"invokes processing"| node_core
node_main -->|"imports"| node_sample
node_core -.->|"uses decoder"| node_mp3
node_core -.->|"may decode WAV"| node_wav
node_core -.->|"analyzes audio"| node_spectrum
node_spectrum -.->|"uses transform"| node_fft
node_core -.->|"may separate sources"| node_hpss
node_hpss -->|"applies masks"| node_mask
node_hpss -->|"computes medians"| node_statistics
node_core -.->|"may run REPET"| node_repet
node_repet -.->|"uses beat analysis"| node_beat_spectrum
node_repet -.->|"uses period estimate"| node_repeating_period
node_repet -.->|"uses soft mask"| node_soft_mask
node_core -.->|"may reconstruct"| node_reconstruction
node_reconstruction -->|"calls inverse transform"| node_ifft
node_core -.->|"may display results"| node_visualization
node_visualization -.->|"uses graph"| node_heatmap
node_visualization -.->|"uses graph"| node_linegraph
node_hpss -->|"operates on matrices"| node_matrix
node_mask -->|"operates on matrices"| node_matrix
node_mp3 -.->|"uses codec"| node_minimp3

click node_main "https://github.com/sathurshan03/swaratone/blob/main/src/main.cpp"
click node_arguments "https://github.com/sathurshan03/swaratone/blob/main/src/core/argParser.cpp"
click node_core "https://github.com/sathurshan03/swaratone/blob/main/src/core/coreLogic.cpp"
click node_sample "https://github.com/sathurshan03/swaratone/blob/main/src/core/sampleData.cpp"
click node_mp3 "https://github.com/sathurshan03/swaratone/blob/main/src/audio_file/mp3/mp3.cpp"
click node_minimp3 "https://github.com/sathurshan03/swaratone/blob/main/src/audio_file/mp3/minimp3.h"
click node_wav "https://github.com/sathurshan03/swaratone/blob/main/src/audio_file/wav/wav_encoding.cpp"
click node_spectrum "https://github.com/sathurshan03/swaratone/blob/main/src/features/spectrum.cpp"
click node_fft "https://github.com/sathurshan03/swaratone/blob/main/src/fft/fft.cpp"
click node_hpss "https://github.com/sathurshan03/swaratone/blob/main/src/features/hpss.cpp"
click node_mask "https://github.com/sathurshan03/swaratone/blob/main/src/mask/hpssMask.cpp"
click node_repet "https://github.com/sathurshan03/swaratone/blob/main/src/features/repet/repet.cpp"
click node_beat_spectrum "https://github.com/sathurshan03/swaratone/blob/main/src/features/repet/beat_spectrum.cpp"
click node_repeating_period "https://github.com/sathurshan03/swaratone/blob/main/src/features/repet/repeating_period.cpp"
click node_soft_mask "https://github.com/sathurshan03/swaratone/blob/main/src/features/repet/beat_soft_mask.cpp"
click node_reconstruction "https://github.com/sathurshan03/swaratone/blob/main/src/features/signalReconstruction.cpp"
click node_ifft "https://github.com/sathurshan03/swaratone/blob/main/src/fft/ifft.cpp"
click node_visualization "https://github.com/sathurshan03/swaratone/blob/main/src/viz/graphs/plot.cpp"
click node_heatmap "https://github.com/sathurshan03/swaratone/blob/main/src/viz/graphs/heatMapGraph.cpp"
click node_linegraph "https://github.com/sathurshan03/swaratone/blob/main/src/viz/graphs/lineGraph.cpp"
click node_matrix "https://github.com/sathurshan03/swaratone/blob/main/src/helper/math/matrix.hpp"
click node_statistics "https://github.com/sathurshan03/swaratone/blob/main/src/helper/math/stats.h"

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_arguments,node_core,node_sample,node_user toneBlue
class node_mp3,node_minimp3,node_wav toneAmber
class node_spectrum,node_fft toneMint
class node_hpss,node_mask,node_repet,node_beat_spectrum,node_repeating_period,node_soft_mask toneRose
class node_reconstruction,node_ifft,node_visualization,node_heatmap,node_linegraph toneIndigo
class node_matrix,node_statistics toneTeal
```

## Components

### Application entry

- [Application main](https://github.com/sathurshan03/swaratone/blob/main/src/main.cpp): `src/main.cpp`
- [Argument parsing](https://github.com/sathurshan03/swaratone/blob/main/src/core/argParser.cpp): `src/core/argParser.cpp`
- [Core processing](https://github.com/sathurshan03/swaratone/blob/main/src/core/coreLogic.cpp): `src/core/coreLogic.cpp`
- [Sample data](https://github.com/sathurshan03/swaratone/blob/main/src/core/sampleData.cpp): `src/core/sampleData.cpp`

### Audio input

- [MP3 decoding](https://github.com/sathurshan03/swaratone/blob/main/src/audio_file/mp3/mp3.cpp): `src/audio_file/mp3/mp3.cpp`
- [MP3 codec](https://github.com/sathurshan03/swaratone/blob/main/src/audio_file/mp3/minimp3.h): `src/audio_file/mp3/minimp3.h`
- [WAV encoding](https://github.com/sathurshan03/swaratone/blob/main/src/audio_file/wav/wav_encoding.cpp): `src/audio_file/wav/wav_encoding.cpp`

### Signal analysis

- [Spectrum analysis](https://github.com/sathurshan03/swaratone/blob/main/src/features/spectrum.cpp): `src/features/spectrum.cpp`
- [Forward FFT](https://github.com/sathurshan03/swaratone/blob/main/src/fft/fft.cpp): `src/fft/fft.cpp`

### Separation methods

- [HPSS separation](https://github.com/sathurshan03/swaratone/blob/main/src/features/hpss.cpp): `src/features/hpss.cpp`
- [HPSS masks](https://github.com/sathurshan03/swaratone/blob/main/src/mask/hpssMask.cpp): `src/mask/hpssMask.cpp`
- [REPET separation](https://github.com/sathurshan03/swaratone/blob/main/src/features/repet/repet.cpp): `src/features/repet/repet.cpp`
- [Beat spectrum](https://github.com/sathurshan03/swaratone/blob/main/src/features/repet/beat_spectrum.cpp): `src/features/repet/beat_spectrum.cpp`
- [Repeating period](https://github.com/sathurshan03/swaratone/blob/main/src/features/repet/repeating_period.cpp): `src/features/repet/repeating_period.cpp`
- [Beat soft mask](https://github.com/sathurshan03/swaratone/blob/main/src/features/repet/beat_soft_mask.cpp): `src/features/repet/beat_soft_mask.cpp`

### Reconstruction and display

- [Signal reconstruction](https://github.com/sathurshan03/swaratone/blob/main/src/features/signalReconstruction.cpp): `src/features/signalReconstruction.cpp`
- [Inverse FFT](https://github.com/sathurshan03/swaratone/blob/main/src/fft/ifft.cpp): `src/fft/ifft.cpp`
- [Plots and graphs](https://github.com/sathurshan03/swaratone/blob/main/src/viz/graphs/plot.cpp): `src/viz/graphs/plot.cpp`
- [Heat-map graph](https://github.com/sathurshan03/swaratone/blob/main/src/viz/graphs/heatMapGraph.cpp): `src/viz/graphs/heatMapGraph.cpp`
- [Line graph](https://github.com/sathurshan03/swaratone/blob/main/src/viz/graphs/lineGraph.cpp): `src/viz/graphs/lineGraph.cpp`

### Shared foundations

- [Matrix operations](https://github.com/sathurshan03/swaratone/blob/main/src/helper/math/matrix.hpp): `src/helper/math/matrix.hpp`
- [Statistics helpers](https://github.com/sathurshan03/swaratone/blob/main/src/helper/math/stats.h): `src/helper/math/stats.h`

### Other components

- **CLI user**

## Connections

- CLI user → Application main: runs (evidence: `src/main.cpp`)
- Application main → Argument parsing: parses options (evidence: `src/main.cpp`)
- Application main → Core processing: invokes processing (evidence: `src/main.cpp`)
- Application main → Sample data: imports (evidence: `src/main.cpp`)
- Core processing → MP3 decoding: uses decoder
- Core processing → WAV encoding: may decode WAV
- Core processing → Spectrum analysis: analyzes audio
- Spectrum analysis → Forward FFT: uses transform
- Core processing → HPSS separation: may separate sources
- HPSS separation → HPSS masks: applies masks (evidence: `src/features/hpss.cpp`)
- HPSS separation → Statistics helpers: computes medians (evidence: `src/features/hpss.cpp`)
- Core processing → REPET separation: may run REPET
- REPET separation → Beat spectrum: uses beat analysis
- REPET separation → Repeating period: uses period estimate
- REPET separation → Beat soft mask: uses soft mask
- Core processing → Signal reconstruction: may reconstruct
- Signal reconstruction → Inverse FFT: calls inverse transform (evidence: `src/features/signalReconstruction.cpp`)
- Core processing → Plots and graphs: may display results
- Plots and graphs → Heat-map graph: uses graph
- Plots and graphs → Line graph: uses graph
- HPSS separation → Matrix operations: operates on matrices (evidence: `src/features/hpss.cpp`)
- HPSS masks → Matrix operations: operates on matrices
- MP3 decoding → MP3 codec: uses codec
