# marimuthu-07/speakerflow architecture

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

- Interactive diagram: https://gitdiagram.com/marimuthu-07/speakerflow
- Repository: https://github.com/marimuthu-07/speakerflow

## Overview

SpeakerFlow is an Electron desktop audio manager. Users discover outputs and streams, select or route audio, and can start temporary multi-speaker sessions; the renderer sends controls through Electron IPC to audio services and platform backends. The README also documents wave-pattern and coordinate-based spatial movement. Windows has a separate WASAPI fan-out implementation. Some renderer and backend wiring is documented rather than shown in excerpts, so those links cite the README; unsampled implementation details are not inferred.

Main entry points: [`electron/main.cjs`](https://github.com/marimuthu-07/speakerflow/blob/main/electron/main.cjs) (Electron main), [`electron/audio/speakerEngineService.cjs`](https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/speakerEngineService.cjs) (Speaker sessions), [`electron/audio/waveEngineController.cjs`](https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/waveEngineController.cjs) (Wave controller), [`electron/audio/createAudioBackend.cjs`](https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/createAudioBackend.cjs) (Backend factory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop app"]
  node_renderer["Renderer UI<br/>[App.jsx]"]
  node_preload["Preload API<br/>[preload.cjs]"]
  node_main["Electron main<br/>[main.cjs]"]
end

subgraph group_audio["Audio services"]
  node_routing["Stream routing"]
  node_speaker["Speaker sessions"]
  node_factory["Backend factory"]
  node_linux["PipeWire backend"]
  node_linuxpipe["PipeWire pipeline"]
  node_windows["Windows backend"]
  node_winpipe["WASAPI pipeline"]
  node_delays[("Device delays")]
end

subgraph group_motion["Motion engines"]
  node_controller["Wave controller"]
  node_patterns["Wave patterns<br/>[wavePatterns.cjs]"]
  node_spatial["Spatial audio<br/>[spatialAudio.cjs]"]
  node_motionengine["Motion models<br/>[motionEngine.cjs]"]
end

subgraph group_native["Native audio"]
  node_binding["PipeWire addon<br/>[pipewire_binding.c]"]
  node_corebinding["Core Audio binding"]
  node_fanout["WASAPI fan-out"]
  node_capture["WASAPI capture"]
  node_render["WASAPI render"]
  node_format["Format pipeline"]
  node_drift["Drift correction"]
end

node_user(("User"))
node_pipewire{{"PipeWire"}}

node_user -->|"controls"| node_renderer
node_renderer -->|"requests"| node_preload
node_preload -->|"invokes IPC"| node_main
node_main -->|"creates backend"| node_factory
node_main -->|"routes streams"| node_routing
node_main -->|"starts sessions"| node_speaker
node_factory -->|"selects platform"| node_linux
node_factory -->|"selects platform"| node_windows
node_speaker -->|"creates pipeline"| node_factory
node_speaker -->|"updates branches"| node_controller
node_speaker -->|"reads delays"| node_delays
node_linux -->|"calls addon"| node_binding
node_binding -->|"uses native API"| node_pipewire
node_linux -->|"provides pipeline"| node_linuxpipe
node_windows -->|"loads binding"| node_corebinding
node_windows -->|"provides pipeline"| node_winpipe
node_controller -->|"calculates gains"| node_patterns
node_controller -->|"calculates spatial gains"| node_spatial
node_controller -->|"uses motion models"| node_motionengine
node_corebinding -.->|"controls engine"| node_fanout
node_fanout -->|"fans out capture"| node_capture
node_fanout -->|"starts branches"| node_render
node_render -.->|"processes audio"| node_format
node_render -.->|"corrects drift"| node_drift

click node_renderer "https://github.com/marimuthu-07/speakerflow/blob/main/src/App.jsx"
click node_preload "https://github.com/marimuthu-07/speakerflow/blob/main/electron/preload.cjs"
click node_main "https://github.com/marimuthu-07/speakerflow/blob/main/electron/main.cjs"
click node_routing "https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/streamRoutingService.cjs"
click node_speaker "https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/speakerEngineService.cjs"
click node_factory "https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/createAudioBackend.cjs"
click node_linux "https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/linuxPipeWireAudioBackend.cjs"
click node_linuxpipe "https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/linuxPipeWirePipelineAdapter.cjs"
click node_windows "https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/windowsCoreAudioBackend.cjs"
click node_winpipe "https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/windowsCoreAudioPipelineAdapter.cjs"
click node_delays "https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/deviceDelayStore.cjs"
click node_controller "https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/waveEngineController.cjs"
click node_patterns "https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/wavePatterns.cjs"
click node_spatial "https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/spatialAudio.cjs"
click node_motionengine "https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/motionEngine.cjs"
click node_binding "https://github.com/marimuthu-07/speakerflow/blob/main/native/pipewire_binding.c"
click node_corebinding "https://github.com/marimuthu-07/speakerflow/blob/main/native/windows/coreaudio_binding.cpp"
click node_fanout "https://github.com/marimuthu-07/speakerflow/blob/main/native/windows/wasapi_fanout_engine.h"
click node_capture "https://github.com/marimuthu-07/speakerflow/blob/main/native/windows/wasapi_capture_client.h"
click node_render "https://github.com/marimuthu-07/speakerflow/blob/main/native/windows/wasapi_render_client.h"
click node_format "https://github.com/marimuthu-07/speakerflow/blob/main/native/windows/audio_format_pipeline.h"
click node_drift "https://github.com/marimuthu-07/speakerflow/blob/main/native/windows/audio_drift_controller.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_renderer,node_preload,node_main,node_user toneBlue
class node_routing,node_speaker,node_factory,node_linux,node_linuxpipe,node_windows,node_winpipe,node_delays toneAmber
class node_controller,node_patterns,node_spatial,node_motionengine toneMint
class node_binding,node_corebinding,node_fanout,node_capture,node_render,node_format,node_drift toneRose
class node_pipewire toneIndigo
```

## Components

### Desktop app

- [Renderer UI](https://github.com/marimuthu-07/speakerflow/blob/main/src/App.jsx): `src/App.jsx`
- [Preload API](https://github.com/marimuthu-07/speakerflow/blob/main/electron/preload.cjs): `electron/preload.cjs`
- [Electron main](https://github.com/marimuthu-07/speakerflow/blob/main/electron/main.cjs): `electron/main.cjs`

### Audio services

- [Stream routing](https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/streamRoutingService.cjs): `electron/audio/streamRoutingService.cjs`
- [Speaker sessions](https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/speakerEngineService.cjs): `electron/audio/speakerEngineService.cjs`
- [Backend factory](https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/createAudioBackend.cjs): `electron/audio/createAudioBackend.cjs`
- [PipeWire backend](https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/linuxPipeWireAudioBackend.cjs): `electron/audio/linuxPipeWireAudioBackend.cjs`
- [PipeWire pipeline](https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/linuxPipeWirePipelineAdapter.cjs): `electron/audio/linuxPipeWirePipelineAdapter.cjs`
- [Windows backend](https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/windowsCoreAudioBackend.cjs): `electron/audio/windowsCoreAudioBackend.cjs`
- [WASAPI pipeline](https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/windowsCoreAudioPipelineAdapter.cjs): `electron/audio/windowsCoreAudioPipelineAdapter.cjs`
- [Device delays](https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/deviceDelayStore.cjs): `electron/audio/deviceDelayStore.cjs`

### Motion engines

- [Wave controller](https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/waveEngineController.cjs): `electron/audio/waveEngineController.cjs`
- [Wave patterns](https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/wavePatterns.cjs): `electron/audio/wavePatterns.cjs`
- [Spatial audio](https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/spatialAudio.cjs): `electron/audio/spatialAudio.cjs`
- [Motion models](https://github.com/marimuthu-07/speakerflow/blob/main/electron/audio/motionEngine.cjs): `electron/audio/motionEngine.cjs`

### Native audio

- [PipeWire addon](https://github.com/marimuthu-07/speakerflow/blob/main/native/pipewire_binding.c): `native/pipewire_binding.c`
- [Core Audio binding](https://github.com/marimuthu-07/speakerflow/blob/main/native/windows/coreaudio_binding.cpp): `native/windows/coreaudio_binding.cpp`
- [WASAPI fan-out](https://github.com/marimuthu-07/speakerflow/blob/main/native/windows/wasapi_fanout_engine.h): `native/windows/wasapi_fanout_engine.h`
- [WASAPI capture](https://github.com/marimuthu-07/speakerflow/blob/main/native/windows/wasapi_capture_client.h): `native/windows/wasapi_capture_client.h`
- [WASAPI render](https://github.com/marimuthu-07/speakerflow/blob/main/native/windows/wasapi_render_client.h): `native/windows/wasapi_render_client.h`
- [Format pipeline](https://github.com/marimuthu-07/speakerflow/blob/main/native/windows/audio_format_pipeline.h): `native/windows/audio_format_pipeline.h`
- [Drift correction](https://github.com/marimuthu-07/speakerflow/blob/main/native/windows/audio_drift_controller.h): `native/windows/audio_drift_controller.h`

### Other components

- **User**
- **PipeWire**

## Connections

- User → Renderer UI: controls (evidence: `README.md`)
- Renderer UI → Preload API: requests (evidence: `README.md`)
- Preload API → Electron main: invokes IPC (evidence: `README.md`)
- Electron main → Backend factory: creates backend (evidence: `electron/main.cjs`)
- Electron main → Stream routing: routes streams (evidence: `electron/main.cjs`)
- Electron main → Speaker sessions: starts sessions (evidence: `electron/main.cjs`)
- Backend factory → PipeWire backend: selects platform (evidence: `electron/audio/createAudioBackend.cjs`)
- Backend factory → Windows backend: selects platform (evidence: `electron/audio/createAudioBackend.cjs`)
- Speaker sessions → Backend factory: creates pipeline (evidence: `electron/audio/speakerEngineService.cjs`)
- Speaker sessions → Wave controller: updates branches (evidence: `electron/audio/speakerEngineService.cjs`)
- Speaker sessions → Device delays: reads delays (evidence: `electron/audio/speakerEngineService.cjs`)
- PipeWire backend → PipeWire addon: calls addon (evidence: `README.md`)
- PipeWire addon → PipeWire: uses native API (evidence: `README.md`)
- PipeWire backend → PipeWire pipeline: provides pipeline (evidence: `electron/audio/createAudioBackend.cjs`)
- Windows backend → Core Audio binding: loads binding (evidence: `electron/audio/windowsCoreAudioBackend.cjs`)
- Windows backend → WASAPI pipeline: provides pipeline (evidence: `electron/audio/createAudioBackend.cjs`)
- Wave controller → Wave patterns: calculates gains (evidence: `electron/audio/waveEngineController.cjs`)
- Wave controller → Spatial audio: calculates spatial gains (evidence: `electron/audio/waveEngineController.cjs`)
- Wave controller → Motion models: uses motion models (evidence: `electron/audio/waveEngineController.cjs`)
- Core Audio binding → WASAPI fan-out: controls engine
- WASAPI fan-out → WASAPI capture: fans out capture (evidence: `native/windows/wasapi_fanout_engine.h`)
- WASAPI fan-out → WASAPI render: starts branches (evidence: `native/windows/wasapi_fanout_engine.h`)
- WASAPI render → Format pipeline: processes audio (evidence: `native/windows/wasapi_render_client.h`)
- WASAPI render → Drift correction: corrects drift (evidence: `native/windows/wasapi_render_client.h`)
