Arrangement View: full timeline workflow (switch view, playhead, clips, Session → Arrangement)#82
Arrangement View: full timeline workflow (switch view, playhead, clips, Session → Arrangement)#82Ooootto wants to merge 4 commits intoahujasid:mainfrom
Conversation
Implemented new commands for switching to the Arrangement view, setting the current song time, retrieving arrangement clips, and duplicating session clips to the Arrangement timeline. Updated the server and remote script to support these features, enhancing the integration with Ableton Live's arrangement functionalities.ds
Removed unnecessary delays for state-modifying commands before and after receiving responses. This simplifies the response handling logic and improves the efficiency of command processing.
Add new arrangement view features to the README including arrangement composition, full song creation capabilities, and an example prompt for building complete arrangements with intro/buildup/drop/breakdown/outro sections. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Document arrangement view capabilities in README
Review Summary by QodoAdd Arrangement View support for full song composition workflow
WalkthroughsDescription• Add Arrangement View support with four new MCP tools for full song composition - switch_to_arrangement_view: Switch main window to Arrangement View - set_arrangement_time: Move playhead to specific beat position - get_arrangement_clips: List clips on arrangement timeline - duplicate_to_arrangement: Copy Session clips to arrangement at beat positions • Refactor AbletonConnection response handling to remove unnecessary delays • Update README with arrangement view capabilities and example prompts Diagramflowchart LR
Session["Session View<br/>Clips & Instruments"]
Duplicate["duplicate_to_arrangement<br/>Copy to Timeline"]
Arrangement["Arrangement View<br/>Full Song Structure"]
Playhead["set_arrangement_time<br/>Move Playhead"]
Read["get_arrangement_clips<br/>Inspect Timeline"]
Session -- "Copy clips" --> Duplicate
Duplicate --> Arrangement
Playhead --> Arrangement
Arrangement --> Read
File Changes1. AbletonMCP_Remote_Script/__init__.py
|
Code Review by Qodo
1. Arrangement query bypasses scheduler
|
📝 WalkthroughWalkthroughThe pull request extends the Ableton MCP remote script with arrangement view operations including switching to arrangement view, setting song time, retrieving arrangement clips, and duplicating session clips to the arrangement. The MCP server is updated with corresponding tool endpoints and command validation rules. Changes
Sequence Diagram(s)sequenceDiagram
actor Client
participant Server as MCP Server
participant Script as Remote Script
participant Ableton as Ableton Live
Client->>Server: Call arrangement_time(time=120.0)
Server->>Script: send_command("set_current_song_time", {time: 120.0})
Script->>Script: _process_command() routes to main_thread_task()
Script->>Script: main_thread_task() extracts time param
Script->>Ableton: _set_current_song_time(120.0)
Ableton->>Ableton: song.current_song_time = 120.0
Ableton-->>Script: Updated time value
Script-->>Server: {current_song_time: 120.0}
Server-->>Client: "Song time set to 120.0 seconds"
rect rgba(200, 150, 255, 0.5)
Note over Client,Ableton: Alternative: Get Arrangement Clips
end
Client->>Server: Call get_arrangement_clips(track_index=0)
Server->>Script: send_command("get_arrangement_clips", {track_index: 0})
Script->>Script: _process_command() routes directly (non-main-thread)
Script->>Ableton: _get_arrangement_clips(0)
Ableton->>Ableton: Iterate track.arrangement_clips
Ableton-->>Script: Clip metadata array
Script-->>Server: {track_name, clips: [{name, start_time, end_time, ...}]}
Server-->>Client: JSON with clip details
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can generate a title for your PR based on the changes.Add |
There was a problem hiding this comment.
🧹 Nitpick comments (3)
MCP_Server/server.py (1)
661-675: Consider validating non-negative time values.The
timeparameter accepts any float, but negative beat positions may not be meaningful in the arrangement timeline. While Live's API may handle this gracefully, adding a simple validation could provide better error messages.🔧 Optional validation
`@mcp.tool`() def set_arrangement_time(ctx: Context, time: float) -> str: """ Move the arrangement playhead to a specific position. Parameters: - time: Position in beats from the start of the arrangement (e.g. 8.0 = bar 3 in 4/4) """ try: + if time < 0: + return "Error: time must be non-negative" ableton = get_ableton_connection() result = ableton.send_command("set_current_song_time", {"time": time}) return f"Playhead moved to beat {result.get('current_song_time', time)}"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@MCP_Server/server.py` around lines 661 - 675, The set_arrangement_time handler should validate that the time parameter is non-negative before calling get_ableton_connection and ableton.send_command; add a check in set_arrangement_time to return a clear error string (and log via logger.error) when time < 0, and only call ableton.send_command("set_current_song_time", {"time": time}) for valid non-negative values, preserving the existing try/except for remote errors.AbletonMCP_Remote_Script/__init__.py (2)
716-756: Same version guard recommendation applies here.The
track.duplicate_clip_to_arrangementmethod is also Live 11+ only. Adding ahasattrcheck would provide a clearer error message for Live 10 users.🛡️ Suggested graceful degradation
clip = clip_slot.clip + # duplicate_clip_to_arrangement requires Live 11+ + if not hasattr(track, 'duplicate_clip_to_arrangement'): + raise RuntimeError( + "duplicate_clip_to_arrangement is not available in this version of Live. " + "This feature requires Live 11 or newer." + ) + # Duplicate to arrangement at the requested beat position track.duplicate_clip_to_arrangement(clip, float(destination_time))🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@AbletonMCP_Remote_Script/__init__.py` around lines 716 - 756, The _duplicate_session_clip_to_arrangement function calls the Live 11+ API track.duplicate_clip_to_arrangement without a version guard; add a hasattr(track, "duplicate_clip_to_arrangement") check before calling it and raise/log a clear, user-friendly error if the method is missing (e.g., indicate Live 11+ required), so Live 10 users get a helpful message instead of a generic exception; update the error path around track.duplicate_clip_to_arrangement to perform this capability check and only call the method when present.
679-714: Consider adding a version guard or graceful degradation for Live 10.The
track.arrangement_clipsproperty is only available in Live 11+. Since the README lists "Ableton Live 10 or newer" as a prerequisite, users on Live 10 will get an unclearAttributeErrorwhen calling this tool.🛡️ Suggested graceful degradation
def _get_arrangement_clips(self, track_index): """Return all clips placed in the Arrangement timeline for a track. ... """ try: if track_index < 0 or track_index >= len(self._song.tracks): raise IndexError("Track index out of range") track = self._song.tracks[track_index] + + # track.arrangement_clips requires Live 11+ + if not hasattr(track, 'arrangement_clips'): + raise RuntimeError( + "arrangement_clips is not available in this version of Live. " + "Arrangement View features require Live 11 or newer." + ) + clips = [] # track.arrangement_clips is available in Live 11 / 12 for clip in track.arrangement_clips:Alternatively, consider updating the README to specify that Arrangement View features require Live 11+.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@AbletonMCP_Remote_Script/__init__.py` around lines 679 - 714, The _get_arrangement_clips method assumes track.arrangement_clips exists (Live 11+), causing AttributeError on Live 10; add a version guard or fallback: detect whether track has attribute arrangement_clips (e.g., hasattr(track, "arrangement_clips")) before iterating, and if missing return a graceful response (empty clips list or a clear message) or raise a descriptive exception; update the method to reference self._song or API version if available, and ensure the error path in _get_arrangement_clips logs a helpful message about Live version compatibility instead of a raw AttributeError.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@AbletonMCP_Remote_Script/__init__.py`:
- Around line 716-756: The _duplicate_session_clip_to_arrangement function calls
the Live 11+ API track.duplicate_clip_to_arrangement without a version guard;
add a hasattr(track, "duplicate_clip_to_arrangement") check before calling it
and raise/log a clear, user-friendly error if the method is missing (e.g.,
indicate Live 11+ required), so Live 10 users get a helpful message instead of a
generic exception; update the error path around
track.duplicate_clip_to_arrangement to perform this capability check and only
call the method when present.
- Around line 679-714: The _get_arrangement_clips method assumes
track.arrangement_clips exists (Live 11+), causing AttributeError on Live 10;
add a version guard or fallback: detect whether track has attribute
arrangement_clips (e.g., hasattr(track, "arrangement_clips")) before iterating,
and if missing return a graceful response (empty clips list or a clear message)
or raise a descriptive exception; update the method to reference self._song or
API version if available, and ensure the error path in _get_arrangement_clips
logs a helpful message about Live version compatibility instead of a raw
AttributeError.
In `@MCP_Server/server.py`:
- Around line 661-675: The set_arrangement_time handler should validate that the
time parameter is non-negative before calling get_ableton_connection and
ableton.send_command; add a check in set_arrangement_time to return a clear
error string (and log via logger.error) when time < 0, and only call
ableton.send_command("set_current_song_time", {"time": time}) for valid
non-negative values, preserving the existing try/except for remote errors.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 21acfbd5-11b3-4bba-9ab3-48618a0c615f
📒 Files selected for processing (3)
AbletonMCP_Remote_Script/__init__.pyMCP_Server/server.pyREADME.md
Summary
This PR adds Arrangement View support to AbletonMCP so assistants can help users build tracks from start to finish on the Arrangement timeline, not only in Session View.
Previously, the integration was strong for Session clips, instruments, and transport, but there was no way to switch to Arrangement, move the playhead in beats, inspect arrangement clips, or copy Session clips onto the Arrangement timeline. That made it hard to automate full song structure (intro → buildup → drop → outro) in the view most composers use for final arrangements.
What’s new
MCP tools (
MCP_Server/server.py)switch_to_arrangement_viewset_arrangement_timeget_arrangement_clipsduplicate_to_arrangementduplicate_clip_to_arrangement(Ableton Live 11+).Together, these enable a practical workflow: create or edit clips in Session, duplicate them to specific bar/beat positions on the Arrangement, jump the playhead to verify, and read back what’s on the timeline.
Remote script (
AbletonMCP_Remote_Script/__init__.py)README
Performance
AbletonConnectionresponse handling: removes extra delays around state-changing commands so Arrangement (and other) operations feel snappier.Why this matters
Most finished songs live on the Arrangement timeline. Exposing Arrangement-focused tools closes the loop: users can ask an MCP-connected assistant to help structure a full track in the same view they use for mixing and export, instead of being limited to clip launching and Session-only workflows.
Notes
duplicate_to_arrangementrelies on APIs present in Live 11 / 12; older Live versions may not support all arrangement duplication features.Thank you for maintaining AbletonMCP — happy to adjust naming, docs, or version guards based on your preferences.
Summary by CodeRabbit
New Features
Documentation