How mpatti/musio-create works
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: Project.swift Project Model · AudioEngine.swift Audio Engine · ProjectViewModel.swift Project VM · Package.swift Package
Components 24
App Shell
macOS app entry and package integration
User Interface
SwiftUI screens, state, and presentation
- Main UI · Primary application window and navigation shell
DAWUI/Sources/DAWUI/Views/MainWindowView.swift - Project VM · Coordinates project state between UI and core
DAWUI/Sources/DAWUI/ViewModels/ProjectViewModel.swift - AI Chat VM · Manages assistant conversation and AI UI state
DAWUI/Sources/DAWUI/ViewModels/AIChatViewModel.swift - Timeline · Arranging, clip editing, and track presentation
DAWUI/Sources/DAWUI/Views/Timeline/TimelineView.swift - Piano Roll · MIDI note editing and track-level piano roll views
DAWUI/Sources/DAWUI/Views/PianoRoll/TrackPianoRollView.swift - Transport UI · Play, stop, record, and loop controls
DAWUI/Sources/DAWUI/Views/Transport/TransportView.swift - Mixer · Channel and level control presentation
DAWUI/Sources/DAWUI/Views/Mixer/MixerView.swift - Settings · Audio, MIDI, and AI configuration views
DAWUI/Sources/DAWUI/Views/Settings/AudioSettingsView.swift - Assistant · User-facing AI assistant and generation UI
DAWUI/Sources/DAWUI/Views/AI/AIAssistantView.swift
Core DAW
Domain model and runtime services
- Project Model · Project, track, clip, MIDI, automation, and rack data
DAWCore/Sources/DAWCore/Models/Project.swift - Transport State · Play, stop, record, and loop state shared by UI and engine
DAWCore/Sources/DAWCore/Transport/TransportState.swift - Persistence · Save and load project sessions
DAWCore/Sources/DAWCore/Persistence/ProjectPersistence.swift - Undo · Core-level undo and redo management
DAWCore/Sources/DAWCore/Undo/UndoManager.swift - Audio Engine · Playback, recording, backend selection, and engine orchestration
DAWCore/Sources/DAWCore/Audio/AudioEngine.swift - Core Audio · Primary audio backend with rendering and offline bounce
DAWCore/Sources/DAWCore/Audio/CoreAudio/CoreAudioBackend.swift - Legacy Backend · Alternative AVAudioEngine-based backend path
DAWCore/Sources/DAWCore/Audio/LegacyAVAudioEngineBackend.swift - MIDI Stack · Device handling and transport-synced MIDI playback
DAWCore/Sources/DAWCore/MIDI/MIDISequencer.swift
Plugin Boundary
Third-party instrument and effect hosting
- Plugin Host · Hosts third-party plugin instances for the DAW
DAWCore/Sources/DAWCore/Plugins/PluginHost.swift - VST3 Bridge · Cross-language layer for VST3 hosting
VST3Bridge/Sources/VST3Bridge/VST3Plugin.swift
AI Services
Client-side AI orchestration and backend proxying
- AI Services · Chat, audio, action, and project serialization services
DAWCore/Sources/DAWCore/AI/DAWChatService.swift - Voice Input · Captures and forwards voice input for AI features
DAWUI/Sources/DAWUI/AI/VoiceInputManager.swift - Supabase Proxies · Server-side proxies for AI provider access
supabase/functions/claude-proxy/index.ts
Connections 27
- 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