# chinenual/synergize architecture

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

- Interactive diagram: https://gitdiagram.com/chinenual/synergize
- Repository: https://github.com/chinenual/synergize

## Overview

##### Main Components

a. Frontend Layer:
- Web-based UI (located in /resources/app)
- Static assets (CSS, JavaScript, images)
- Multiple view components (VCE, CRT viewers, preferences, diagnostics)

b. Backend Layer:
- Core Go application
- Multiple command-line tools (dx2syn, dump, tojson)
- Data handling modules
- I/O communication layer

c. External Interfaces:
- Serial communication with DKI Synergy synthesizer
- OSC (Open Sound Control) interface
- MIDI sequencing capabilities

##### Key Architectural Elements

**[User Interface Layer]**

**[Application Core]**

**[Communication Layer]**

**[External Hardware/Interfaces]**

##### Specific Components to Highlight

a. Data Processing:
- Voice file handling (/data)
- DX7 conversion utilities (/dx2syn)
- Cart file management
- MIDI sequencing (/seq)

b. Communication:
- Serial interface (/io)
- Socket communication
- OSC protocol support (/osc)
- Zeroconf service discovery

c. Testing Infrastructure:
- UI tests (/uitest)
- Data conversion tests
- Mock interfaces

##### Key Relationships

- Frontend to Backend communication
- Data flow between core components and file system
- Hardware communication paths
- Test infrastructure integration

##### Implementation Details

**[Web UI Layer]**
- HTML/JS/CSS components
- Voice editors
- Cart managers
- Preference panels

**[Application Core]**
- Voice data processing
- File management
- Configuration handling
- Conversion utilities

**[Communication Layer]**
- Serial interface
- Socket handling
- OSC protocol
- MIDI sequencing

**[External Systems]**
- DKI Synergy synthesizer
- File system
- MIDI devices

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef frontend fill:#b3d9ff,stroke:#333
    classDef backend fill:#98FB98,stroke:#333
    classDef external fill:#FFE4B5,stroke:#333
    classDef data fill:#DDA0DD,stroke:#333
    classDef testing fill:#D3D3D3,stroke:#333
    classDef communication fill:#87CEEB,stroke:#333

    %% Frontend Layer
    subgraph Frontend
        UI["Web UI"]:::frontend
        VCE["Voice Editor"]:::frontend
        CRT["Cart Viewer"]:::frontend
        STATIC["Static Assets"]:::frontend
    end

    %% Backend Layer
    subgraph Core
        DataProc["Data Processing"]:::backend
        VoiceData["Voice Data"]:::data
        CartData["Cart Data"]:::data
        JsonHandler["JSON Handler"]:::data
    end

    %% Communication Layer
    subgraph CommLayer
        IOCore["I/O Core"]:::communication
        Serial["Serial Interface"]:::communication
        Socket["Socket Communication"]:::communication
        SynIO["Synergy I/O"]:::communication
    end

    %% External Interfaces
    subgraph External
        OSC["OSC Protocol"]:::external
        CSurface["Control Surface"]:::external
        Zeroconf["Zeroconf Service"]:::external
    end

    %% DX7 Conversion
    subgraph Conversion
        DX7Conv["DX7 Conversion"]:::backend
        AlgoHandler["Algorithm Handler"]:::backend
        CartCreator["Cart Creator"]:::backend
    end

    %% MIDI Sequencing
    subgraph MIDI
        Sequencer["MIDI Sequencer"]:::backend
        TrackMgmt["Track Management"]:::backend
    end

    %% Testing
    subgraph Testing
        UITest["UI Tests"]:::testing
        DataTest["Data Tests"]:::testing
        MockInt["Mock Interfaces"]:::testing
    end

    %% Platform Support
    subgraph Platform
        Darwin["Darwin Support"]:::backend
        Linux["Linux Support"]:::backend
        Windows["Windows Support"]:::backend
    end

    %% Relationships
    UI --> VCE & CRT
    VCE & CRT --> DataProc
    DataProc --> VoiceData & CartData
    DataProc --> JsonHandler
    IOCore --> Serial & Socket
    Serial & Socket --> SynIO
    SynIO --> OSC
    OSC --> CSurface
    DX7Conv --> AlgoHandler
    DX7Conv --> CartCreator
    Sequencer --> TrackMgmt
    MockInt -.-> IOCore

    %% Click events
    click UI "https://github.com/chinenual/synergize/blob/master/resources/app/index.html"
    click VCE "https://github.com/chinenual/synergize/blob/master/resources/app/viewVCE.html"
    click CRT "https://github.com/chinenual/synergize/blob/master/resources/app/viewCRT.html"
    click STATIC "https://github.com/chinenual/synergize/tree/master/resources/app/static"
    click VoiceData "https://github.com/chinenual/synergize/blob/master/data/vce.go"
    click CartData "https://github.com/chinenual/synergize/blob/master/data/crt.go"
    click JsonHandler "https://github.com/chinenual/synergize/blob/master/data/json.go"
    click IOCore "https://github.com/chinenual/synergize/blob/master/io/io.go"
    click Serial "https://github.com/chinenual/synergize/blob/master/io/serial.go"
    click Socket "https://github.com/chinenual/synergize/blob/master/io/socket.go"
    click SynIO "https://github.com/chinenual/synergize/blob/master/synio/synio.go"
    click OSC "https://github.com/chinenual/synergize/blob/master/osc/osc.go"
    click CSurface "https://github.com/chinenual/synergize/blob/master/osc/csurface.go"
    click Zeroconf "https://github.com/chinenual/synergize/blob/master/zeroconf/zeroconf.go"
    click DX7Conv "https://github.com/chinenual/synergize/blob/master/dx2syn/convert.go"
    click AlgoHandler "https://github.com/chinenual/synergize/blob/master/dx2syn/algo.go"
    click CartCreator "https://github.com/chinenual/synergize/blob/master/dx2syn/makecrt.go"
    click Sequencer "https://github.com/chinenual/synergize/blob/master/seq/syn2midi.go"
    click TrackMgmt "https://github.com/chinenual/synergize/blob/master/seq/trackset.go"
    click UITest "https://github.com/chinenual/synergize/tree/master/uitest/test"
    click DataTest "https://github.com/chinenual/synergize/blob/master/data/vce_test.go"
    click MockInt "https://github.com/chinenual/synergize/blob/master/io/mock.go"
    click Darwin "https://github.com/chinenual/synergize/blob/master/signals_darwin.go"
    click Linux "https://github.com/chinenual/synergize/blob/master/signals_linux.go"
    click Windows "https://github.com/chinenual/synergize/blob/master/signals_windows.go"
```
