AI Integration (app/ai/)
AI-powered music generation features using Google’s Lyria/Magenta model.
Architecture
Lyria generates raw audio tracks that are injected into the Tracktion Engine as audio clips. The AI tracks are distinct from MIDI tracks — they bypass the.bird notation system entirely.
Files
| File | Purpose |
|---|---|
LyriaManager.cpp | Manages Lyria-generated tracks: configuration, prompts, quantization, WebView updates. All methods are called from SongbirdEditor and operate on the message thread. |
Design Principles
- Audio tracks only — Lyria generates audio, not MIDI. Use
type audioin.birdoraddGeneratedTrack(). - Message thread — All Lyria management runs on the JUCE message thread. The actual audio DSP happens inside the
LyriaPluginon the audio thread (seelibraries/magenta/). - Track context map —
SongbirdEditormaintains astd::map<int, LyriaTrackContext>that maps track indices to their Lyria plugin and quantize settings. - Config via Gemini tools — The AI copilot uses
set_lyria_track_configandset_lyria_track_promptsfunction calls to control generation parameters (temperature, density, brightness, BPM, prompt text).
Extending
To add a new Lyria control:- Add the parameter to
SET_LYRIA_TRACK_CONFIG_TOOLinreact_ui/src/lib/ai/gemini.ts - Handle it in
setLyriaTrackConfig()inLyriaManager.cpp - Forward to the
LyriaPluginAPI inlibraries/magenta/LyriaPlugin.h