MST5K v1.2.73 - Advanced MIDI Note Selection by Lemerchand
Update to v1.2.73
+ MST will now refocus the active midi editor after making a selection!
Update to v1.2.67
+ MST can now export presets with the option to select only within the time selection. (Alt+Shift+Right-click a loaded preset)
Update to v1.2.3b
+ MST can now handle pitches in both sharp or flat! Alt-Left-Click the pitch buttons to toggle!
UPDATE to v1.2b
+ Presets exported to actions are prefixed with "MST_" in the actions list.
- TODO: Prompt user to save a changed preset before export
UPDATE to v1.2b
+ Save Preset' input box now defaults to the current preset's name to make overwriting a it easier
+ You can now export presets to the action list to run your favorite filters without loading MST5K!!
- Alt-Right-Click the currently loaded preset. Exported presets automatically appear in your actions list.
Enjoy!
About
Hello, hello, hello everyone!
I got into reascripting a few months ago and a practice project I was working on--thanks to the encouragement from some very cool people*--quickly became a full script. The very same people suggested I post it here, and while it may still need some polish and bug-squashing, I think you may find it quite useful in myriad scenarios.
It is a MIDI Note Selection tool that has been likened to the Cubase Logical Editor. I always felt the native filter was cumbersome. My script can do nearly anything the native filter can, but far more quickly. It is not, however, just a reskinned native filter--I assure you!
I have even baked in an info panel that describes all the various controls' functions!
I often use it to quickly accent kick/snare hits, humanize midi, or quickly select notes without capturing key switches, but I'm sure you can find other creative ways to use it.
Some nifty features under:
Quickly select notes in the active midi editor (even restricted to the time selection if you so please) using filters for...
High/Low Note range
Pitches you choose (including built-in scales!)
Min/Max velocity
Note Length from 1-1/64th (triplet support is in a new feature--bear with me)
Note position on the grid in 16th notes
Built-in documentation so you don't have to remember advanced features
Unlimited Global Presets and 16 beat pattern presets
Quickly set filters by "capturing" the properties of selected notes
Probably some other things I'm forgetting right now
Bonus: MST5K utilizes a custom UI library I built which you can also use if you're so inclined. Caveat: it is not as fleshed out as existing UI libs, but it is very easy to use for quick ideas!
You can also use Git or download the .zip. If you opt for the .zip, place it int your resource path's 'Scripts' folder, extract it, and rename the folder to "lemerchand" (as opposed to "lemerchand-master")
Please be sure to maintain the file structure in my github or the script will not work. If you have any questions I'm friendly and only bite upon request.
For reference, it should look like this: C:\Users\YourName\AppData\Roaming\REAPER\Scripts\l emerchand\MIDI Selector Tool
*A shout-out to Daniel Lumertz, Stevie, and Birdbird for the advice, suggestions, bug testing, and constantly helping me find API calls I couldn't find. Without your encouragement/help I wouldn't have gotten this far!
On a final note, I am looking for new ideas. Right now I am working on a console tool that works in ways I wish reaconsole did (don't get me wrong, reaconsole is fantastic). If you want to give me feature ideas for that, test it out, or suggest something else I'm open to ideas!
Last edited by lemerchand; 02-04-2021 at 05:01 AM.
Reason: Version Update
It's been tested by a few people using mac. Can you tell me how long ago you downloaded it and with which method you used?
The number one installation error I'm seeing so far is that if you download the .zip from github then the unzipped file must be renamed from "lemerchand-master" to "lemerchand"
Also, some people aren't not putting it into their scripts folder within their resource path!
I'm working to make installation more simple. As of right now the file structure is very important.
This is one of my fav new scripts! Have been testing for one month or more! really neat! I used to use MIDI filter but this get the job done quicker to me hahahah, and have other things, and with a nice UI.
Also about the UI, really good GUI lib to start learning about GUI in reaper and oop. helped me a lot!
cf.lua:126: attempt to index a nil value (local 'file')
in Reaper 6.18 Win though. Bug or my error?
__________________ Windows 10x64 | AMD Ryzen 3700X | ATI FirePro 2100 | Marian Seraph AD2, 4.3.8 | Yamaha Steinberg MR816x "If I can hear well, then everything I do is right" (Allen Sides)
You use:
local lastWindow = reaper.JS_Window_GetFocus()
and later:
reaper.atexit(reaper.JS_Window_SetFocus(lastWindow ))
I altered the script to put:
reaper.JS_Window_SetFocus(lastWindow)
inside every if/then of the SELECT BUTTON section (around line 339). This allows me to keep the selector script open and select some notes, move or alter with keyboard shortcuts, select other notes, move them, etc. without needing to click in the editor or close the tool first to set focus back to the MIDI editor manually.
Jon of The REAPER Blog mentioned in his video that it would speed up the work flow, and I think it does.
I have another suggestion, however this one requires the SWS/S&M EXTENSION:
The issue is that the Note name on the midi editor (eg. C4) does not always match the Pitch Max/Min in the tool when captured. This is because of the MIDI Octave Name Display Offset preference. When I click C4 in the editor, the tool captures it as Min/Max C5.
function midi_to_note(n)
return tostring(note_names[(n%12)+1]) .. tostring(math.floor(n/12)- OCTAVE_OFFSET)
end
And:
function note_to_midi(str)
.
.don't change anything here
.
local o = tonumber(str.match(str, '%d%d')) or tonumber(str.match(str, '%d'))
o = o + OCTAVE_OFFSET
.
.Don't change anything else
.
end
I didn't look at all the code, so there may be other places where you set note name to note number or vis-versa.
You use:
local lastWindow = reaper.JS_Window_GetFocus()
and later:
reaper.atexit(reaper.JS_Window_SetFocus(lastWindow ))
I altered the script to put:
reaper.JS_Window_SetFocus(lastWindow)
inside every if/then of the SELECT BUTTON section (around line 339). This allows me to keep the selector script open and select some notes, move or alter with keyboard shortcuts, select other notes, move them, etc. without needing to click in the editor or close the tool first to set focus back to the MIDI editor manually.
Jon of The REAPER Blog mentioned in his video that it would speed up the work flow, and I think it does.
You might consider it in your next code update.
I like it very much and the above would be a much appreciated update; so we can use our midi editor shortcut while using the script.
For those having trouble with the install through ReaPack.
You have to either manually mark it for install, or enable bleeding edge/pre-release.
I removed the beta flag from the version in Reapack so it should now show up and update automatically!
Quote:
Originally Posted by Sid
Hi,
Lovely script.
You use:
local lastWindow = reaper.JS_Window_GetFocus()
and later:
reaper.atexit(reaper.JS_Window_SetFocus(lastWindow ))
I altered the script to put:
reaper.JS_Window_SetFocus(lastWindow)
inside every if/then of the SELECT BUTTON section (around line 339). This allows me to keep the selector script open and select some notes, move or alter with keyboard shortcuts, select other notes, move them, etc. without needing to click in the editor or close the tool first to set focus back to the MIDI editor manually.
Jon of The REAPER Blog mentioned in his video that it would speed up the work flow, and I think it does.
You might consider it in your next code update.
I just updated it with this feature. Thanks for the suggestion.
Quote:
Originally Posted by Sid
I have another suggestion, however this one requires the SWS/S&M EXTENSION:
The issue is that the Note name on the midi editor (eg. C4) does not always match the Pitch Max/Min in the tool when captured. This is because of the MIDI Octave Name Display Offset preference. When I click C4 in the editor, the tool captures it as Min/Max C5.
I have been planning on tweaking this for some time. Thanks for the advice on how to implement it. It will be pushed out when I can get around to it!
Quote:
Originally Posted by Knob Twiddler
I like it very much and the above would be a much appreciated update; so we can use our midi editor shortcut while using the script.
Thanks for the awesome script! Curious has anyone found a way to get MIDI Editor scripts like this one to run docked on startup? I'd normally use the SWS startup actions feature, but it seems limited only to Main actions.
hm I think you can add MST5K to your main action list and run from there with no problem and use SWS to load on startup
Also MST5K have a option to open docked in settings
Just following up on this, since I too am running into the problem of not being able to create custom actions that include actions from the main section and from the midi editor:
I want this to dock when I run the script as well, and the option 'dock on start up' isn't working. So how I can send this script over to the main actions window instead?
Thanks for the awesome script! Curious has anyone found a way to get MIDI Editor scripts like this one to run docked on startup? I'd normally use the SWS startup actions feature, but it seems limited only to Main actions.
Glad you like MST! In it's current state, running docked may require some finesse on your part, that is, I think it will throw an error if you try to use ti when there is no active midi editor. Other than that, try what Daniel mentioned. I've ran it a few times docked in between editors just fine, although I never loaded it on startup.
It took me ages to find and install this script, but now that I have it – and it's working! – I am just so happy and I know that I will save loads of time in the future! :-) (Except if I have triplets :P)
Hi. I've been playing with this and it doesn't seem to work when you have multiple items selected (items are set to editable). It doesn't seem to obey the selection criteria over more than one item. Can someone confirm please?
If this is the case, would you please consider adding this functionality, as I use FeedTheCat's Midi Editor Magic scripts to display more than one midi item for string arranging etc. Cheers.
It took me ages to find and install this script, but now that I have it – and it's working! – I am just so happy and I know that I will save loads of time in the future! :-) (Except if I have triplets :P)
Is it possible to just filter the currently selected notes? so its not running on the complete midi item?
edit: the timeselection is actually all I need now used in tandem with "time selection to notes" kinda action... but might be cool to be able to persistently edit the selections straight on existing selection.
Wondering whats up with the inconsistent selection of the first note in a bar/first beat? adjusting the ppq threshold doesnt seem to do much to help this one. Things are åperfrectly quantized but the selection of the downbeat doesnt seem to work right regardless.