# steverussell33/prism architecture

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

- Interactive diagram: https://gitdiagram.com/steverussell33/prism
- Repository: https://github.com/steverussell33/prism

## Overview

##### Main Components

a. Core Plugin Components:
- Rainbow Module (main module, based on 4ms SMR)
- Spectrum Expander (for user-defined scales)
- Droplet Module (band-pass resonant filter)

b. Audio Processing Chain:
- Input Processing
- Filter Bank System
- Envelope Processing
- Output Processing

##### UI Layer
- LED Ring components
- Control inputs
- User interface elements

##### Processing Layer
- Filter processing chain
- Scale management system
- DSP components
- Tuning system

##### Scale Management System
- Built-in scales (show variety from src/scales/)
- User-defined scale handling
- Scale conversion and processing

**[User Interface Layer]**
- ↓
**[Input Processing]**
- ↓
**[Scale Management] ←→ [Scale Definitions]**
- ↓
**[Filter Processing] ←→ [DSP Components]**
- ↓
**[Output Processing]**

- Blue: Audio signal path
- Green: Control signals
- Orange: Scale management
- Purple: User interface elements

Important Implementation Details to Highlight:

##### Module Communication
- How Rainbow and Spectrum expander interact
- Data flow between components

##### Signal Flow
- Audio input paths
- Control voltage paths
- Modulation routing

##### Processing Blocks
- Filter bank architecture (from FilterBank.cpp)
- Envelope processing (from Envelope.cpp)
- DSP components (from src/dsp/)

##### Scale System
- Variety of scale implementations
- How user scales are integrated

Special Considerations:

##### VCV Rack Integration
- Plugin interface to VCV Rack
- Where external inputs/outputs connect

##### Real-time Processing
- Critical real-time paths
- Parallel processing where applicable

##### State Management
- Parameter storage
- Scale configuration
- User settings

For this specific audio plugin, focus on:
- Signal flow paths
- Scale management system
- Filter processing chain
- Module communication
- Real-time processing considerations

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef ui fill:#e6e6fa,stroke:#333
    classDef audio fill:#add8e6,stroke:#333
    classDef scale fill:#ffa500,stroke:#333
    classDef control fill:#90ee90,stroke:#333
    classDef core fill:#f0f0f0,stroke:#333
    classDef dsp fill:#ffe4c4,stroke:#333

    %% Core Plugin Infrastructure
    Plugin["Plugin Infrastructure"]:::core
    click Plugin "https://github.com/SteveRussell33/Prism/blob/Rack2/src/plugin.cpp"

    %% Main Modules
    subgraph Modules
        Rainbow["Rainbow Module"]:::core
        Spectrum["Spectrum Expander"]:::core
        Droplet["Droplet Module"]:::core
    end
    click Rainbow "https://github.com/SteveRussell33/Prism/blob/Rack2/src/Rainbow.cpp"
    click Spectrum "https://github.com/SteveRussell33/Prism/blob/Rack2/src/RainbowExpander.cpp"
    click Droplet "https://github.com/SteveRussell33/Prism/blob/Rack2/src/Droplet.cpp"

    %% UI Layer
    subgraph UI
        LED["LED Ring Interface"]:::ui
        Controls["Level Controls"]:::ui
    end
    click LED "https://github.com/SteveRussell33/Prism/blob/Rack2/src/LEDRing.cpp"
    click Controls "https://github.com/SteveRussell33/Prism/blob/Rack2/src/Levels.cpp"

    %% Processing Chain
    subgraph Processing
        Input["Input Processing"]:::audio
        FilterBank["Filter Bank System"]:::dsp
        EnvProc["Envelope Processing"]:::dsp
        Output["Output Processing"]:::audio
    end
    click Input "https://github.com/SteveRussell33/Prism/blob/Rack2/src/Inputs.cpp"
    click FilterBank "https://github.com/SteveRussell33/Prism/blob/Rack2/src/FilterBank.cpp"
    click EnvProc "https://github.com/SteveRussell33/Prism/blob/Rack2/src/Envelope.cpp"

    %% Scale Management
    subgraph ScaleSystem
        ScaleMgr["Scale Management System"]:::scale
        Tuning["Tuning System"]:::scale
        BuiltInScales["Built-in Scales"]:::scale
        UserScales["User Scales"]:::scale
    end
    click ScaleMgr "https://github.com/SteveRussell33/Prism/tree/Rack2/src/scales/"
    click Tuning "https://github.com/SteveRussell33/Prism/blob/Rack2/src/Tuning.cpp"
    click BuiltInScales "https://github.com/SteveRussell33/Prism/blob/Rack2/src/scales/ET_*.cpp"
    click UserScales "https://github.com/SteveRussell33/Prism/blob/Rack2/src/scales/UserScale.cpp"

    %% DSP Components
    DSP["DSP Components"]:::dsp
    click DSP "https://github.com/SteveRussell33/Prism/tree/Rack2/src/dsp/"

    %% Common Utilities
    Common["Common Utilities"]:::core
    click Common "https://github.com/SteveRussell33/Prism/blob/Rack2/src/Common.hpp"

    %% Relationships
    Plugin --> Modules
    Rainbow --> LED
    Rainbow --> Controls
    Rainbow --> Input
    Input --> FilterBank
    FilterBank --> EnvProc
    EnvProc --> Output
    FilterBank <--> DSP
    ScaleMgr --> FilterBank
    ScaleMgr --> BuiltInScales
    ScaleMgr --> UserScales
    ScaleMgr <--> Tuning
    Common --> Processing
    Common --> ScaleSystem
    Spectrum --> ScaleMgr
    Droplet --> FilterBank

    %% Legend
    subgraph Legend
        UI_L["UI Components"]:::ui
        Audio_L["Audio Processing"]:::audio
        Scale_L["Scale Components"]:::scale
        Control_L["Control Components"]:::control
        Core_L["Core Components"]:::core
        DSP_L["DSP Components"]:::dsp
    end
```
