Old 12-11-2017, 09:34 AM   #1
JoPiano
Human being with feelings
 
Join Date: Apr 2016
Posts: 46
Default key split

Is there a possibility to force a key split for piano scores?
JoPiano is offline   Reply With Quote
Old 12-11-2017, 11:03 AM   #2
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
Default

I suppose that there is a JSFX that can do this. If not, it's just a small script assigning midi channels to key on/off events..

-Michael
mschnell is offline   Reply With Quote
Old 12-11-2017, 03:54 PM   #3
Jason Lyon
Human being with feelings
 
Join Date: May 2016
Posts: 720
Default Jo

Quote:
Originally Posted by JoPiano View Post
Is there a possibility to force a key split for piano scores?
That would really help, but it wouldn't be ideal to just chop the part in half at eg middle C. What I've done in the past is score parts in Sibelius using different "voices" for RH and LH wherever they may be on the grand staff, and then copy, filter and split them before exporting the MIDI for real detailed work. But that's more of a composer's approach.

It must be possible to split a single track this way in REAPER though, even if it is just into "Above C" and "Below C", which would be better than nothing. I'll investigate, and if I find a way, I'll let you know.
Jason Lyon is offline   Reply With Quote
Old 12-11-2017, 06:39 PM   #4
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,618
Default

Quote:
Originally Posted by JoPiano View Post
Is there a possibility to force a key split for piano scores?

probably but I think we need to know more about what you exactly want to accomplish

do tell
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva
hopi is offline   Reply With Quote
Old 12-12-2017, 06:35 AM   #5
Jason Lyon
Human being with feelings
 
Join Date: May 2016
Posts: 720
Default Hopi

Quote:
Originally Posted by hopi View Post
probably but I think we need to know more about what you exactly want to accomplish

do tell
If I could jump in here and make some suggestions. The idea would be to start with a MIDI track featuring a full piano performance and wind up with two MIDI tracks - Pno RH and Pno LH. These could then be assigned to different VSTIs or simply worked on separately to convey the finesse of a pianist's hand independence, or both.

I suppose the quickest working methodology would be a script to take a MIDI channel and choose an option to filter out only the notes below or above a chosen split point (default probably middle C - note 60, but the ability to choose it would be very useful). The above range should include the split note, the below range not.

That way, the user could duplicate the original track and filter notes out on both to make one Pno RH and the other Pno LH.

The ideal result would be to choose one track, apply a split point and then have the script generate the Pno RH and Pno LH MIDI tracks and mute the original, so the process is automatic and non-destructive.

I think this is what the OP has in mind. Of course, if they want an auto split when actually performing, that can be done with the keyboard's own split and channel assignment settings.

I have been a programmer myself, so I'm trying to imagine what's possible and the best way of achieving it. But I'm afraid I just don't know enough about REAPER scripting to do it myself.
Jason Lyon is offline   Reply With Quote
Old 12-12-2017, 07:50 AM   #6
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
Default

Quote:
Originally Posted by Jason Lyon View Post
But I'm afraid I just don't know enough about REAPER scripting to do it myself.
What do you need to know ? (Regarding JSFX I might be able to provide some tips.)

-Michael
mschnell is offline   Reply With Quote
Old 12-12-2017, 08:07 AM   #7
JoPiano
Human being with feelings
 
Join Date: Apr 2016
Posts: 46
Default

Thanks for all replies. What I'm looking for is a way to make readable scores for keyboardists/pianists out of a midi-recording in less time. Of course could you assign notes to different voices and these to the two tracks of a piano staff. But it would be easier, if the program itself would divide the notes by a given - and modifiable - split note. Like all score editors and notation programs can do. Pure luxury would be a tool like in Logic Pro, with what one can draw in a flexible split point (see f.e. https://www.youtube.com/watch?v=vouH5DcP3v0).
JoPiano is offline   Reply With Quote
Old 12-12-2017, 09:07 AM   #8
Jason Lyon
Human being with feelings
 
Join Date: May 2016
Posts: 720
Default M Schnell

Quote:
Originally Posted by mschnell View Post
What do you need to know ? (Regarding JSFX I might be able to provide some tips.)

-Michael
Please do. Judging from Jo's response, it seems I've got a reasonable handle on the general objective, if not yet the methodology. I might be able to figure out at least a basic splitting script. If I could get that going, then maybe others could offer suggestions and refinements.

I'm presuming JS is reasonably C-like. Is there any kind of documentation online for it?
Jason Lyon is offline   Reply With Quote
Old 12-12-2017, 11:01 AM   #9
Jason Lyon
Human being with feelings
 
Join Date: May 2016
Posts: 720
Default JoPiano

Quote:
Originally Posted by JoPiano View Post
Is there a possibility to force a key split for piano scores?
Been doing some prelim investigation, starting with "custom actions" (REAPER's version of macros). It's not a simple task via scripting, but we'll see.

It may be obvious to you, but I thought I'd mention that there is a quick and dirty way to do it.

Duplicate your piano MIDI track. Choose the upper copy and open the MIDI edit window. Right click at the start on eg B2 and drag all the way across and down to select all those notes. Delete.
Choose the lower one and open the MIDI edit window. Right click at the start on eg C3 and drag all the way across and up to select all those notes. Delete.
Your two MIDI tracks are now split at middle C, with the full pedalling and dynamic MIDI messages still on both. Although some of the messages will be referring to notes that one or other track doesn't contain anymore. Not such a huge deal with an instrument like piano...

If you wanted to do it as you play, the best way would be to use your keyboard's split and channel assign settings. They're typically used for eg bass in LH and piano/EP in RH, but there's no reason why you can't set a split point and have the different sides of it assigned to different MIDI outs.

Personally, while I like the fact that REAPER has taken the step into notation layout, I wouldn't use it to prepare written parts for anything more than meat'n'potatoes stuff just yet...

And of course, neither scorewriting programs nor DAWs can tell left from right intuitively.

Last edited by Jason Lyon; 12-12-2017 at 01:01 PM.
Jason Lyon is offline   Reply With Quote
Old 12-12-2017, 11:18 PM   #10
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
Default

Quote:
Originally Posted by Jason Lyon View Post
I'm presuming JS is reasonably C-like. Is there any kind of documentation online for it?
EEL2 language -> https://www.reaper.fm/sdk/js/js.php
As EEL2 also is used for Reaper scripts -> https://www.reaper.fm/sdk/reascript/reascript.ph and OSCII-Bot scripting -> https://www.cockos.com/oscii-bot/ it is very viable for advanced reaper users.

IMHO (I do know quite a lot of computer languages) it is not very C like, but it uses some basic common syntax constructs.

It's a bit special (e.g. regarding Arrays, Strings and Objects), but IMHO it can rather easily be managed.

(I don't know if ReaScript (can work on stored Midi) or JSFX (can work in Realtime) is required for the task in question, but in fact both can be done using EEL2.)

-Michael

Last edited by mschnell; 12-13-2017 at 08:38 AM.
mschnell is offline   Reply With Quote
Old 12-13-2017, 12:47 AM   #11
Jason Lyon
Human being with feelings
 
Join Date: May 2016
Posts: 720
Default Michael

Vielen Dank.

I reckon I can work like that - EEL seems to be the easiest native environment.
Should just be a matter of getting the number of MIDI notes in a track and stepping through them by ID, deleting if less or more than a defined note value.
I had been concerned I'd have to create an array to store the MIDI values and parse them, but it seems you can just work dirty.
Jason Lyon is offline   Reply With Quote
Old 12-13-2017, 02:56 AM   #12
snooks
Banned
 
Join Date: Sep 2015
Posts: 1,650
Default

You don't need two tracks, select some or all of the notes you want moved to the other staff and run one of the actions...

Notation: Set staff to first/second of pair

The Logic draw method would almost certainly be possible with a script that selected all notes under and above or below the mouse cursor as it is moved along, periodically calling one of the above actions.
snooks is offline   Reply With Quote
Old 12-13-2017, 03:37 AM   #13
Jason Lyon
Human being with feelings
 
Join Date: May 2016
Posts: 720
Default

Quote:
Originally Posted by snooks View Post
You don't need two tracks, select some or all of the notes you want moved to the other staff and run one of the actions...

Notation: Set staff to first/second of pair

The Logic draw method would almost certainly be possible with a script that selected all notes under and above or below the mouse cursor as it is moved along, periodically calling one of the above actions.
That action is useful to know, thanks.

Although I usually take scores into MIDI, rather than vice versa. I'd say that if the OP is mostly playing pop, then a set split at C would work most of the time. For jazz or funk stuff, particularly if the left hand is playing some kind of bass figure, you could split about half an 8ve lower.

For anything else, I'd really think in terms of either outputting the MIDI performance for editing in a score program or just writing it that way first. Some of my piano scores in Sibelius use up to four voices on a grand staff for visual clarity. And a ton of hidden MIDI messages for each one.

An adaptable sliding split point would be very nice indeed for some of us - but I think it's probably rather a niche requirement. And as I said before, it's great that REAPER now has some degree of notation ability, but for the moment it's more for choice of visual display than published output.

When I take a classical style piece into REAPER, it's in MIDI land pretty much from there on.

Who knows? Maybe in version 7 point something... I wouldn't put anything past this program and its community. There just seems to be more desire for things like side-chain compression of snares than notation stuff - which is democracy healthily at work.
Jason Lyon is offline   Reply With Quote
Old 12-13-2017, 04:28 AM   #14
JoPiano
Human being with feelings
 
Join Date: Apr 2016
Posts: 46
Default

Quote:
Originally Posted by Jason Lyon View Post
There just seems to be more desire for things like side-chain compression of snares than notation stuff - which is democracy healthily at work.
Is this the case? Okay, I seem to be an old guy ...
JoPiano is offline   Reply With Quote
Old 12-13-2017, 05:32 AM   #15
Jason Lyon
Human being with feelings
 
Join Date: May 2016
Posts: 720
Default

Quote:
Originally Posted by JoPiano View Post
Is this the case? Okay, I seem to be an old guy ...
You and me both, Jo. I've done sessions where they lovingly position a dozen expensive mics around the drums and check it for an hour, then strap a crappy SM58 knockoff to the piano and just ask "is that loud enough for you?"

"Er, well, I can hear myself, I suppose. A pair of condensers would be better though."

"No, we had to use those on the kit."

"Okay..."

Last edited by Jason Lyon; 12-13-2017 at 05:55 AM.
Jason Lyon is offline   Reply With Quote
Old 12-14-2017, 03:39 AM   #16
Jason Lyon
Human being with feelings
 
Join Date: May 2016
Posts: 720
Default JoPiano

These probably aren't the droids you're looking for, but here's some interim work.
It's rough and I'll refine it as I go along, but if you select a track and run one of these scripts it will automatically reduce the track to the RH or LH, given your chosen split point. RH version includes the split point, LH doesn't.

I've tested it with a florid piano concerto movement containing about 5,000 notes and it seems to be working okay - but use at your own risk. It's only safety netted to the point where it'll do nothing if the user input isn't between 1 and 126 and/or there's no track selected. And it's destructive - although the entire operation can be reversed with a simple Undo.

LH Script:

/* EEL script for REAPER v5+
* Jason Lyon Dec 2017
*/

/// Deletes all MIDI notes above and including user-chosen input on selected track, leaving Pno LH part only.
/// MIDI controller info is retained.

function JL_PnoLH(proj)

(
GetUserInputs("MIDI Piano Splitter for LH", 1, "Enter Split Note (middle C is 60)", #input);
match("%u", #input, splitpoint);
splitpoint -= 1; /// include Split Point in selection
splitpoint !=0 ? (splitpoint < 127 ? (
/// Following code will only execute if Split Point is entered as integer 1-126

trackid = GetSelectedTrack(proj, 0);
mediaid = GetTrackMediaItem(trackid, 0);
takeid = GetActiveTake(mediaid);

MIDI_CountEvts(takeid, totalnotes, 0, 0);
counter = 0;

while (counter !== totalnotes)
(
MIDI_GetNote(takeid, counter, 0, 0, 0, 0, 0, notepitch, 0);
abovesplit = notepitch > splitpoint;
abovesplit ? (MIDI_DeleteNote(takeid, counter); /// If above Split Point remove
totalnotes -= 1; ) : /// and cut the loop endpoint down by one
counter += 1; /// Else move on
);
)
);
);

JL_PnoLH();

- - -

RH Script:

/* EEL script for REAPER v5+
* Jason Lyon Dec 2017
*/

/// Deletes all MIDI notes below but not including user-chosen input on selected track, leaving Pno RH part only.
/// MIDI controller info is retained.

function JL_PnoRH(proj)

(
GetUserInputs("MIDI Piano Splitter for RH", 1, "Enter Split Note (middle C is 60)", #input);
match("%u", #input, splitpoint);
splitpoint !=0 ? (splitpoint < 127 ? (
/// Following code will only execute if Split Point is entered as integer 1-126

trackid = GetSelectedTrack(proj, 0);
mediaid = GetTrackMediaItem(trackid, 0);
takeid = GetActiveTake(mediaid);

MIDI_CountEvts(takeid, totalnotes, 0, 0);
counter = 0;

while (counter !== totalnotes)
(
MIDI_GetNote(takeid, counter, 0, 0, 0, 0, 0, notepitch, 0);
belowsplit = notepitch < splitpoint;
belowsplit ? (MIDI_DeleteNote(takeid, counter); /// If below Split Point remove
totalnotes -= 1; ) : /// and cut the loop endpoint down by one
counter += 1; /// Else move on
);
)
);
);

JL_PnoRH();

Last edited by Jason Lyon; 12-14-2017 at 07:10 AM.
Jason Lyon is offline   Reply With Quote
Old 12-14-2017, 07:25 AM   #17
JoPiano
Human being with feelings
 
Join Date: Apr 2016
Posts: 46
Default

Hi Jason,
thanks a lot for your work, but I'm a (hobby-)musician, not a programmer. I need an icon to click on it or a shortcut. How do I use your scripts?
JoPiano is offline   Reply With Quote
Old 12-14-2017, 03:57 PM   #18
Jason Lyon
Human being with feelings
 
Join Date: May 2016
Posts: 720
Default JoPiano

Hey Jo.

If you need it desperately, I'll explain. Otherwise, just stay tuned.
I should soon have a script (called JLPnoSplitter or something like that) which will one-shot the whole process.

That is:
Prompt you for a split point.
Create two child tracks and process their contents as RH and LH.
Mute the MIDI on the Parent, so the full original part isn't destroyed in the process.

Oh, and I'm a pro musician but an amateur coder (or at least a rather rusty old C Dog, who's having to learn on the gig for this). But I think it's a worthwhile exercise, because it's something I've wanted to be able to do myself and never found.

Actually, I'm a pro musician who's using this exercise as an excuse to avoid practicing... Some pro, eh?
Jason Lyon is offline   Reply With Quote
Old 12-15-2017, 03:52 AM   #19
snooks
Banned
 
Join Date: Sep 2015
Posts: 1,650
Default

Here's a different solution that just assigns notes to specific staves, depending on selected note row.

I have attached the file.
edit: updated to not always sort notes. Faster now.
edit2: updated to use SetAllEvts. Pretty much instant now.

Usage:
It assigns notes to staffs based on the Active Note Row in the editor. So the last note row that you click. You see the triangular indicator on the right hand side of the staff.

In the Notation view, click on a note row to set the split point you want. Then run the script. Run it as many times as you want.

It doesn't change the automatic split point, so if you subsequently want to move any notes between staffs you need to free them or assign to the other staff:
With a mouse, select a note or some notes and right click. Then use the Staff submenu to free them (default) or assign.

The actions, if you want to assign keycommands or put in a menu or a toolbar, are:

Notation: Set staff to first of pair
Notation: Set staff to second of pair
Notation: Set staff to default

Installation:
Put the file in your Reaper/Scripts folder. If anybody doesn't know where that is, there is an action in the Action List (press '?' to open Action List, making sure you are in the arrange view) called:
Show REAPER resource path in explorer/finder
... that you can run to open it up (type "resource path" in the Action List filter box to find it quickly). Drag the attached file into this folder.

Now open the MIDI editor and open the Action List there and click 'Load' next to ReaScript in the bottom right corner, navigate to our file and select. It should now be available in the Action List for the MIDI editor.

Now you can assign a keycommand to it in the bottom left corner.
Attached Files
File Type: lua splitpoint.lua (1.6 KB, 129 views)

Last edited by snooks; 12-16-2017 at 12:47 PM.
snooks is offline   Reply With Quote
Old 12-15-2017, 01:04 PM   #20
Jason Lyon
Human being with feelings
 
Join Date: May 2016
Posts: 720
Default Okay, here we go...

https://www.dropbox.com/s/9kfjdsgk77...itter.eel?dl=0

I've gone ahead with this anyway, because it's still sometimes useful to be able to split a track into RH and LH for easier editing.

It's called Pnosplitter and installation is as per snooks' instructions.
Jason Lyon is offline   Reply With Quote
Old 12-15-2017, 01:31 PM   #21
snooks
Banned
 
Join Date: Sep 2015
Posts: 1,650
Default

Cool - there are many ways to skin a cat, as they say!
snooks is offline   Reply With Quote
Old 12-16-2017, 02:32 AM   #22
JoPiano
Human being with feelings
 
Join Date: Apr 2016
Posts: 46
Default

Hi Jason, hi Snooks,

great work! Thanks a lot! These scripts will be very useful!
JoPiano is offline   Reply With Quote
Old 12-16-2017, 11:04 AM   #23
Jason Lyon
Human being with feelings
 
Join Date: May 2016
Posts: 720
Default Jo

Keep an eye on the other thread in Q&A.
Someone's already come up with a way to parse the MIDI at the string level in a fraction of the time.
I just have to reconstruct the full function in Lua now...
Jason Lyon is offline   Reply With Quote
Old 12-16-2017, 12:49 PM   #24
snooks
Banned
 
Join Date: Sep 2015
Posts: 1,650
Default

Good shout, I hadn't used that before - it's the way forward for manipulating MIDI. I've updated my script/post with a new version. Thanks for the heads up!
snooks 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 03:42 AM.


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