Old 06-21-2016, 12:48 PM   #1
Smaasten
Human being with feelings
 
Join Date: Dec 2015
Posts: 35
Default diagonal line split - midi notes

would be amazing!!


because of this
https://www.youtube.com/watch?v=tvV1...xjdEd8REraMhTA

Attached Images
File Type: gif byu.gif (56.7 KB, 360 views)

Last edited by Smaasten; 06-21-2016 at 12:59 PM.
Smaasten is offline   Reply With Quote
Old 06-21-2016, 02:35 PM   #2
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,840
Default

Would indeed be very useful!
juliansader is offline   Reply With Quote
Old 06-24-2016, 06:58 PM   #3
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,840
Default

I wrote a script to mimic the functionality of FL Studio's Slice Tool:



It doesn't look quite as fancy as FL Studio's version, since ReaScripts cannot draw graphics that overlay the MIDI editor, but the functionality should be the same.

It is available via ReaPack, or at the main thread: Simple but useful MIDI editor tools: warp, stretch, deselect etc.

(Note: REAPER is very finicky when scripts try to manipulate MIDI notes, so the script is currently still in beta version, and bugs may be encountered.)
juliansader is offline   Reply With Quote
Old 06-24-2016, 11:33 PM   #4
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 4,806
Default

Ooh My, this is fantastic !
vanhaze is offline   Reply With Quote
Old 06-25-2016, 12:59 PM   #5
Smaasten
Human being with feelings
 
Join Date: Dec 2015
Posts: 35
Default

Quote:
Originally Posted by juliansader View Post
I wrote a script to mimic the functionality of FL Studio's Slice Tool:



It doesn't look quite as fancy as FL Studio's version, since ReaScripts cannot draw graphics that overlay the MIDI editor, but the functionality should be the same.

It is available via ReaPack, or at the main thread: Simple but useful MIDI editor tools: warp, stretch, deselect etc.

(Note: REAPER is very finicky when scripts try to manipulate MIDI notes, so the script is currently still in beta version, and bugs may be encountered.)

WOOOOOP !!! WOW fantastic !! But... As i am pretty new to Reaper, how do i set this up. I have just updated Reapack, and i can see
js_Split selected notes by drawing a line with the mouse
js_Split notes by drawing a line with the mouse

- and i do have the SWS aswell. But where do i go from here? Nothing happens when i draw a line, but making a new midi not, so how do i set it up?
Smaasten is offline   Reply With Quote
Old 06-25-2016, 02:30 PM   #6
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 4,806
Default

Would like to know this too..
vanhaze is offline   Reply With Quote
Old 06-25-2016, 02:57 PM   #7
Smaasten
Human being with feelings
 
Join Date: Dec 2015
Posts: 35
Default

--[[
* ReaScript Name: js_Split selected notes by drawing a line with the mouse.lua
* Description: Split (slice) multiple selected notes by drawing a "cutting line" with the mouse in the MIDI editor piano roll.
* Notes that intersect the cutting line will be split at the position of intersection.
* If snap-to-grid is enabled in the MIDI editor, the notes will be split at the grid.
*
* Instructions: The script must be linked to a shortcut key.
* To use, position mouse in the 'notes' area of the piano roll, press the shortcut key once,
* and then move the mouse to draw the cutting line.
*
* In the script's USER AREA (near the beginning of the script), the user can customize:
* - The thickness of the cutting line
* - Whether all notes or only selected notes should be split.
*
* Note: Since this function is a user script, the way it responds to shortcut keys and
* mouse buttons is opposite to that of REAPER's built-in mouse actions
* with mouse modifiers: To run the script, press the shortcut key *once*
* to start the script and then move the mouse *without* pressing any
* mouse buttons. Press the shortcut key again once to stop the script.
* (The first time that the script is stopped, REAPER will pop up a dialog box
* asking whether to terminate or restart the script. Select "Terminate"
* and "Remember my answer for this script".)
*
* WARNING: - As with any ReaScript that involves moving or stretching notes, the user should
* take care that there are no overlapping notes, both when starting and when
* terminating the script, since such notes may lead to various artefacts.
* - Even if there are no obviously overlapping notes, artefacts may still be encountered
* during the drawing of the cutting line. This will not affect the eventual slicing of the notes.
* - Glueing the MIDI item often helps to sort out the notes that cause artefacts.
Smaasten is offline   Reply With Quote
Old 06-25-2016, 03:28 PM   #8
Smaasten
Human being with feelings
 
Join Date: Dec 2015
Posts: 35
Default

Now i know how to load a script ! yeeeeees ! my shortcut key is " ½ " and when i press it, i get the line. But then when i mouse-click, nothing happens or- i get this:


ERROR:
Could not delete all the notes that were used to draw the line.

or this:
...itor\js_Split notes by drawing a line with the mouse.lua:137: attempt to index a nil value (global 'tableLine')
Attached Images
File Type: jpg Clipboard02.jpg (20.4 KB, 185 views)
Smaasten is offline   Reply With Quote
Old 06-25-2016, 03:54 PM   #9
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,840
Default

Thanks for the enthusiasm!

Beta version 0.92 has been uploaded to ReaPack with a few improvements.

Unfortunately, I have run into the following problem, which appears to be a bug in ReaScript: Using MIDI_SetNote with noSort=true to move notes onto same pitch, so I am not sure that I would be able to find a way to circumvent it. It messes up the appearance of the notes while the script is running, but does not change the eventual split points of the notes.




Quote:
Originally Posted by Smaasten View Post
Now i know how to load a script ! yeeeeees ! my shortcut key is " ½ " and when i press it, i get the line. But then when i mouse-click, nothing happens or- i get this:
I am not sure why nothing is happening, but perhaps you can check the following:
- The script will only run if there is an active MIDI item with one or more notes in it. (If there are no notes, there is nothing to do - perhaps I should change this 'feature' since it may confuse users.)
- The mouse must be positioned in the piano roll's notes area when the script starts, otherwise it will not run.
- Remember that the mouse should *not* be clicked.

Quote:
Originally Posted by Smaasten View Post
ERROR:
Could not delete all the notes that were used to draw the line.
Please let me know if the new v0.92 still gives this error.
juliansader is offline   Reply With Quote
Old 06-25-2016, 04:49 PM   #10
Smaasten
Human being with feelings
 
Join Date: Dec 2015
Posts: 35
Default

Quote:
Originally Posted by juliansader View Post
Thanks for the enthusiasm!

Beta version 0.92 has been uploaded to ReaPack with a few improvements.

Unfortunately, I have run into the following problem, which appears to be a bug in ReaScript: Using MIDI_SetNote with noSort=true to move notes onto same pitch, so I am not sure that I would be able to find a way to circumvent it. It messes up the appearance of the notes while the script is running, but does not change the eventual split points of the notes.






I am not sure why nothing is happening, but perhaps you can check the following:
- The script will only run if there is an active MIDI item with one or more notes in it. (If there are no notes, there is nothing to do - perhaps I should change this 'feature' since it may confuse users.)
- The mouse must be positioned in the piano roll's notes area when the script starts, otherwise it will not run.
- Remember that the mouse should *not* be clicked.


Please let me know if the new v0.92 still gives this error.
I still get the error. And for some reason, when i draw a new note, after using the tool, the Velocity is 0 for all new notes.

Btw- thank you for your hard work!! This is the only thing i miss in Reaper

And.. How is the notes to split, if i should not click the mouse?
Sorry for this- i hate being such a noob
Attached Images
File Type: gif byu.gif (63.8 KB, 187 views)
Smaasten is offline   Reply With Quote
Old 06-25-2016, 05:51 PM   #11
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,840
Default

Quote:
Originally Posted by Smaasten View Post
Btw- thank you for your hard work!! This is the only thing i miss in Reaper

And.. How is the notes to split, if i should not click the mouse?
Sorry for this- i hate being such a noob
In the current versions of REAPER, ReaScripts cannot yet (directly) detect or react to mouse clicks. It is therefore not necessary to click the mouse while a script is running. In fact, if the mouse click changes anything (such as note selection), it may confuse the script that is running, so it is usually safer to avoid clicking altogether.

To stop the script normally, simply press the shortcut key again. (Press it once to start the script, and once again to stop the script.) When the script stops normally, it will automatically do the splitting of whatever notes intersect the line.
* (The first time that the script is stopped, REAPER will pop up a dialog box
* asking whether to terminate or restart the script. Select "Terminate"
* and "Remember my answer for this script".)

The script will also quit (but without splitting anything) if the mouse moves out of the piano roll's notes area. In your GIF, it seems that you clicked the right mouse button, and then moved the mouse into the popup menu, which REAPER also interprets as moving the mouse out of the notes area. The script therefore quit without splitting.

Quote:
Originally Posted by Smaasten View Post
I still get the error. And for some reason, when i draw a new note, after using the tool, the Velocity is 0 for all new notes.
In REAPER's MIDI editor, clicking on a note sets the velocity for new notes. If you clicked on one of the tiny notes that are used to draw the script's "cutting line", it would have set the velocity for new notes to 1.
juliansader is offline   Reply With Quote
Old 06-26-2016, 03:45 AM   #12
Smaasten
Human being with feelings
 
Join Date: Dec 2015
Posts: 35
Default

Quote:
Originally Posted by juliansader View Post
In the current versions of REAPER, ReaScripts cannot yet (directly) detect or react to mouse clicks. It is therefore not necessary to click the mouse while a script is running. In fact, if the mouse click changes anything (such as note selection), it may confuse the script that is running, so it is usually safer to avoid clicking altogether.

To stop the script normally, simply press the shortcut key again. (Press it once to start the script, and once again to stop the script.) When the script stops normally, it will automatically do the splitting of whatever notes intersect the line.
* (The first time that the script is stopped, REAPER will pop up a dialog box
* asking whether to terminate or restart the script. Select "Terminate"
* and "Remember my answer for this script".)

The script will also quit (but without splitting anything) if the mouse moves out of the piano roll's notes area. In your GIF, it seems that you clicked the right mouse button, and then moved the mouse into the popup menu, which REAPER also interprets as moving the mouse out of the notes area. The script therefore quit without splitting.


In REAPER's MIDI editor, clicking on a note sets the velocity for new notes. If you clicked on one of the tiny notes that are used to draw the script's "cutting line", it would have set the velocity for new notes to 1.
I GOT IT TO WORK !! YIIIIIR !! Thank you so much - you saved my day !!
If i experience anything odd or an error, i will ofc write to you.
Thank you!!!! for all your work and your guides !

Attached Images
File Type: gif yes !!.gif (19.9 KB, 550 views)
Smaasten is offline   Reply With Quote
Old 06-26-2016, 06:11 AM   #13
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,840
Default

Quote:
Originally Posted by Smaasten View Post
I GOT IT TO WORK !! YIIIIIR !! Thank you so much - you saved my day !!
If i experience anything odd or an error, i will ofc write to you.
Thank you!!!! for all your work and your guides !
Great!

I have uploaded yet another version, now v0.93, which attempts to implement a workaround for the bug in MIDI_SetNote(). The script seems to be completely stable and usable on my system, but since the bug may be idiosyncratic on other systems, I would appreciate any reports of oddities and errors.
juliansader is offline   Reply With Quote
Old 06-26-2016, 07:23 AM   #14
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 4,806
Default

Awesome, many thanks for this great script !
vanhaze 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 11:43 PM.


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