Old 11-26-2021, 08:12 AM   #1
DrFrankencopter
Human being with feelings
 
Join Date: Jan 2011
Location: Ottawa, Canada
Posts: 293
Default Proportional drag/stretch MIDI?

I'm looking for a stretch marker like functionality for midi items that are set to ignore project tempo. Effectively, what I want is something like stretch markers but for midi.

This is to help my workflow when quantizing midi drums that were not played to a click. To do this you need to set the midi item to ignore project tempo. I end up having to break the drum track down into 1-2 bar chunks and then slide the midi around manually...it's laborious.

What I'd like to be able to do is select a bunch of notes in a midi item and then apply an action that makes them effectively gradually (linearly) speed up, or slow down based on a factor (or even better based on a mouse click reference point).

Something a little like this algorithm:
1. TimeL = Note on time at left edge of selected group
2. TimeR = Note on time at right edge of selected group
3. TimeSpan = Time-R - TimeL
4. TimeR_new = The new desired note on time for the note at the right edge of the group
5. TotalStretchFactor = TimeSpan/(TimeR_new - TimeL) --> ie stretching to the right gives a factor less than than 1, and stretching to the left is greater than one. This would match the audio stretch marker convention. Maybe let the user type this value in.
5. New note on time for each note in the group is now:
NoteOnTime + ((NoteOnTime - TimeL)/TimeSpan) *(1 - TotalStretchFactor)

The last line there basically takes the original note on time, and then adds (or subtracts) a factor proportional to the amount of desired "stretch" based on how far along the selected time span we are.

Could also do a similar thing for note duration...

Is there already scripts (maybe in SWS) that do this? Or do I need to write something?

Really hope there's something built in...or easily available
__________________
RME TotalMixFX Actions for Reaper here: https://stash.reaper.fm/v/29339/reape...MixOSC_x64.dll
DrFrankencopter is offline   Reply With Quote
Old 11-28-2021, 04:57 PM   #2
DrFrankencopter
Human being with feelings
 
Join Date: Jan 2011
Location: Ottawa, Canada
Posts: 293
Default

Ok, so I coded something up in Lua to do this. It uses Lokasenna's GUI scripts, so you'll need them to use it (available on ReaPack).

My script requires that at least 2 events be selected within the active midi editor. The events can be CC or notes.

There's a bias slider that affects the timings of all events (cc and notes) between the selected events. There is also a slope slider (accel/decel) that gradually transitions the note/cc timings. Bias/Slope are limited in range to 0.75-1.25...not really meant for extreme changes.

How to use it:
1) Select your note range (remember that all notes/cc between the selected notes will be re-timed)
2) Select your bias/slope values (numbers greater than 1 are sped up, and less than 1 slow down)
3) Hit apply...listen to the results
4) If you don't like what you hear/see, try different Bias/Slope combinations...hit apply after making changes
5) If you like what you hear hit OK
6) If you want to go back to the original values hit Cancel (doesn't close the window, so you can re-try new bias/slope values)
7) If it's just not working for you, just hit the 'X" button on the window, and your original Midi values will be restored

I haven't had a chance to really work with this script yet...but in my limited testing it appears to be working.

Maybe it will be useful to someone....

PS: Undo state doesn't seem to be working...so please use that 'Cancel' button to undo your changes.

PPS: Also, at present you can't select new notes in the Midi editor and expect the script to work between them...at the moment, it uses the range of selected notes/cc that it sees when the script is first called.
Attached Files
File Type: lua midiStretch_GUI.lua (10.3 KB, 40 views)
__________________
RME TotalMixFX Actions for Reaper here: https://stash.reaper.fm/v/29339/reape...MixOSC_x64.dll
DrFrankencopter 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:41 AM.


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