# mpatti/musio-create architecture

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

- Interactive diagram: https://gitdiagram.com/mpatti/musio-create
- Repository: https://github.com/mpatti/musio-create

## Overview

1. **Overall shape**
   Musio Create is a macOS DAW organized as a Swift Package with four main runtime areas: `DAWApp` for app bootstrapping, `DAWUI` for SwiftUI screens and view models, `DAWCore` for audio/MIDI/domain logic, and `VST3Bridge` for hosting third-party plugins. The repository also includes Supabase edge functions for AI proxying.

2. **App composition and entry point**
   `DAWApp/Sources/DAWApp/DAWApp.swift` is the top-level macOS app target. Its role is to wire the package modules together, provide menus/window lifecycle, and launch the main UI shell rather than contain domain logic itself.

3. **UI layer**
   `DAWUI` owns the user-facing application surfaces: main window, timeline, piano roll, mixer, transport, plugin window, recording controls, settings, authentication, and AI assistant views. The UI is split into views and view models, with `ProjectViewModel` and `AIChatViewModel` acting as the main state bridges into the core.

4. **Core domain model**
   `DAWCore/Models` defines the main project data structures: `Project`, `Track`, `Clip`, `MIDIEvent`, `AutomationLane`, `TimePosition`, and `VRack`. These types form the shared language used by persistence, transport, UI, MIDI editing, and audio rendering.

5. **Audio subsystem**
   `DAWCore/Audio` is the playback/recording/rendering backbone. It includes an abstract `AudioBackendProtocol`, a backend factory, playback and clip players, recording, metronome, and file management. The `CoreAudio` subfolder contains the native engine path, including offline bounce, render graph, MIDI scheduling, and waveform/metronome renderers.

6. **Backend boundary**
   The audio architecture is explicitly layered around backend substitution. `CoreAudioBackend` appears to be the primary engine, while `LegacyAVAudioEngineBackend` exists as an alternate/compatibility path. This makes the audio engine a swappable boundary rather than a single hardcoded implementation.

7. **MIDI workflow**
   MIDI concerns are isolated in `DAWCore/MIDI`, with a `MIDIManager` and `MIDISequencer` supporting device handling and transport-synchronized playback. The piano roll UI edits MIDI data in the model layer, while the sequencer and scheduler turn those models into timed output during playback.

8. **Transport and editing flow**
   `DAWCore/Transport/TransportState.swift` centralizes play/stop/record/loop-style state, which the transport UI and audio engine both consume. Undo support is separated into `DAWCore/Undo`, indicating editing actions are tracked at the core level rather than inside individual views.

9. **Persistence and project state**
   `DAWCore/Persistence/ProjectPersistence.swift` handles save/load of project data, so the project model is the persistence boundary. The UI works against the in-memory `Project`, and persistence serializes that state when the user opens or saves a session.

10. **Plugins and external instruments**
    `DAWCore/Plugins/PluginHost.swift` and the `VST3Bridge` target provide the plugin-hosting boundary. The Swift/C++ bridge (`VST3Plugin.swift`, `VST3Host.cpp`) exists to integrate VST3 plugins that cannot be hosted purely in Swift, making plugin execution a separate subsystem from the main app UI and core DAW logic.

11. **AI assistant subsystem**
    AI features are split across core services and UI orchestration. `DAWCore/AI` contains service wrappers such as `ClaudeService`, `MiniMaxService`, `ElevenLabsService`, `DAWChatService`, `AIAudioModel`, and project/state serialization helpers; `DAWUI/AI` contains the assistant panel and user interaction flows. `ActionExecutor` and `DAWActionRegistry` suggest the assistant can trigger app actions, not just generate text.

12. **Voice and remote AI access**
    The AI stack includes voice input via `VoiceInputManager` and a Supabase-backed proxy layer under `supabase/functions` for Claude and ElevenLabs. This means some AI requests are mediated through backend functions rather than sent directly from the macOS client, which matters for security and key management.

13. **Auth and account settings**
    Authentication is isolated in `DAWCore/Auth/SupabaseAuthService.swift` and surfaced in UI under `Views/Auth`. This implies account/session state is a distinct concern from project editing, likely used to gate cloud or AI-related features rather than the basic DAW workflow.

14. **Rendering and visualization**
    The UI uses `DAWUI/MetalRendering/WaveformRenderer.swift` plus audio-side renderers like `AudioClipRenderer` for waveform presentation. This separates display-oriented rendering from actual audio playback, which is important when diagramming the boundary between analysis/visualization and engine execution.

15. **Testing and packaging**
    `Tests/DAWCoreTests` indicates the core module is the primary unit-test target, which fits the architecture: business logic, audio orchestration, and model behavior are centralized in `DAWCore`. `Package.swift` is the integration point for all targets, making Swift Package Manager the build and dependency orchestration layer.

Main entry points: [`DAWCore/Sources/DAWCore/Models/Project.swift`](https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/Models/Project.swift) (Project Model), [`DAWCore/Sources/DAWCore/Audio/AudioEngine.swift`](https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/Audio/AudioEngine.swift) (Audio Engine), [`DAWUI/Sources/DAWUI/ViewModels/ProjectViewModel.swift`](https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/ViewModels/ProjectViewModel.swift) (Project VM), [`Package.swift`](https://github.com/mpatti/musio-create/blob/main/Package.swift) (Package)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App Shell"]
  node_package["Package<br/>SwiftPM root<br/>[Package.swift]"]
  node_dawapp["DAW App<br/>macOS app entry<br/>[DAWApp.swift]"]
end

subgraph group_ui["User Interface"]
  node_mainui["Main UI<br/>SwiftUI shell"]
  node_projectvm["Project VM<br/>state bridge"]
  node_aichatvm["AI Chat VM<br/>state bridge"]
  node_timeline["Timeline<br/>editing surface<br/>[TimelineView.swift]"]
  node_pianoroll["Piano Roll<br/>MIDI editor"]
  node_transportui["Transport UI<br/>control surface"]
  node_mixer["Mixer<br/>mixing surface<br/>[MixerView.swift]"]
  node_settings["Settings<br/>preferences"]
  node_assistant["Assistant<br/>AI panel"]
end

subgraph group_core["Core DAW"]
  node_models[("Project Model<br/>domain model<br/>[Project.swift]")]
  node_transportcore(("Transport State<br/>runtime state"))
  node_persistence["Persistence<br/>project storage"]
  node_undo(("Undo<br/>edit history<br/>[UndoManager.swift]"))
  node_audioengine{{"Audio Engine<br/>playback/rendering<br/>[AudioEngine.swift]"}}
  node_coreaudio{{"Core Audio<br/>native backend"}}
  node_legacybackend{{"Legacy Backend<br/>compat audio backend"}}
  node_midistack(("MIDI Stack<br/>sequencing"))
end

subgraph group_plugins["Plugin Boundary"]
  node_pluginhost{{"Plugin Host<br/>plugin boundary<br/>[PluginHost.swift]"}}
  node_vstbridge{{"VST3 Bridge<br/>Swift/C++ bridge<br/>[VST3Plugin.swift]"}}
end

subgraph group_ai["AI Services"]
  node_aiservices{{"AI Services<br/>client services"}}
  node_voiceinput(("Voice Input<br/>audio input"))
  node_supabase["Supabase Proxies<br/>edge functions<br/>[index.ts]"]
end

node_package -->|"builds"| node_dawapp
node_package -->|"builds"| node_mainui
node_package -->|"builds"| node_audioengine
node_package -->|"builds"| node_vstbridge
node_dawapp -->|"launches"| node_mainui
node_mainui -->|"binds"| node_projectvm
node_mainui -->|"binds"| node_aichatvm
node_projectvm -->|"edits"| node_models
node_projectvm -->|"controls"| node_transportcore
node_projectvm -->|"saves"| node_persistence
node_projectvm -->|"tracks"| node_undo
node_timeline -->|"renders"| node_models
node_pianoroll -->|"edits"| node_models
node_transportui -->|"drives"| node_transportcore
node_mixer -->|"views"| node_models
node_assistant -->|"uses"| node_aichatvm
node_assistant -->|"captures"| node_voiceinput
node_aichatvm -->|"orchestrates"| node_aiservices
node_aiservices -->|"proxies"| node_supabase
node_aiservices -->|"reads"| node_models
node_audioengine -->|"uses"| node_coreaudio
node_audioengine -.->|"falls back"| node_legacybackend
node_audioengine -->|"schedules"| node_midistack
node_audioengine -->|"plays"| node_models
node_midistack -->|"reads"| node_models
node_pluginhost -->|"bridges"| node_vstbridge
node_pluginhost -->|"integrates"| node_audioengine

click node_package "https://github.com/mpatti/musio-create/blob/main/Package.swift"
click node_dawapp "https://github.com/mpatti/musio-create/blob/main/DAWApp/Sources/DAWApp/DAWApp.swift"
click node_mainui "https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/Views/MainWindowView.swift"
click node_projectvm "https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/ViewModels/ProjectViewModel.swift"
click node_aichatvm "https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/ViewModels/AIChatViewModel.swift"
click node_timeline "https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/Views/Timeline/TimelineView.swift"
click node_pianoroll "https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/Views/PianoRoll/TrackPianoRollView.swift"
click node_transportui "https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/Views/Transport/TransportView.swift"
click node_mixer "https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/Views/Mixer/MixerView.swift"
click node_settings "https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/Views/Settings/AudioSettingsView.swift"
click node_assistant "https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/Views/AI/AIAssistantView.swift"
click node_models "https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/Models/Project.swift"
click node_transportcore "https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/Transport/TransportState.swift"
click node_persistence "https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/Persistence/ProjectPersistence.swift"
click node_undo "https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/Undo/UndoManager.swift"
click node_audioengine "https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/Audio/AudioEngine.swift"
click node_coreaudio "https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/Audio/CoreAudio/CoreAudioBackend.swift"
click node_legacybackend "https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/Audio/LegacyAVAudioEngineBackend.swift"
click node_midistack "https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/MIDI/MIDISequencer.swift"
click node_pluginhost "https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/Plugins/PluginHost.swift"
click node_vstbridge "https://github.com/mpatti/musio-create/blob/main/VST3Bridge/Sources/VST3Bridge/VST3Plugin.swift"
click node_aiservices "https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/AI/DAWChatService.swift"
click node_voiceinput "https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/AI/VoiceInputManager.swift"
click node_supabase "https://github.com/mpatti/musio-create/blob/main/supabase/functions/claude-proxy/index.ts"

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_package,node_dawapp toneBlue
class node_mainui,node_projectvm,node_aichatvm,node_timeline,node_pianoroll,node_transportui,node_mixer,node_settings,node_assistant toneAmber
class node_models,node_transportcore,node_persistence,node_undo,node_audioengine,node_coreaudio,node_legacybackend,node_midistack toneMint
class node_pluginhost,node_vstbridge toneRose
class node_aiservices,node_voiceinput,node_supabase toneIndigo
```

## Components

### App Shell

macOS app entry and package integration

- [Package](https://github.com/mpatti/musio-create/blob/main/Package.swift): SwiftPM root · Build and target integration for the repository · `Package.swift`
- [DAW App](https://github.com/mpatti/musio-create/blob/main/DAWApp/Sources/DAWApp/DAWApp.swift): macOS app entry · Top-level app bootstrap and lifecycle wiring · `DAWApp/Sources/DAWApp/DAWApp.swift`

### User Interface

SwiftUI screens, state, and presentation

- [Main UI](https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/Views/MainWindowView.swift): SwiftUI shell · Primary application window and navigation shell · `DAWUI/Sources/DAWUI/Views/MainWindowView.swift`
- [Project VM](https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/ViewModels/ProjectViewModel.swift): state bridge · Coordinates project state between UI and core · `DAWUI/Sources/DAWUI/ViewModels/ProjectViewModel.swift`
- [AI Chat VM](https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/ViewModels/AIChatViewModel.swift): state bridge · Manages assistant conversation and AI UI state · `DAWUI/Sources/DAWUI/ViewModels/AIChatViewModel.swift`
- [Timeline](https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/Views/Timeline/TimelineView.swift): editing surface · Arranging, clip editing, and track presentation · `DAWUI/Sources/DAWUI/Views/Timeline/TimelineView.swift`
- [Piano Roll](https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/Views/PianoRoll/TrackPianoRollView.swift): MIDI editor · MIDI note editing and track-level piano roll views · `DAWUI/Sources/DAWUI/Views/PianoRoll/TrackPianoRollView.swift`
- [Transport UI](https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/Views/Transport/TransportView.swift): control surface · Play, stop, record, and loop controls · `DAWUI/Sources/DAWUI/Views/Transport/TransportView.swift`
- [Mixer](https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/Views/Mixer/MixerView.swift): mixing surface · Channel and level control presentation · `DAWUI/Sources/DAWUI/Views/Mixer/MixerView.swift`
- [Settings](https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/Views/Settings/AudioSettingsView.swift): preferences · Audio, MIDI, and AI configuration views · `DAWUI/Sources/DAWUI/Views/Settings/AudioSettingsView.swift`
- [Assistant](https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/Views/AI/AIAssistantView.swift): AI panel · User-facing AI assistant and generation UI · `DAWUI/Sources/DAWUI/Views/AI/AIAssistantView.swift`

### Core DAW

Domain model and runtime services

- [Project Model](https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/Models/Project.swift): domain model · Project, track, clip, MIDI, automation, and rack data · `DAWCore/Sources/DAWCore/Models/Project.swift`
- [Transport State](https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/Transport/TransportState.swift): runtime state · Play, stop, record, and loop state shared by UI and engine · `DAWCore/Sources/DAWCore/Transport/TransportState.swift`
- [Persistence](https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/Persistence/ProjectPersistence.swift): project storage · Save and load project sessions · `DAWCore/Sources/DAWCore/Persistence/ProjectPersistence.swift`
- [Undo](https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/Undo/UndoManager.swift): edit history · Core-level undo and redo management · `DAWCore/Sources/DAWCore/Undo/UndoManager.swift`
- [Audio Engine](https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/Audio/AudioEngine.swift): playback/rendering · Playback, recording, backend selection, and engine orchestration · `DAWCore/Sources/DAWCore/Audio/AudioEngine.swift`
- [Core Audio](https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/Audio/CoreAudio/CoreAudioBackend.swift): native backend · Primary audio backend with rendering and offline bounce · `DAWCore/Sources/DAWCore/Audio/CoreAudio/CoreAudioBackend.swift`
- [Legacy Backend](https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/Audio/LegacyAVAudioEngineBackend.swift): compat audio backend · Alternative AVAudioEngine-based backend path · `DAWCore/Sources/DAWCore/Audio/LegacyAVAudioEngineBackend.swift`
- [MIDI Stack](https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/MIDI/MIDISequencer.swift): sequencing · Device handling and transport-synced MIDI playback · `DAWCore/Sources/DAWCore/MIDI/MIDISequencer.swift`

### Plugin Boundary

Third-party instrument and effect hosting

- [Plugin Host](https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/Plugins/PluginHost.swift): plugin boundary · Hosts third-party plugin instances for the DAW · `DAWCore/Sources/DAWCore/Plugins/PluginHost.swift`
- [VST3 Bridge](https://github.com/mpatti/musio-create/blob/main/VST3Bridge/Sources/VST3Bridge/VST3Plugin.swift): Swift/C++ bridge · Cross-language layer for VST3 hosting · `VST3Bridge/Sources/VST3Bridge/VST3Plugin.swift`

### AI Services

Client-side AI orchestration and backend proxying

- [AI Services](https://github.com/mpatti/musio-create/blob/main/DAWCore/Sources/DAWCore/AI/DAWChatService.swift): client services · Chat, audio, action, and project serialization services · `DAWCore/Sources/DAWCore/AI/DAWChatService.swift`
- [Voice Input](https://github.com/mpatti/musio-create/blob/main/DAWUI/Sources/DAWUI/AI/VoiceInputManager.swift): audio input · Captures and forwards voice input for AI features · `DAWUI/Sources/DAWUI/AI/VoiceInputManager.swift`
- [Supabase Proxies](https://github.com/mpatti/musio-create/blob/main/supabase/functions/claude-proxy/index.ts): edge functions · Server-side proxies for AI provider access · `supabase/functions/claude-proxy/index.ts`

## Connections

- Package → DAW App: builds · Swift Package Manager builds the app target
- Package → Main UI: builds · Package includes the UI module
- Package → Audio Engine: builds · Package includes the core DAW module
- Package → VST3 Bridge: builds · Package includes the plugin bridge target
- DAW App → Main UI: launches · App bootstrap opens the main SwiftUI shell
- Main UI → Project VM: binds · Main UI is driven by project state
- Main UI → AI Chat VM: binds · Main UI includes assistant state
- Project VM → Project Model: edits · View model mutates the shared project model
- Project VM → Transport State: controls · Project UI coordinates transport state
- Project VM → Persistence: saves · View model triggers load/save operations
- Project VM → Undo: tracks · Editing actions are recorded for undo
- Timeline → Project Model: renders · Timeline presents tracks and clips
- Piano Roll → Project Model: edits · Piano roll edits MIDI data in the project model
- Transport UI → Transport State: drives · Transport controls update play/record state
- Mixer → Project Model: views · Mixer reflects track and rack state
- Assistant → AI Chat VM: uses · Assistant panel is driven by chat view model
- Assistant → Voice Input: captures · Assistant can accept spoken input
- AI Chat VM → AI Services: orchestrates · Chat view model coordinates AI service calls
- AI Services → Supabase Proxies: proxies · Some provider requests flow through edge functions
- AI Services → Project Model: reads · AI services serialize and inspect project state
- Audio Engine → Core Audio: uses · Primary playback engine delegates to Core Audio backend
- Audio Engine → Legacy Backend: falls back · Alternate backend exists for compatibility
- Audio Engine → MIDI Stack: schedules · Audio engine coordinates MIDI playback timing
- Audio Engine → Project Model: plays · Audio engine consumes project clips and tracks
- MIDI Stack → Project Model: reads · Sequencer turns model MIDI into timed output
- Plugin Host → VST3 Bridge: bridges · Plugin host relies on the cross-language bridge
- Plugin Host → Audio Engine: integrates · Plugins participate in the audio signal path
