Duplicate length (actually double) midi clip - possible?
Hi there,
I'm looking for a device in Max for Live that can duplicate the length of a currently selected MIDI clip. Let's say you've recorded a 1-bar bassline but want to extend it to 2 bars to add some automation over the last few beats. Ableton Live has a button for this, but I need a simple device for my live performances.
I'm a beginner with Max for Live, but I'm willing to give it a shot if nobody has created this device yet. Any tips would be greatly appreciated!
You are lucky because that is a LOM function that is available for Midi clips (duplicate_loop). Before that, go to the highlighted_clip_slot, which is a property of "live_set view" and do "get clip".
Damn, now I need to uncode your message and try to do this! Thanks a lot :)
For now I've created only very simple audio effects so thats way over my skills unfortunately. Can you explain this step by step? Or make a screenshot of a device?
Ok, quick and dirty without any error checking it could look like this

Paste and play with it.
You have no idea how happy I'm now, thank you! There is still one thing I haven't thought of earlier when asking this question.
Can this be modified to duplicate a currently played clip on the midi track that the device is placed on? I was dumb to think that duplicating highlighted clip can solve my problem with live performance. I need to place this device on each midi channel and use it whenever I need to duplicate.
Yes!⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
Not sure if there was an attachement to your reply because I see some random symbols after "Yes!" but I guess that instead of using get highlighted_clip_slot I should use something like get playing_clip?
I'm checking out the live.object reference documentation but can't find the answer. Am I searching in a wrong place?
Thank you for your time.
I only added some characters to hit the stupid 15 character limit of posts.
OK, one last time! I'd also be happy to help in the form of a job if you want to develop more complex performance tools in the future.
Okay, that works in a blank project perfectly but nothing happens when I'm using this in my live project that has a lot of plugins and mapping. What may prevent this from working properly?
I have an idea for more complex MIDI tool that also does this duplication thing. I bookmarked your website and will leave a contact form when I develop the idea completely.
EDIT: Works when this effect is used as a last device in the chain.
I have no idea. Did you check the console for errors? (right click device title bar, open Max window)
live.object: 'Chain' object has no attribute 'playing_slot_index'
I've also noticed that the button isn't mappable despite of being "Visible to mapping".

The bang is not a map-able Live button.
That's because you put the device into a rack. the canonical_parent of the device is not the track in that case but the chain.
You see, there is always a next problem 😼
Somehow I can’t get this to work. The button is mapable but it doesn’t actually duplicate currently playing loop. What am I missing?
But the clicking the button works?
Yes, no problem with the button. But it’s not mapable.
Are you mapping midi input or keyboard key?
Actually none of these because the button can't be mapped. It doesn't light up blue when in mapping (cmd+m) or keyboard (cmd k)
The button in my last posted patch is mappable for sure. You can't map it in the m4l editor, device needs to be closed..
In that case I'm missing something for sure. As you can see when I'm in the midi map mode the button doesn't light up

That's not the button of my last posted patch. Create a live.button or live.text and replace the Max button
Yes, that's true. But the latest patch (the one that it's mappable) doesn't duplicate at all. I've sent you an email with a video that shows the problem.
Yes, because that is the version for the "device is in a rack" - case. ;) I got your mail address now, let me send you a device to end this confusion!
Many many many thanks!