Skip to content

fix: size arrangement audio clips to --length through loop_end - #139

Merged
6uclz1 merged 1 commit into
mainfrom
fix/arrangement-audio-clip-length
Oct 24, 2026
Merged

6uclz1 merged 1 commit into
mainfrom
fix/arrangement-audio-clip-length

Conversation

@6uclz1

@6uclz1 6uclz1 commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Problem

arrangement clip create TRACK --start S --length L --audio-path ABS ignored --length on audio tracks. Live 12 sizes a new arrangement audio clip to the file's warped length: a 3 s WAV at 120 BPM gives an 8-beat clip. The old code tried clip.length = L. Live raises on that because length is read-only, so the code fell back to clip.end_marker = L. It then returned success with length_set: false, end_marker_set: true, while the clip still covered 8 beats.

What Live accepted (Live 12 Suite, 2026-10-24, scratch track)

Write Result
clip.length = L raises (read-only)
end_marker = L with looping on span unchanged; only the marker moves
end_marker = L with looping off span unchanged
loop_end = loop_start + L with looping on span changes to L, both shorter and longer (8→3, 8→4, 8→6, 8→12, 8→16 beats); length reads back as L. A single write works on a fresh clip.
loop_end on an unwarped clip measured in seconds and clamped to the file duration (3 s file: loop_end stayed 3.0, length 6 beats)

The arrangement span follows loop_end - loop_start.

Change

  • After track.create_audio_clip, the backend writes loop_end = loop_start + length and reads back length. If they don't match, it fails with INVALID_ARGUMENT. details gives track, index, requested_length, actual_length, warping, looping and, when the write raised, write_error. The hint says how to recover (warp the clip, then arrangement clip loop set, or delete it).
  • The success result no longer carries requested_length / length_set / end_marker_set. Its length is the requested length, which the read-back check guarantees.
  • The new clip is found by start time with fix: arrangement clip create targets the new clip; clarify set-display #133's _created_arrangement_clip_index, and the span is set on that clip, so creating a clip before an existing one leaves the existing clip alone.
  • arrangement from-session gets the fix too, since it places audio through the same path.
  • Test stub _ArrangementAudioClip models Live: length is a read-only property equal to loop_end - loop_start, and a new clip starts at the warped length of 8 beats. _LoopEndIgnoringArrangementAudioClip models a write that Live accepts but ignores.
  • README: one paragraph on how --length is applied to audio clips and when it fails.

Public contract impact

Small, intentional. Three undocumented diagnostic fields are removed from the arrangement clip create audio result, and a length mismatch is now an error instead of ok: true. The command surface snapshot and generated skill docs are unchanged. docs/computer-use/cli-gaps.md is unchanged because the CLI can do this without the GUI.

Validation

  • uv run python -m ableton_cli.dev_checks, ruff check ., ruff format --check ., pytest (1526 passed, rebased on main 8d55f09), quality-harness dev_checks_enforce: all pass.
  • tools/generate_skill_docs.py and tools/update_public_contract_snapshot.py: no diff.
  • New tests failed before the implementation (red → green). fix: arrangement clip create targets the new clip; clarify set-display #133's out-of-order audio test now gives the existing clip 12 beats, not the default 8, so it only passes if the new clip alone is resized: [(0.0, 4.0), (16.0, 12.0)].
  • Live: installed this branch's Remote Script, restarted Live, appended a scratch audio track, and created clips from a 3 s WAV with --length 4, 12 and 8. arrangement clip props get read back length 4.0 / 12.0 / 8.0, loop_end 4.0 / 12.0 / 8.0, looping true.
  • Live, after rebasing onto fix: arrangement clip create targets the new clip; clarify set-display #133: reinstalled the Remote Script, restarted Live, and created clips on an appended scratch track out of start-time order (start 32 / len 12, then 0 / 4, then 16 / 6). arrangement clip list gives [(0, 0.0, 4.0), (1, 16.0, 6.0), (2, 32.0, 12.0)], and props get gives loop_end 4 / 6 / 12. Each clip has its requested length.
  • Not exercised in Live: the mismatch error path. A new clip is auto-warped, so create_audio_clip didn't produce an unwarped clip. That path is covered by the stub test.

Interaction with #133

Rebased onto main after #133 merged. The audio branch uses #133's start-time lookup instead of the old clips[before_count].

🤖 Generated with Claude Code

Live 12 sizes a new arrangement audio clip to the file's warped length.
Clip.length is read-only and follows loop_end - loop_start, and end_marker
does not move the span, so the old length/end_marker fallback left every
clip at Live's length while reporting success.

arrangement clip create --audio-path now writes loop_end, reads length
back and fails with INVALID_ARGUMENT when Live did not apply it (e.g.
unwarped clips, whose loop is measured in seconds).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@6uclz1
6uclz1 force-pushed the fix/arrangement-audio-clip-length branch from 33cd41a to 4814c17 Compare October 24, 2026 11:03
@6uclz1
6uclz1 merged commit 7aa553d into main Oct 24, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant