Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 12-21-2020, 09:29 AM   #1
lemerchand
Human being with feelings
 
lemerchand's Avatar
 
Join Date: May 2018
Location: Sacramento, CA
Posts: 43
Default 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:
  1. Quickly select notes in the active midi editor (even restricted to the time selection if you so please) using filters for...
    1. High/Low Note range
    2. Pitches you choose (including built-in scales!)
    3. Min/Max velocity
    4. Note Length from 1-1/64th (triplet support is in a new feature--bear with me)
    5. Note position on the grid in 16th notes
  2. Built-in documentation so you don't have to remember advanced features
  3. Unlimited Global Presets and 16 beat pattern presets
  4. Quickly set filters by "capturing" the properties of selected notes
  5. 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!

Notes on installation:

This script requires JS Reascript API

Import via Reapack:
Code:
https://raw.githubusercontent.com/lemerchand/lemerchand/master/index.xml
The script will be called "MIDI Selector Tool."


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


You can find the github here: https://github.com/lemerchand/lemerc...elector%20Tool

-------------------------------------------------------------------------------

*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
lemerchand is offline   Reply With Quote
Old 12-21-2020, 02:07 PM   #2
HoJo
Human being with feelings
 
Join Date: Dec 2007
Location: Germany
Posts: 253
Default

Edit: I can not get it to work on OSX 10.13.6
WIll end up in an cf.lua:34 NIL value error
Looks like as if its meant for Win only?

WoW.
That looks fantatstic.
Will try it out and let you know.

Thanks again.
BR,
HoJo

Last edited by HoJo; 12-21-2020 at 02:42 PM. Reason: Update
HoJo is offline   Reply With Quote
Old 12-21-2020, 03:03 PM   #3
lemerchand
Human being with feelings
 
lemerchand's Avatar
 
Join Date: May 2018
Location: Sacramento, CA
Posts: 43
Default

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.
lemerchand is offline   Reply With Quote
Old 12-21-2020, 05:42 PM   #4
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,947
Default

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!

Thanks for this work!
daniellumertz is offline   Reply With Quote
Old 12-22-2020, 03:54 AM   #5
beingmf
Human being with feelings
 
beingmf's Avatar
 
Join Date: Jul 2007
Location: Jazz City
Posts: 5,041
Default

JS Reascript API is installed, I get
Code:
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)
beingmf is offline   Reply With Quote
Old 12-22-2020, 04:38 AM   #6
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,244
Default

Looking great, thank you so much !

Imported your repository in ReaPack.

I also get en error when opening your script:
cf.lua:126: attempt to index a nil value (local 'file')


OSX 10.15.7
Latest Reaper (pre) release
__________________
Macbook Air M1 2020 | Reaper ARM version | OSX Ventura | Presonus Studio 24c
My Reaper Tips&Tricks YouTube Channel: https://www.youtube.com/user/vanhaze2000/playlists
vanhaze is offline   Reply With Quote
Old 01-27-2021, 09:13 AM   #7
EpicSounds
Human being with feelings
 
EpicSounds's Avatar
 
Join Date: Jul 2009
Posts: 7,222
Default

I just published a video about this script

https://youtu.be/pWtlaVO4ABw

__________________
REAPER Video Tutorials, Tips & Tricks and more at The REAPER Blog
EpicSounds is offline   Reply With Quote
Old 01-27-2021, 07:58 PM   #8
Sid
Human being with feelings
 
Join Date: Apr 2018
Posts: 477
Default Setting the Focus back to the midi editor

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.

Last edited by Sid; 01-27-2021 at 08:11 PM.
Sid is offline   Reply With Quote
Old 01-28-2021, 01:01 AM   #9
Sid
Human being with feelings
 
Join Date: Apr 2018
Posts: 477
Default Match the Note Octave

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.

The fix is:
in your cf.lua script, set a variable

OCTAVE_OFFSET = 2 - reaper.SNM_GetIntConfigVar("midioctoffs", 0)

then below alter your two functions as:

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.
Sid is offline   Reply With Quote
Old 01-28-2021, 05:55 AM   #10
Knob Twiddler
Human being with feelings
 
Knob Twiddler's Avatar
 
Join Date: May 2016
Location: Leuven
Posts: 93
Default

Quote:
Originally Posted by Sid View Post
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 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.
Knob Twiddler is offline   Reply With Quote
Old 01-30-2021, 06:03 AM   #11
Sicknote
Human being with feelings
 
Join Date: Jun 2017
Posts: 13
Default

i find it in the actions list, but i cannot run it. run is marked out? Any suggestions?
Sicknote is offline   Reply With Quote
Old 01-30-2021, 06:13 AM   #12
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,321
Default

Quote:
Originally Posted by Sicknote View Post
i find it in the actions list, but i cannot run it. run is marked out? Any suggestions?
I am not sure, but probably you should open MIDI editor first. Then open actions and try to run it.
vitalker is offline   Reply With Quote
Old 01-31-2021, 05:18 AM   #13
lemerchand
Human being with feelings
 
lemerchand's Avatar
 
Join Date: May 2018
Location: Sacramento, CA
Posts: 43
Default

Quote:
Originally Posted by EpicSounds View Post
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 View Post
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 View Post
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 View Post
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.
Done, and thank you
__________________
MIDI Selector Tool
lemerchand is offline   Reply With Quote
Old 01-31-2021, 05:51 AM   #14
Knob Twiddler
Human being with feelings
 
Knob Twiddler's Avatar
 
Join Date: May 2016
Location: Leuven
Posts: 93
Default

Thank you !

Knob Twiddler is offline   Reply With Quote
Old 08-26-2021, 01:44 PM   #15
samdixonmusic
Human being with feelings
 
Join Date: Jun 2019
Posts: 5
Default

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.
samdixonmusic is offline   Reply With Quote
Old 08-26-2021, 04:51 PM   #16
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,947
Default

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
daniellumertz is offline   Reply With Quote
Old 03-11-2022, 09:13 AM   #17
Miscreant
Human being with feelings
 
Miscreant's Avatar
 
Join Date: Mar 2012
Posts: 338
Default

Quote:
Originally Posted by daniellumertz View Post
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?
Miscreant is offline   Reply With Quote
Old 04-03-2022, 03:07 AM   #18
JimDiGritz
Human being with feelings
 
Join Date: Jan 2022
Posts: 36
Default This is an awesome script - however how does non 4/4 time work?

My project is in 3/4, when I select Beat 1, it defaults to the 1st of a 4/4 time signature.

Eg As per the screenshot in a 4 measure selection it selects notes 1, 5 & 9 (which would be the first notes of a 4/4 measure.

I could be missing something!!!
Attached Images
File Type: png Screenshot 2022-04-03 110349.png (16.4 KB, 80 views)
JimDiGritz is offline   Reply With Quote
Old 08-26-2021, 09:17 PM   #19
lemerchand
Human being with feelings
 
lemerchand's Avatar
 
Join Date: May 2018
Location: Sacramento, CA
Posts: 43
Default

Quote:
Originally Posted by samdixonmusic View Post
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.
__________________
MIDI Selector Tool
lemerchand is offline   Reply With Quote
Old 12-12-2021, 08:32 AM   #20
Redapple2237
Human being with feelings
 
Join Date: Mar 2019
Posts: 5
Default

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)
Redapple2237 is offline   Reply With Quote
Old 12-13-2021, 09:40 AM   #21
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,947
Default

For more complex divisions you can try Note Selector from JS
daniellumertz is offline   Reply With Quote
Old 12-14-2021, 03:54 AM   #22
IXix
Human being with feelings
 
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,844
Default

Nice work! Somewhat late to the party, might I request a font size setting? It's a bit squinty here.
IXix is offline   Reply With Quote
Old 12-16-2021, 05:41 AM   #23
GeneralMidi
Human being with feelings
 
Join Date: Dec 2020
Posts: 199
Default

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.
GeneralMidi is offline   Reply With Quote
Old 12-20-2021, 09:26 AM   #24
mozart999uk
Human being with feelings
 
Join Date: Nov 2010
Posts: 1,548
Default

Quote:
Originally Posted by IXix View Post
Nice work! Somewhat late to the party, might I request a font size setting? It's a bit squinty here.
Yep. +1 from me too :-)
mozart999uk is offline   Reply With Quote
Old 12-20-2021, 09:26 AM   #25
mozart999uk
Human being with feelings
 
Join Date: Nov 2010
Posts: 1,548
Default

Quote:
Originally Posted by Redapple2237 View Post
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)
A way to work with triplets would be great :-)
mozart999uk is offline   Reply With Quote
Old 12-24-2021, 05:54 PM   #26
henu
Human being with feelings
 
Join Date: Dec 2020
Posts: 47
Default Filter just the selection?

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.

Last edited by henu; 12-24-2021 at 06:11 PM.
henu is offline   Reply With Quote
Old 01-13-2022, 06:23 AM   #27
henu
Human being with feelings
 
Join Date: Dec 2020
Posts: 47
Default

can we get a midi channel filter in this thing as well?

Thanks!
henu is offline   Reply With Quote
Old 02-24-2022, 02:54 PM   #28
henu
Human being with feelings
 
Join Date: Dec 2020
Posts: 47
Default

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.
henu 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:44 PM.


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