LIGHT TIMING: the real offset up to a full 16th, no flag on a cue already on a solid hit, hold moves the cues
- Detection in 2.5 ms steps; where a hit starts is halfway up its rise; each song's cues on solid hits set its "on time"; a cue already on a solid hit is never named; "about a 16th" when it is - Hold: moves the off cues onto their hit in the open set through a status panel command added to AbletonOSC (tools/abletonosc), keeping each cue's end; the key asks for a save until the set is saved Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
"""Status panel additions to AbletonOSC (installed by tools/abletonosc/install.sh on the Tracks Mac).
|
||||
|
||||
/live/statuspanel/move_note <track name> <beat> <pitch> <new beat>
|
||||
Moves the note of `pitch` that starts at arrangement `beat` on the arrangement MIDI clip of the track
|
||||
called `track name` so it starts at `new beat`, keeping where it ends (the next cue is not touched).
|
||||
Answers (<track name>, <beat>, <pitch>, <moved: 0 or 1>). Undo in Live (Cmd+Z) puts it back.
|
||||
"""
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger("abletonosc")
|
||||
|
||||
|
||||
def register(handler):
|
||||
def move_note(params):
|
||||
song = handler.song
|
||||
name, beat, pitch, new = str(params[0]), float(params[1]), int(params[2]), float(params[3])
|
||||
track = next((t for t in song.tracks if t.name.strip().upper() == name.strip().upper() and t.has_midi_input), None)
|
||||
moved = 0
|
||||
for clip in (track.arrangement_clips if track else []):
|
||||
if not (clip.start_time - 1e-6 <= beat < clip.end_time):
|
||||
continue
|
||||
zero = clip.start_time - (clip.loop_start if clip.looping else clip.start_marker)
|
||||
local, new_local = beat - zero, new - zero
|
||||
notes = clip.get_notes_extended(pitch, 1, local - 0.002, 0.004)
|
||||
for n in notes:
|
||||
end = n.start_time + n.duration
|
||||
if new_local < end:
|
||||
n.start_time, n.duration = new_local, end - new_local
|
||||
moved += 1
|
||||
if moved:
|
||||
clip.apply_note_modifications(notes)
|
||||
break
|
||||
logger.info("statuspanel: %s note %d at %s -> %s: %d moved", name, pitch, beat, new, moved)
|
||||
return name, beat, pitch, moved
|
||||
|
||||
handler.osc_server.add_handler("/live/statuspanel/move_note", move_note)
|
||||
Reference in New Issue
Block a user