View Single Post
Old 08-12-2017, 05:57 AM   #4
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,984
Default

Quote:
Originally Posted by foxAsteria View Post
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()
mpl is offline   Reply With Quote