Old 02-23-2024, 05:28 PM   #1
ImJim
Human being with feelings
 
Join Date: Dec 2023
Posts: 26
Default Divisi-like script to explode chords to items?

I make orchestral music in Reaper and write lots of 4, 5 or 6-part harmonies, all played by separate monophonic legato instruments, on separate MIDI tracks.

Laying out chords and voicings on the piano is easy, but then spreading those notes quickly across items (i.e for a legato string ensemble) to sketch ideas is a lot slower when you have to copy / paste or play each voice in the corresponding MIDI item.

On paper, Item: Explode MIDI note rows (pitch) to new items seems to do exactly that, but it turns out to be pretty much useless in the context of a performance with more than one chord: it creates 1 new item + 1 new track per note played. So if I have two consecutive chords made out of 4 notes each, it will actually create 8 new items in 8 tracks (one per note). Pointless, as when writing harmonies, you're using a fixed number of instruments, so a fixed number of voices (= items) no matter the MIDI content.

So what would be great is some kind of "voice-aware" divisi script that detects note pitch and figures out the harmony based on the relative positions of all the notes in a MIDI item. It would then create exploded items right under the "parent" item, without creating new tracks, but rather just placing them on the available tracks below.

Maybe detecting legato note overlaps could help the script identify each voice (as it would look like a continuous line) and treat it separately? Just thinking out loud here.

I searched the forum quite extensively but I haven't found what I hoped for... MIDI Chord Splitter (Polyphonic Splitter) by PCartwright is very close, but it's intended for live playing and doesn't handle overlaps. I just want to explode overlapped (or not) chord notes after the fact, not live.

Have any of you been searching for a similar script? How hard would it be to code? I'm sure some genius scripters around here could do wonders...

Thanks everyone!
ImJim is offline   Reply With Quote
Old 02-24-2024, 01:42 AM   #2
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
Default

Did you check ReaPack ?
mschnell is offline   Reply With Quote
Old 02-24-2024, 04:57 AM   #3
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

Here are alternative actions to Item: Explode MIDI note rows (pitch) to new items.

I dont think there is what you are looking for though :/

Try other keywords, like chord / midi, but I didnt font somethingnmile that. Maybe it exists with unexplicit name but it may just not exist yet.
X-Raym is offline   Reply With Quote
Old 02-24-2024, 06:22 AM   #4
ImJim
Human being with feelings
 
Join Date: Dec 2023
Posts: 26
Default

Quote:
Originally Posted by X-Raym View Post
Here are alternative actions to Item: Explode MIDI note rows (pitch) to new items.

I dont think there is what you are looking for though :/

Try other keywords, like chord / midi, but I didnt font somethingnmile that. Maybe it exists with unexplicit name but it may just not exist yet.
Merci Raymond I think I've tried every possible variant of that feature already, and none of those seem to do what I want. Something tells me this shouldn't be too hard to code especially for an advanced programmer.

I found like 10 different posts in the forum asking for pretty much exactly the same thing, and unfortunately no one could come up with anything close.

I'm surprised there aren't many proper composition / orchestration tools available already. Or are there any I'm not aware of?
ImJim is offline   Reply With Quote
Old 02-24-2024, 06:27 AM   #5
ImJim
Human being with feelings
 
Join Date: Dec 2023
Posts: 26
Default

Quote:
Originally Posted by mschnell View Post
Did you check ReaPack ?
Hmm what do you mean? I have lots of Reapack repositories installed. Do you have any specific repo in mind I could look into?
ImJim is offline   Reply With Quote
Old 02-24-2024, 07:47 AM   #6
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
Default

No. But I seem to remember having tried one some years ago. Forgot the name

Last edited by mschnell; 02-24-2024 at 07:56 AM.
mschnell is offline   Reply With Quote
Old 02-24-2024, 08:41 AM   #7
ImJim
Human being with feelings
 
Join Date: Dec 2023
Posts: 26
Default

Quote:
Originally Posted by mschnell View Post
No. But I seem to remember having tried one some years ago. Forgot the name
Ohh that's too bad. And was it working back then? I'm a total noob when it comes to scripting, the only thing I managed to do is write some item management scripts with the help of ChatGPT. Tried to write that MIDI explode tool again but it just doesn't work, guess I'm out of luck using GPT for that kind of task!
ImJim is offline   Reply With Quote
Old 02-24-2024, 09:51 AM   #8
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

Quote:
Something tells me this shouldn't be too hard to code especially for an advanced programmer.
Not too hard but still take time and effort.
X-Raym is offline   Reply With Quote
Old 02-24-2024, 10:27 AM   #9
ImJim
Human being with feelings
 
Join Date: Dec 2023
Posts: 26
Default

Quote:
Originally Posted by X-Raym View Post
Not too hard but still take time and effort.
How much would you charge for such a script?
ImJim is offline   Reply With Quote
Old 02-24-2024, 11:12 AM   #10
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@ImJim
Well, it depends on what is the exact need, it would be a more clear with screenshots.

Redeading first posts, I may have under estimate the complexity og the request here, it seems to be a more complex system than just splitting a chords into items based on pitch level on the note, as there is some things like 'voice aware' etc.

As unquatized chord detection (notes not aligned) seems complex too.
X-Raym is offline   Reply With Quote
Old 02-24-2024, 11:44 AM   #11
J Reverb
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,071
Default

What about the new lanes option you could explode notes to new lanes perhaps ?
J Reverb is offline   Reply With Quote
Old 02-24-2024, 12:13 PM   #12
ImJim
Human being with feelings
 
Join Date: Dec 2023
Posts: 26
Default

Quote:
Originally Posted by J Reverb View Post
What about the new lanes option you could explode notes to new lanes perhaps ?
Interesting, could you expand on this a bit? What's that lanes option?
ImJim is offline   Reply With Quote
Old 02-24-2024, 12:26 PM   #13
ImJim
Human being with feelings
 
Join Date: Dec 2023
Posts: 26
Default

Quote:
Originally Posted by X-Raym View Post
@ImJim
Well, it depends on what is the exact need, it would be a more clear with screenshots.

Redeading first posts, I may have under estimate the complexity og the request here, it seems to be a more complex system than just splitting a chords into items based on pitch level on the note, as there is some things like 'voice aware' etc.

As unquatized chord detection (notes not aligned) seems complex too.
Just sent you a private message with more details

Actually, "voice-aware" made it sound unnecessarily sophisticated. I just meant that the script would be able to figure out which note is the first, (top one), then second, third, etc... no matter the chord changes and movements, at any given point in time.

The end result when using the script would look like this:



Notice how note start / end times, overlaps and item length are all preserved
ImJim is offline   Reply With Quote
Old 02-24-2024, 02:33 PM   #14
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
Default

Quote:
Originally Posted by ImJim View Post
Ohh that's too bad. And was it working back then? I'm a total noob when it comes to scripting, the only thing I managed to do is write some item management scripts with the help of ChatGPT. Tried to write that MIDI explode tool again but it just doesn't work, guess I'm out of luck using GPT for that kind of task!
I found what I tried: -> https://forum.cockos.com/showthread.php?t=26559
There also is "Poly Splitter" in ReaPack -> ReaRack.

Last edited by mschnell; 02-24-2024 at 02:42 PM.
mschnell is offline   Reply With Quote
Old 02-24-2024, 03:00 PM   #15
inthevoid
Human being with feelings
 
inthevoid's Avatar
 
Join Date: May 2022
Location: London
Posts: 427
Default

Would also find a tool to be able to do this super useful. I do a lot of orchestration work and this would be fantastic to quickly explode out full ensemble patches and then fine tune from there.
__________________
ReaPack Scripts
inthevoid is offline   Reply With Quote
Old 02-24-2024, 03:54 PM   #16
ImJim
Human being with feelings
 
Join Date: Dec 2023
Posts: 26
Default

Quote:
Originally Posted by mschnell View Post
I found what I tried: -> https://forum.cockos.com/showthread.php?t=26559
There also is "Poly Splitter" in ReaPack -> ReaRack.
ReaRack? The synthesizer? I can't find anything called ReaRack in Reapack. Is that a repo I need to install?
ImJim is offline   Reply With Quote
Old 02-24-2024, 04:31 PM   #17
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
Default

Quote:
Originally Posted by ImJim View Post
ReaRack? The synthesizer? I can't find anything called ReaRack in Reapack. Is that a repo I need to install?
Yep (it's there in the standard ReaTeam Repository. )
ReaRack consists of a lot JSFX plugins.
mschnell is offline   Reply With Quote
Old 02-24-2024, 04:56 PM   #18
Talagan
Human being with feelings
 
Join Date: Feb 2016
Location: Paris / France
Posts: 293
Default

Seems to me quite sophisticated (because you can't always decide what is a voice), but what about a semi-automatic tool where you work incrementally ?

The tool tries to select the upper voice notes, you may then correct the selection manually, you click on "split", this creates a new item with the selected notes, and remove them from your current item... then you repeat. Would that be a too tedious process ?

By the way, it would be partially based on a quite simple action that I could not find anywhere which does just "separate selected notes into a new item" but could be useful in any context... (and which is easy to write).
Talagan is offline   Reply With Quote
Old 02-24-2024, 05:41 PM   #19
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

Yes, I can only imagine a programmtic version working on simple case like.


If you have unquantized, unsynced, multiple level of voicing chords... it need human input to decide.
X-Raym is offline   Reply With Quote
Old 02-24-2024, 05:46 PM   #20
Talagan
Human being with feelings
 
Join Date: Feb 2016
Location: Paris / France
Posts: 293
Default

Yep, I've dug a little and this is a whole subject of research. There are solutions that are quite documented, like this article :

https://homepages.inf.ed.ac.uk/steed...Separation.pdf

Which even proposes source code in java. This is based on a markov model, and it probably needs a consequent amount of investment to understand and port to Reaper.
Talagan is offline   Reply With Quote
Old 02-24-2024, 11:50 PM   #21
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@Talagan
There is as been a Markov model script (for another task) but indeed it is quite overkill for the task.
X-Raym is offline   Reply With Quote
Old 02-25-2024, 01:13 AM   #22
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
Default

Quote:
Originally Posted by Talagan View Post
Seems to me quite sophisticated
That is why Divisimate is a commercial product. -> https://divisimate.com/
mschnell is offline   Reply With Quote
Old 02-25-2024, 04:59 AM   #23
ImJim
Human being with feelings
 
Join Date: Dec 2023
Posts: 26
Default Almost there...

Quote:
Originally Posted by Talagan View Post
Seems to me quite sophisticated (because you can't always decide what is a voice), but what about a semi-automatic tool where you work incrementally ?
Yes, after doing some research yesterday, I think I'm better off taking that path. I'm trying to build a custom action to do this sequentially.

I'm now using Kawa's very clever script "SelectTopNotes_Near)" which has the ability to detect the highest notes in a progression even if notes are not quantized. It's simply the best I've seen for that task:



Then, as you mentioned, I'd need some simple script to copy those selected notes to a new MIDI item just below the initial item containing the chord. So far I have BuyOne's script as well as rodilab's. rodilab's is more appropriate for me since it doesn't create a new track when making a new item.

I'm almost there but I'm facing two issues:

- rodilab's script doesn't put the new item below the initial item, but puts it on top of the existing one:



Since I want to extract notes sequentially, it needs to put each new item below the previous one so they don't overlap (skip previous items until there's free space on the track). It must not create any new tracks if tracks are already available below. I have an orchestral template already setup, so I'd just just like items to be added on existing tracks.

- I can't create a custom action out of these scripts since they work in different sections, Kawa's script only works in the MIDI editor. I'd like to be able to run the action from the main section after selecting an item - I've read that you need scripting to execute actions that work in different scopes. Any pointers of how that's done? Again I don't know a thing about scripting so I'm a bit lost here

So these are the two things I'd need to make this work, I think.

To summarize: select item 1, select the top notes (Kawa), move these notes to new item 2 right under item 1 (without creating a new track), then again, select highest notes, create new item 3 under item 2... again and again until no notes are left.

At this point I'm just hoping some genius can either modify rodilab's script, or write a new little script that takes care of copying notes to new items with the behavior I explained above Then I'd just need to figure out how to create a custom action that works on the main section...
ImJim is offline   Reply With Quote
Old 02-25-2024, 05:47 AM   #24
Talagan
Human being with feelings
 
Join Date: Feb 2016
Location: Paris / France
Posts: 293
Default

@X-Raym thanks for the link ! Very interesting experiment.

Quote:
Originally Posted by ImJim View Post
Then, as you mentioned, I'd need some simple script to copy those selected notes to a new MIDI item just below the initial item containing the chord. So far I have BuyOne's script as well as rodilab's. rodilab's is more appropriate for me since it doesn't create a new track when making a new item.
Have you tried to check this option in Reaper : Options > Offset overlapping media items vertically ? This won't move your voice items on other tracks but will probably enhance greatly this flow.

Quote:
Originally Posted by ImJim View Post
- I can't create a custom action out of these scripts since they work in different sections, Kawa's script only works in the MIDI editor. I'd like to be able to run the action from the main section after selecting an item - I've read that you need scripting to execute actions that work in different scopes. Any pointers of how that's done? Again I don't know a thing about scripting so I'm a bit lost here
You can chose the section to which you want to attach a script, and it can be attached to multiple sections. If you want the kawa script to be callable from the Main Section, from the action window, select first the section you want the script to be added to (it's the combobox at the top right of the window), then "New Action > Load Reascript" and select the script's file. Would this work for you ?

Edit : This is the result I get using a custom action that combines the kawa and rodilab scripts, and with the option I mentioned above :



Ben

Last edited by Talagan; 02-25-2024 at 06:09 AM.
Talagan is offline   Reply With Quote
Old 02-25-2024, 08:11 AM   #25
ImJim
Human being with feelings
 
Join Date: Dec 2023
Posts: 26
Default

Quote:
Originally Posted by Talagan View Post
If you want the kawa script to be callable from the Main Section, from the action window, select first the section you want the script to be added to (it's the combobox at the top right of the window), then "New Action > Load Reascript" and select the script's file.
Man you're a life saver! It was that simple! Didn't know re-importing the separate lua script file in the appropriate section would do the trick. I thought there was some kind of internal setting embedded in the script telling Reaper to place it in a given section. That's good to know, I'll make sure to use this trick in the future!

I missed the edit at the bottom of your post since I was busy testing my custom action. What I came up with looks pretty much exactly like you:



There's probably a bit more stuff going on here though, I made two actions in total to make it fully functional. The first one does the note explode stuff, and unselects the newly created item to go back to the original one, so I can just trigger the action again n times depending on the number of notes in my harmony:



Then I have a separate action to spread items to tracks vertically under my cursor. It's using Xraym's great item explode script:



I think there's room for optimization of course, it's still a two-step process since I have to manually spread items across tracks. I wish rodilab's script just distributed items on the closest track available below. Thanks for the overlapping items setting btw, I wasn't aware of this and it makes much more sense for MIDI items.

EDIT: I had to change FnA's script to "SWS: select first items of selected tracks". It's cleaner and behaves better, the other script was randomly selecting/unselecting the wrong item. Now it ensures the top item containing the chord is always re-selected in order to repeat the action multiple times.

Last edited by ImJim; 02-25-2024 at 08:41 AM.
ImJim is offline   Reply With Quote
Old 02-26-2024, 03:09 AM   #26
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

Glad you find a good enough workarround for your request, and not too complex to implement (compared to what it could have been ^^)😉
X-Raym is offline   Reply With Quote
Old 02-26-2024, 10:59 AM   #27
inthevoid
Human being with feelings
 
inthevoid's Avatar
 
Join Date: May 2022
Location: London
Posts: 427
Default

Hi all,

Very quickly hacked this together using Rodilab's and kawa's scripts, as a solution for having to manually spread items across tracks:

https://streamable.com/v5f1nu

It distributes voices (selecting notes using kawa's select top notes_Near script) to tracks you have selected. So you just for e.g. select your sketch piano item, then select violin 1, violin 2, viola, cello, and bass, and hit the button and it sticks a voice on each. Thought it would be good for it to use your track selection since often you don't necessarily want it on consecutive tracks.

You will need to go into the script and paste in the command ID for kawa's SelectTopNotes_Near script (right click and Copy Command ID in the action window) for lines 44 and 69, in between the single quotes after reaper.NamedCommandLookup(, as I don't think they're the same between machines. Same goes for line 77 and Mordi's 'Set selected items active takes name to track name' script if you want it to auto-populate the items with track names. I've commented it out in the script I've attached in case you don't have that script. Edit: My mistake, you don't need to do this.

As I say it's a bit of a hack for now as it relies on calling kawa's script via Main_OnCommand rather than something fully integrated but hopefully a decent one button solution rather than 2 actions - might revisit this if I get some time!

Edit: now shows warning popup if you haven't selected an item.

Cheers!
Attached Files
File Type: lua hb_Explode MIDI chords to selected tracks v3.lua (3.0 KB, 22 views)
__________________
ReaPack Scripts

Last edited by inthevoid; 02-26-2024 at 01:07 PM.
inthevoid is offline   Reply With Quote
Old 02-26-2024, 11:53 AM   #28
Talagan
Human being with feelings
 
Join Date: Feb 2016
Location: Paris / France
Posts: 293
Default

Well done, @inthevoid ! Thanks for taking the time to do this.

Quote:
Originally Posted by X-Raym View Post
Glad you find a good enough workarround for your request, and not too complex to implement (compared to what it could have been ^^)😉
Couldn't agree more with this ! ^^
Talagan is offline   Reply With Quote
Old 02-26-2024, 12:22 PM   #29
ImJim
Human being with feelings
 
Join Date: Dec 2023
Posts: 26
Default

Quote:
Originally Posted by inthevoid View Post
Hi all,

Very quickly hacked this together using Rodilab's and kawa's scripts, as a solution for having to manually spread items across tracks:

https://streamable.com/v5f1nu

It distributes voices (selecting notes using kawa's select top notes_Near script) to tracks you have selected. So you just for e.g. select your sketch piano item, then select violin 1, violin 2, viola, cello, and bass, and hit the button and it sticks a voice on each. Thought it would be good for it to use your track selection since often you don't necessarily want it on consecutive tracks.

You will need to go into the script and paste in the command ID for kawa's SelectTopNotes_Near script (right click and Copy Command ID in the action window) for lines 44 and 69, in between the single quotes after reaper.NamedCommandLookup(, as I don't think they're the same between machines. Same goes for line 77 and Mordi's 'Set selected items active takes name to track name' script if you want it to auto-populate the items with track names. I've commented it out in the script I've attached in case you don't have that script.

As I say it's a bit of a hack for now as it relies on calling kawa's script via Main_OnCommand rather than something fully integrated but hopefully a decent one button solution rather than 2 actions - might revisit this if I get some time!

Edit: now shows warning popup if you haven't selected an item.

Cheers!
This is fantastic dude! My dual action technique was a bit clumsy indeed, especially having to explode voices one by one with repeated keystrokes. I can confirm action command IDs are identical regardless of the machine you're using.

That feature to select tracks before exploding is a great addition too!
ImJim is offline   Reply With Quote
Old 02-26-2024, 01:08 PM   #30
inthevoid
Human being with feelings
 
inthevoid's Avatar
 
Join Date: May 2022
Location: London
Posts: 427
Default

Quote:
Originally Posted by ImJim View Post
This is fantastic dude! My dual action technique was a bit clumsy indeed, especially having to explode voices one by one with repeated keystrokes. I can confirm action command IDs are identical regardless of the machine you're using.

That feature to select tracks before exploding is a great addition too!
Great, glad to hear it's useful! Thanks, have edited my post to remove the bit about needing to insert different command IDs.
__________________
ReaPack Scripts
inthevoid 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 04:27 AM.


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