|
|
|
07-09-2014, 02:08 PM
|
#1
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Fix overlapping notes (restrict polyphony to one voice)
Hello!
Is there any script that would fix different overlapping notes? Let me explain:
imagine a scale : c,d,e,f,g,a,b,c. There could be three cases:
a) Some adjacent notes have a small gap between them
b) some end exactly when the next note starts and
c) some end a little bit later than the start of the next note (they overlap).
Is there any script that would turn notes of case c) into notes of case b)? So, it would trim the end of the notes so that they end when the next note begins?
There is a fix overlapping notes action in the MIDI Editor but it seems to do nothing! Is there any script that does it? And if not, would someone be kind enough to make it? I am sure it would be useful to all!
Thank you!
Last edited by amagalma; 07-09-2014 at 02:28 PM.
|
|
|
07-09-2014, 03:43 PM
|
#2
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
Hi,
in the MIDI editor, try: Edit -> Set note ends to start of next note.
(works on selected notes)
Is that what you're looking for ?
|
|
|
07-09-2014, 04:24 PM
|
#3
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Thanks nofish,but it is not exactly what I want. That would make all notes of the scale to be of case b) in my first post. I want to convert only notes of case c) and leave case a) notes alone!
|
|
|
07-09-2014, 04:28 PM
|
#4
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Look this FR, it explains it better.
|
|
|
07-10-2014, 03:11 AM
|
#5
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Try this EEL script:
Code:
// Restrict polyphony (EEL script by spk77 10.7.2014)
function restrict_polyphony() local(index, take, note_cnt, is_selected, is_muted, start_pos, end_pos, chan, pitch, vel, start_pos_next)
(
(take = MIDIEditor_GetTake(MIDIEditor_GetActive())) ? (
MIDIEditor_OnCommand(MIDIEditor_GetActive(), 40659); // run (MIDI editor) action "Correct overlapping notes"
Undo_BeginBlock();
index = -1;
MIDI_CountEvts(take, note_cnt, 0, 0);
while (((index = MIDI_EnumSelNotes(take, index)) != -1) && (index + 1 < note_cnt)) (
MIDI_GetNote(take, index, is_selected, is_muted, start_pos, end_pos, chan, pitch, vel);
MIDI_GetNote(take, index + 1, 0, 0, start_pos_next, 0, 0, 0, 0);
end_pos > start_pos_next ? MIDI_SetNote(take, index, is_selected, is_muted, start_pos, start_pos_next, chan, pitch, vel);
);
Undo_EndBlock("Restrict polyphony", -1);
);
);
restrict_polyphony()
Last edited by spk77; 07-10-2014 at 04:05 AM.
Reason: run action "Correct overlapping notes" before adjusting note ends
|
|
|
07-10-2014, 03:45 AM
|
#6
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Thank you spk77!!!
I am slowly trying to make Reaper my default MIDI editor and stop relying on Cubase when MIDI comes into play! This action was one of the important ones I were missing in Reaper!
I am in the process of making my custom MIDI toolbars with all the things I need.
Another more complicated script I need is one that toggles a chord from "closed" to "open" position. I am going to open a new thread about it.
|
|
|
07-10-2014, 04:03 AM
|
#7
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by amagalma
Thank you spk77!!!
I am slowly trying to make Reaper my default MIDI editor and stop relying on Cubase when MIDI comes into play! This action was one of the important ones I were missing in Reaper!
I am in the process of making my custom MIDI toolbars with all the things I need.
Another more complicated script I need is one that toggles a chord from "closed" to "open" position. I am going to open a new thread about it.
|
I had to modify the script - now it runs the action "Correct overlapping notes" before changing the note lengths (there was some weird updating/refreshing problem). I hope it works now .
|
|
|
07-10-2014, 04:41 AM
|
#8
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
I downloaded it again. Thank you very much!
|
|
|
07-10-2014, 08:11 AM
|
#9
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
Quote:
Originally Posted by amagalma
Thanks nofish,but it is not exactly what I want. That would make all notes of the scale to be of case b) in my first post. I want to convert only notes of case c) and leave case a) notes alone!
|
Ah yes, you're right, missed that.
Good that someone more clever than me now chimed in here.
|
|
|
04-20-2015, 08:09 AM
|
#10
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
A small question / request...
Can the script in post #5 maybe be made to work on all editable items instead of as currently only the active take ?
That would come in very handy here for applying this script to several items at once instead of doing it one by one.
Thank you.
|
|
|
04-20-2015, 08:57 AM
|
#11
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by nofish
A small question / request...
Can the script in post #5 maybe be made to work on all editable items instead of as currently only the active take ?
That would come in very handy here for applying this script to several items at once instead of doing it one by one.
Thank you.
|
No
We have:
Code:
EEL: MediaItem_Take MIDIEditor_GetTake(HWND midieditor)
get the take that is currently being edited in this MIDI editor
|
|
|
04-20-2015, 12:58 PM
|
#12
|
Human being with feelings
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
|
Dear people,
I maybe pretty stupid but why this script if we have a note legato function in Reaper's Midi Editor ??
|
|
|
04-20-2015, 01:07 PM
|
#13
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@Vanhaze
For midi export for exemple, or for clarity :P
There can be a lot of reasons ^^
|
|
|
04-20-2015, 01:40 PM
|
#14
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
@ vanhaze
check post #2 (me thinking the same - if you mean that function) and post #3 where amalgama explains the difference.
|
|
|
04-20-2015, 01:42 PM
|
#15
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
Quote:
Originally Posted by spk77
No
We have:
Code:
EEL: MediaItem_Take MIDIEditor_GetTake(HWND midieditor)
get the take that is currently being edited in this MIDI editor
|
Thanks spk77.
So - there's currently no way via scripting to get all editable takes (items) and process them ?
Wouldn't that be a good candidate for an API request, what do others think ?
|
|
|
04-23-2015, 05:59 PM
|
#16
|
Human being with feelings
Join Date: Jun 2012
Posts: 2,173
|
Quote:
Originally Posted by nofish
Wouldn't that be a good candidate for an API request, what do others think ?
|
Hi. I think if it was easy most people would include it. Pretty sure spk77 and others have mentioned it in API xmas list and some other places.
Quote:
Originally Posted by nofish
So - there's currently no way via scripting to get all editable takes (items) and process them ?
|
There's a line in the chunk string that has a number that corresponds to editable and a string that shows up when the item is visible.
It seems to me that there's a few problems with that. EEL currently has a maximum size limit for strings. The chunk for a big item with lots of events can exceed it and the line you want is after the events. Some people use thousands of small items. You would have to look at each one. Another thing is it doesn't always seem to get updated in the project when you might expect it to: As soon as you click the tracklist. So something similar to "Get Selected Item" type functions would probably be better.
You may already be aware that most of these kind of scripts don't work through the MIDI editor. It's just common to use them together. Selecting notes and so on. So you could call this script* on other items takes. You just need to use some alternate identification system, a selection scheme perhaps. Of course, the script has to be written to take that into account.
*edit. Not THIS one, I guess, because it includes-
MIDIEditor_OnCommand(MIDIEditor_GetActive(), 40659); // run (MIDI editor) action "Correct overlapping notes"
So, do we need functions to activate an item too? Maybe that action works on all editable items.
Nope. Also it seems like the overlapping allowed in the ME is somewhat distinct from what is allowed in the item. When you close it a correction occurs, etc.
Last edited by FnA; 04-26-2015 at 01:13 PM.
|
|
|
04-24-2015, 09:40 AM
|
#17
|
Human being with feelings
Join Date: Nov 2008
Location: London, UK
Posts: 2,581
|
Quote:
Originally Posted by spk77
// Restrict polyphony (EEL script by spk77 10.7.2014)
|
Awesome! Thanks spk77!
|
|
|
03-31-2017, 02:57 AM
|
#18
|
Human being with feelings
Join Date: May 2010
Location: Norway
Posts: 7,318
|
Thank you spk77
(had a little time finding it with keywords though )
__________________
Reaper x64, win 11
Composer, text-writer, producer
Bandcamp
|
|
|
03-31-2017, 10:24 AM
|
#19
|
Human being with feelings
Join Date: Oct 2008
Location: Right Hear
Posts: 15,618
|
Quote:
Originally Posted by spk77
Try this EEL script:
|
spk77.... is the posted one the edited version? also is there not a lua version?
|
|
|
10-22-2018, 10:43 AM
|
#20
|
Human being with feelings
Join Date: Dec 2012
Location: Germany
Posts: 3,012
|
spk77's great script removes ovelapping by shortening the end of preceding notes. Is there an action or script that is capable of removing polyphony/overlapping by shortening the beginning of following notes instead of the end of the preceding ones?
.
|
|
|
03-18-2019, 06:40 PM
|
#21
|
Human being with feelings
Join Date: Dec 2012
Location: Germany
Posts: 3,012
|
hope spk77 is doing fine! Hasn't been around for a while ...
Could anybody modify his script to achieve what I'm asking for in my previous post?
.
|
|
|
03-19-2019, 04:57 PM
|
#22
|
Human being with feelings
Join Date: Jun 2012
Posts: 2,173
|
What if you reverse selected events before and after the spk77 script?
|
|
|
03-19-2019, 05:15 PM
|
#23
|
Human being with feelings
Join Date: Dec 2012
Location: Germany
Posts: 3,012
|
Quote:
Originally Posted by FnA
What if you reverse selected events before and after the spk77 script?
|
so simple but genious! Cool hack, man, thanks!
I made a custom action for it
.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 06:16 AM.
|