|
|
|
08-11-2017, 08:48 AM
|
#1
|
Human being with feelings
Join Date: Nov 2016
Posts: 79
|
Stretch Midi Notes Custom Action?
Hi guys,
I wanna create a shortcut to stretch selected midi notes 2x and 1/2 in the same way the mouse modifier (opt) streches notes. So the notes position is altered with the time stretch and not only the note length shortend or streched. I couldn't find any custom action or script for that :O
Any ideas on how to do that, would be greatly appreciated.
|
|
|
08-11-2017, 08:13 PM
|
#2
|
Human being with feelings
Join Date: Dec 2009
Location: Oblivion
Posts: 10,255
|
That seems complicated. Why can't you just use the mouse modifier?
|
|
|
08-12-2017, 05:38 AM
|
#3
|
Human being with feelings
Join Date: Nov 2016
Posts: 79
|
yeah you're right i could ^^. but in terms of workflow it would be easier and faster for me to have a shortcut for that.
|
|
|
08-12-2017, 05:57 AM
|
#4
|
Human being with feelings
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
|
Quote:
Originally Posted by foxAsteria
That seems complicated.
|
Not really:
Code:
x = 2
for key in pairs(reaper) do _G[key]=reaper[key] end
function StretchSelectedNotes()
local midieditor = MIDIEditor_GetActive()
if not midieditor then return end
local take = MIDIEditor_GetTake( midieditor )
if not take or not TakeIsMIDI(take) then return end
local t = {}
local str = ""
for i = 1, ({MIDI_CountEvts( take ) })[2] do
t[#t+1] = ({reaper.MIDI_GetNote( take, i-1 ) })
if i == 1 then strtppq = t[1][4] end
reaper.MIDI_SetNote( take, i-1, t[i][2],--sel
t[i][3],--mutedInOptional,
(t[i][4]-strtppq)*x+strtppq,--startppqposInOptional,
(t[i][4]-strtppq)*x+strtppq+(t[i][5]-t[i][4])*x,--endppqposInOptional,
t[i][6],--chanInOptional,
t[i][7],--pitchInOptional,
t[i][8],--velInOptional,
true)--noSortInOptional )
end
reaper.MIDI_Sort( take )
end
StretchSelectedNotes()
|
|
|
08-12-2017, 06:08 AM
|
#5
|
Human being with feelings
Join Date: Feb 2014
Posts: 834
|
Nice code Michael
Thank you
|
|
|
08-12-2017, 06:24 AM
|
#6
|
Human being with feelings
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
|
Quote:
Originally Posted by mpl
Not really:
Code:
x = 2
for key in pairs(reaper) do _G[key]=reaper[key] end
function StretchSelectedNotes()
local midieditor = MIDIEditor_GetActive()
if not midieditor then return end
local take = MIDIEditor_GetTake( midieditor )
if not take or not TakeIsMIDI(take) then return end
local t = {}
local str = ""
for i = 1, ({MIDI_CountEvts( take ) })[2] do
t[#t+1] = ({reaper.MIDI_GetNote( take, i-1 ) })
if i == 1 then strtppq = t[1][4] end
reaper.MIDI_SetNote( take, i-1, t[i][2],--sel
t[i][3],--mutedInOptional,
(t[i][4]-strtppq)*x+strtppq,--startppqposInOptional,
(t[i][4]-strtppq)*x+strtppq+(t[i][5]-t[i][4])*x,--endppqposInOptional,
t[i][6],--chanInOptional,
t[i][7],--pitchInOptional,
t[i][8],--velInOptional,
true)--noSortInOptional )
end
reaper.MIDI_Sort( take )
end
StretchSelectedNotes()
|
Hi mpl, great !
Could you pls add this to ReaPack ?
Thx in advance!
|
|
|
08-12-2017, 07:31 AM
|
#7
|
Human being with feelings
Join Date: Feb 2014
Posts: 834
|
I tested the script , It stretches all notes not the selected ones.
|
|
|
08-12-2017, 08:55 AM
|
#8
|
Human being with feelings
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
|
Аh yep, didn't test it. I will add to ReaPack some versions later (too much alcohol inside now .
|
|
|
08-12-2017, 11:57 AM
|
#9
|
Human being with feelings
Join Date: Dec 2009
Location: Oblivion
Posts: 10,255
|
Quote:
Originally Posted by mpl
Not really:
Code:
x = 2...
incomprehensible syntactical gobbeldegook
...
|
Lol, mpl, do you have any idea how complicated that shit looks to us common folk? You coders make me feel like a damned monkey who knows a little bit of sign language.
|
|
|
Thread Tools |
|
Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 04:32 PM.
|