Old 10-04-2019, 03:04 PM   #1
o_e
Human being with feelings
 
o_e's Avatar
 
Join Date: May 2016
Posts: 681
Default 'smart' cut of midi items possible?

Hi,

Is it possible to read out the positon of the cursor in an item and the length of Midi notes left and right from the cursor in a script? I asked myself if it is possible to write a 'smart' cut function for midi items, deleting the small chunks left and right of the cursor (see attached pict)?

o_e is offline   Reply With Quote
Old 10-04-2019, 04:06 PM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

yes it is possible. You can get midi content of midi item independant of the contect (arrange view, midi editor etc)
X-Raym is offline   Reply With Quote
Old 10-05-2019, 01:08 AM   #3
o_e
Human being with feelings
 
o_e's Avatar
 
Join Date: May 2016
Posts: 681
Default

Quote:
Originally Posted by X-Raym View Post
yes it is possible. You can get midi content of midi item independant of the contect (arrange view, midi editor etc)
Thanks for your answer!

So it would be possible to write a script which compares the length right and left of the cursor and delete the side which is shorter. Or delete one side if it falls under a certain length threshold or a certain percentage.
I'am willing to give a little bounty if someone is interested in writing such a script..

edit:
Before someone start working on that, in the german-speaking part of the forum solger delivered a script which does what I'am looking for
https://forum.cockos.com/showthread.php?t=225694 (in combination with other scripts)

Last edited by o_e; 10-05-2019 at 02:37 AM.
o_e is offline   Reply With Quote
Old 10-16-2019, 12:37 PM   #4
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 5,844
Default

The first version of the Smart split MIDI item script bundle is now up on ReaPack.

After install the following scripts will be available in the [Main] sections of the Action List:
  • Script: solger_Smart split MIDI item (trim left note parts at cursor).lua
  • Script: solger_Smart split MIDI item (trim right note parts at cursor).lua
  • Script: solger_Smart split MIDI item (trim shorter note parts at cursor).lua

The threshold length value determining which (of the left, right or shorter) note parts will be trimmed can be adjusted inside the scripts via the noteLength und noteMultiplier parameters - by default all notes are trimmed.
__________________
ReaLauncher
solger is offline   Reply With Quote
Old 10-16-2019, 04:47 PM   #5
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
Default

Quote:
Originally Posted by solger View Post
The first version of the Smart split MIDI item script bundle is now up on ReaPack.

After install the following scripts will be available in the [Main] sections of the Action List:
  • Script: solger_Smart split MIDI item (trim left note parts at cursor).lua
  • Script: solger_Smart split MIDI item (trim right note parts at cursor).lua
  • Script: solger_Smart split MIDI item (trim shorter note parts at cursor).lua

The threshold length value determining which (of the left, right or shorter) note parts will be trimmed can be adjusted inside the scripts via the noteLength und noteMultiplier parameters - by default all notes are trimmed.
Very nice Solger!!

I'm wondering if you could make it so that it doesn't open the MIDI Editor? The functionality is great but when splitting items in the arrange window, I don't want to be forced into the MIDI Editor. Is that possible?
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
Thonex is offline   Reply With Quote
Old 10-17-2019, 12:30 PM   #6
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 5,844
Default

Quote:
Originally Posted by Thonex View Post
I'm wondering if you could make it so that it doesn't open the MIDI Editor? The functionality is great but when splitting items in the arrange window, I don't want to be forced into the MIDI Editor. Is that possible?
Currently it's necessary for the script to work (correctly).
Not sure if it's possible otherwise, but I haven't had time yet to dig into this deeper since I wanted to get version 1.0 ready for release first
__________________
ReaLauncher

Last edited by solger; 10-17-2019 at 01:00 PM.
solger is offline   Reply With Quote
Old 10-17-2019, 09:57 PM   #7
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
Default

Quote:
Originally Posted by solger View Post
Currently it's necessary for the script to work (correctly).
Not sure if it's possible otherwise, but I haven't had time yet to dig into this deeper since I wanted to get version 1.0 ready for release first
I totally get it may be necessary to have it open in order to call ME script commands, but maybe there's a way to (at the end of the script) : Get Active MIDI Focus and Close Active Window or similar or simply use the "Script: Archie_MidiEditor; Close Midi Editor.lua" .

Just brainstorming.

Thanks.

Cheers,

Andrew K
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
Thonex is offline   Reply With Quote
Old 10-18-2019, 11:37 PM   #8
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 5,844
Default

Quote:
Originally Posted by Thonex View Post
... but maybe there's a way to (at the end of the script) : Get Active MIDI Focus and Close Active Window or similar or simply use the "Script: Archie_MidiEditor; Close Midi Editor.lua" .
Thanks for the hint. I'll check out the 'close midi editor' script.
__________________
ReaLauncher
solger is offline   Reply With Quote
Old 10-19-2019, 11:00 AM   #9
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 5,844
Default

Updated version 2.0 is now available
__________________
ReaLauncher
solger is offline   Reply With Quote
Old 10-19-2019, 12:17 PM   #10
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
Default

Quote:
Originally Posted by solger View Post
Updated version 2.0 is now available
Ooooh... promised wife I'd clear out the garage... but tomorrow I'll give it a shot!! Thanks so much Solger!!

Cheers,

Andrew K
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
Thonex is offline   Reply With Quote
Old 07-26-2020, 09:16 PM   #11
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
Default

I will have a look at this... but a REALLY smart splitter would move the end of the left item to the right of the red-outlined notes-offs, and the beginning of the right item to the left of the red note-ons. That way the performance would be UNCHANGED by the split.

You would need some sort of preference to set just how far before or after the split-point to move things, of course (based on how far on top of the beat you like to play...)
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote
Old 07-28-2020, 12:30 AM   #12
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 5,844
Default

Quote:
Originally Posted by woodslanding View Post
I will have a look at this... but a REALLY smart splitter would move the end of the left item to the right of the red-outlined notes-offs, and the beginning of the right item to the left of the red note-ons. That way the performance would be UNCHANGED by the split.

You would need some sort of preference to set just how far before or after the split-point to move things, of course (based on how far on top of the beat you like to play...)
Just to clarify to what you're referring to: can you please post screenshots showing a before-after (split) example.
__________________
ReaLauncher
solger is offline   Reply With Quote
Old 07-31-2020, 09:17 PM   #13
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
Default

Here you go. I did some more thinking about this, and concluded that, while notes ever so slightly before the beat should be included in the right item, any notes begun before the split, no matter how long, need to be included in the left item.

I think the correct amount to include notes before the split in the post-splitpoint item is 1/2 of the current quantize value... i.e., if you were to quantize them, they would move to the split point.

Screenshot below....
Attached Images
File Type: png smartQuantize.png (52.6 KB, 102 views)
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote
Old 07-31-2020, 09:32 PM   #14
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
Default

One more thing:

I think all other control events in the overlap zone could just go in the post-split item. (All bets off with MPE--That would be a much gnarlier script.)

I'm trying to decide if a sus-off (cc#64) should be treated as a note-off... i.e. if the sus pedal is down before the split, should the pedal release event be included in the left item??

Well, it's probably not crucial.... I imagine there are reasons to do it either way.
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote
Old 08-03-2020, 09:08 AM   #15
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 5,844
Default

Thanks for the screenshot and info.

At the moment I'm mainly busy with work. So I don't know yet when I have time to take a closer look at this.
I'll post here as soon as I have any info or updates.
__________________
ReaLauncher
solger is offline   Reply With Quote
Old 08-03-2020, 01:08 PM   #16
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
Default

of course, no hurry no worry.... be nice, but not at the top of my wishlist by any means
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:33 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.