# syeo66/audio-synth-test architecture

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

- Interactive diagram: https://gitdiagram.com/syeo66/audio-synth-test
- Repository: https://github.com/syeo66/audio-synth-test

## Overview

##### Main Components

a. User Interface Layer:
- React components hierarchy
- Main modules (Oscillator, Filter, LFO, Keyboard, Gain)
- Control components (Knobs, Buttons, Cases)

b. Audio Processing Layer:
- Web Audio API nodes and their connections
- Audio routing between different modules
- Signal flow from input to output

- Audio Synthesizer                                      |

- UI Layer    |     |   Audio Core   |     |  Audio Routing |     |    Output      | |
- (React Components)  |   (Web Audio)  |     |    System      |     |    System      | |

##### Component Relationships

a. UI Components Flow:
**Module Components**
- SingleOscillator
- Filter12db
- LFO
- Gain
- Keyboard
- Key Components

b. Audio Signal Flow:
**Oscillator → Filter → Gain → Output**
- ↑
- LFO

##### Specific Implementation Details

Key technical aspects:

a. Control Flow:
- How user interactions (via Knobs, Buttons) affect audio parameters
- State management through the inputsReducer

b. Audio Processing Chain:
- Demonstrate the audio node connections
- Parameter modulation paths (especially for LFO)

##### Important Elements to Highlight

- Web Audio API Nodes
- React Component Hierarchy
- State Management Flow
- User Input Controls
- Audio Signal Routing

##### Technical Details

**Technologies:**
- React (UI Framework)
- TypeScript
- Web Audio API
- Vite (Build Tool)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Legend"
        UI[UI Component]:::ui
        Audio[Audio Node]:::audio
        Control[Control Component]:::control
        State[State Management]:::state
        Signal[Signal Flow]:::signal
    end

    subgraph "UI Layer"
        App["App"]:::ui
        Main["Main"]:::ui
        Case["Case"]:::ui
        ModuleBase["Module Base"]:::ui
        ModuleSection["Module Section"]:::ui
        ModuleFooter["Module Footer"]:::ui
        
        subgraph "Control Components"
            Knob["Knob"]:::control
            Button["Button"]:::control
            PushButton["Push Button"]:::control
        end

        subgraph "Waveform Icons"
            Sine["Sine"]:::ui
            Square["Square"]:::ui
            Sawtooth["Sawtooth"]:::ui
            Triangle["Triangle"]:::ui
        end
    end

    subgraph "Audio Processing Layer"
        subgraph "Audio Modules"
            Oscillator["Single Oscillator"]:::audio
            Filter["Filter 12db"]:::audio
            LFO["LFO"]:::audio
            GainModule["Gain Module"]:::audio
            Keyboard["Keyboard"]:::audio
        end

        subgraph "State Management"
            InputReducer["Inputs Reducer"]:::state
            GainHook["Gain Hook"]:::state
        end
    end

    %% Relationships
    App --> Main
    Main --> Case
    Case --> ModuleBase
    ModuleBase --> ModuleSection
    ModuleBase --> ModuleFooter
    ModuleSection --> Knob
    ModuleSection --> Button
    ModuleSection --> PushButton

    %% Audio Signal Flow
    Oscillator --> Filter
    Filter --> GainModule
    LFO -.-> Oscillator
    LFO -.-> Filter
    Keyboard --> Oscillator
    
    %% Control Flow
    Knob -.-> InputReducer
    Button -.-> InputReducer
    PushButton -.-> InputReducer
    InputReducer -.-> GainHook
    GainHook -.-> GainModule

    %% Styling
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef audio fill:#2ecc71,stroke:#27ae60,color:white
    classDef control fill:#e67e22,stroke:#d35400,color:white
    classDef state fill:#9b59b6,stroke:#8e44ad,color:white
    classDef signal fill:#e74c3c,stroke:#c0392b,color:white

    %% Click Events
    click App "https://github.com/syeo66/audio-synth-test/blob/main/src/App.tsx"
    click Main "https://github.com/syeo66/audio-synth-test/blob/main/src/main.tsx"
    click Case "https://github.com/syeo66/audio-synth-test/blob/main/src/components/Case/Case.tsx"
    click ModuleBase "https://github.com/syeo66/audio-synth-test/blob/main/src/components/Module.tsx"
    click ModuleSection "https://github.com/syeo66/audio-synth-test/blob/main/src/components/ModuleSection.tsx"
    click ModuleFooter "https://github.com/syeo66/audio-synth-test/blob/main/src/components/ModuleFooter.tsx"
    click Knob "https://github.com/syeo66/audio-synth-test/blob/main/src/components/Knob.tsx"
    click Button "https://github.com/syeo66/audio-synth-test/blob/main/src/components/Button.tsx"
    click PushButton "https://github.com/syeo66/audio-synth-test/blob/main/src/components/PushButton.tsx"
    click Sine "https://github.com/syeo66/audio-synth-test/blob/main/src/icons/Sine.tsx"
    click Square "https://github.com/syeo66/audio-synth-test/blob/main/src/icons/Square.tsx"
    click Sawtooth "https://github.com/syeo66/audio-synth-test/blob/main/src/icons/Sawtooth.tsx"
    click Triangle "https://github.com/syeo66/audio-synth-test/blob/main/src/icons/Triangle.tsx"
    click Oscillator "https://github.com/syeo66/audio-synth-test/blob/main/src/modules/SingleOscillator.tsx"
    click Filter "https://github.com/syeo66/audio-synth-test/blob/main/src/modules/Filter12db.tsx"
    click LFO "https://github.com/syeo66/audio-synth-test/blob/main/src/modules/LFO.tsx"
    click GainModule "https://github.com/syeo66/audio-synth-test/blob/main/src/modules/Gain.tsx"
    click Keyboard "https://github.com/syeo66/audio-synth-test/blob/main/src/modules/Keyboard/Keyboard.tsx"
    click InputReducer "https://github.com/syeo66/audio-synth-test/blob/main/src/components/reducers/inputsReducer.ts"
    click GainHook "https://github.com/syeo66/audio-synth-test/blob/main/src/hooks/useGain.ts"
```
