Old 05-22-2019, 11:36 AM   #1
halfshavedyaks
Human being with feelings
 
Join Date: May 2018
Posts: 71
Default rule based MIDI editing / selection

Are there general tools for MIDI editing that allow arbitrary editing, or at least selection based on note characteristics?


For example things like:

* Select all notes less than 1/32 in length

* Set all velocities below 22 to 35 (for selected notes)

* select all notes below C3 with velocities larger than 70

* quantise all notes above A4 with durations less than 1/16

you get the idea.

I'm not looking for custom actions to do these things but rather some sort of control panel that allows such rules to be set on the fly and applied.

I'm open minded about the best way to achieve this, but at the moment I can't see any way to achieve these sorts of edits short of scripted custom actions for each one, which only makes sense for stuff that you do repeatedly.
halfshavedyaks is offline   Reply With Quote
Old 05-22-2019, 12:55 PM   #2
lunker
Human being with feelings
 
lunker's Avatar
 
Join Date: Nov 2007
Location: Lucas, TX, USA (via Luleå, Sweden)
Posts: 2,009
Default

Much of what you're asking for can be achieved with the MIDI filter.

See page 231 of the current User Guide : https://www.reaper.fm/userguide/Reap...Guide5977g.pdf
__________________
Best Regards, Ernie "lunker" Lundqvist
BDSM (Bad Dog Studio Musicians)
Windows 10 running on Z390 + i7-8700
lunker is offline   Reply With Quote
Old 05-22-2019, 01:46 PM   #3
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by halfshavedyaks View Post
I'm not looking for custom actions to do these things but rather some sort of control panel that allows such rules to be set on the fly and applied.

I'm open minded about the best way to achieve this, but at the moment I can't see any way to achieve these sorts of edits short of scripted custom actions for each one, which only makes sense for stuff that you do repeatedly.
Basic scripting is a bit more complex than Cubase's Logical Editor, for example, but once you have a little 10-line template script, is is just as fast to use as a control panel (and more powerful) -- and you don't need a new script for each action. The template script simply iterates through all notes and changes them, depending on some criteria.

* Instead of opening the control panel, open REAPER's script IDE (and you can keep it open in one corner of the screen).

* Instead of entering values in the panel, simply enter/replace the same values in the template script.

* Instead of clicking "OK" on the panel, click "Run" on the script IDE.

Want to select all notes with velocity below 22? Simply type "vel<22" and run. Want to select notes below C3 with velocities larger than 70? Type "pitch>60 and vel>70" and run.
juliansader is offline   Reply With Quote
Old 05-22-2019, 04:23 PM   #4
halfshavedyaks
Human being with feelings
 
Join Date: May 2018
Posts: 71
Default

Quote:
Originally Posted by lunker View Post
Much of what you're asking for can be achieved with the MIDI filter.

See page 231 of the current User Guide : https://www.reaper.fm/userguide/Reap...Guide5977g.pdf
you are quite right - most of it can - I haven't done any serious midi in reaper for a long time and I'd forgotten it.
halfshavedyaks is offline   Reply With Quote
Old 05-22-2019, 04:37 PM   #5
halfshavedyaks
Human being with feelings
 
Join Date: May 2018
Posts: 71
Default

Quote:
Originally Posted by juliansader View Post
Basic scripting is a bit more complex than Cubase's Logical Editor, for example, but once you have a little 10-line template script, is is just as fast to use as a control panel (and more powerful) -- and you don't need a new script for each action. The template script simply iterates through all notes and changes them, depending on some criteria.
do you have such a template script? sounds like it would be a good start on scripting as well as useful in itself.
halfshavedyaks is offline   Reply With Quote
Old 06-16-2019, 03:45 AM   #6
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Sorry, I forgot a bit about this thread. Here is an example of a script:
Code:
take = reaper.MIDIEditor_GetTake(reaper.MIDIEditor_GetActive())
item = reaper.GetMediaItemTake_Item(take)
reaper.MIDI_DisableSort(take)
countTotal, countNotes, countCCs, countSysex = reaper.MIDI_CountEvts(take)
for i = 0, countNotes-1 do
    noteOK, selected, muted, startTick, endTick, channel, pitch, velocity = reaper.MIDI_GetNote(take, i)
    -- CHANGE THESE LINES
    if pitch > 60 then 
        selected = true
    else
        selected = false
    end
    -- UP TO HERE
    reaper.MIDI_SetNote(take, i, selected, muted, startTick, endTick, channel, pitch, velocity, true)
end
reaper.MIDI_Sort(take)
reaper.Undo_OnStateChange_Item(0, "Logical editor: notes", item)
juliansader is offline   Reply With Quote
Old 06-17-2019, 11:20 AM   #7
halfshavedyaks
Human being with feelings
 
Join Date: May 2018
Posts: 71
Default

thanks! that looks pretty useful. I will try it when i get some time.

examples of how to change events rather than just select them would also be useful, though doubtless that's in the scripting documentation somewhere.
halfshavedyaks 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 07:25 AM.


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