Необходимо добиться максимального легато в классическом оркестровом произведении на VST jоркестровой библиотеке. Заметил , когда MIDI ноты идут с небольшим " нахлестом" друг на друга, тогда струнные инструменты срабатывают очень плавно в переходах между нотами. Руками двигать каждую нотку делая нахлест одну над другой утомительно. Прошу посоветовать способ/скрипт что бы сразу в партии все сделать на легато и автоматизировать всю партию . Буду признателен за советы.
		
		
	 
--[[
   * ReaScript Name:Overlap Notes (legato)
   * Lua script for Cockos REAPER
   * Authors: Maxim Kokarev, Archie
   * Authors URI: 
https://forum.cockos.com/member.php?u=121750 https://forum.cockos.com/member.php?u=120700
   *
  ]]
local r = reaper
 
    local ME = r.MIDIEditor_GetActive();
    if not ME then return end;
    local take = r.MIDIEditor_GetTake(ME);
    r.Undo_BeginBlock();
    r.PreventUIRefresh(1);
    local correct
    if r.GetToggleCommandStateEx(32060, 40681) == 1 then
       r.MIDIEditor_LastFocused_OnCommand(40681,0) --Options: Correct overlapping notes while editing
       correct = 1
    end
    
    
    ------------------------------
    ------------------------------
    ------------------------------
    local retval, notecnt, ccevtcnt, textsyxevtcnt = r.MIDI_CountEvts(take);
    
    local tblchan={};
    local tblSel={};
    
    for i = 1, notecnt do;
        local retval,selected,muted,startppqpos,endppqpos,chan,pitch,vel = r.MIDI_GetNote(take,i-1);
        if selected then;
            tblSel[i-1]=i-1;
            tblchan[chan]=chan;
        end;
    end;
    
    local tblchan2={};
    for key,val in pairs(tblchan)do;
        tblchan2[#tblchan2+1] = val;
    end;
    
    
    for i = 1, #tblchan2 do;
        
        for key,val in pairs(tblSel)do;
            local retval,selected,muted,startppqpos,endppqpos,chan,pitch,vel = r.MIDI_GetNote(take,key);
            if chan ~= tblchan2
 then;
                r.MIDI_SetNote(take,key,false,muted,startppqpos,endppqpos,chan,pitch,vel,true);
            end;
        end;
        ------------------------------
        ------------------------------
        ------------------------------
        
    
        r.MIDIEditor_OnCommand(ME,40405);--Set note ends to start of next note (legato)
        
        ------------------------------------------------unselect last one--------------------------------------------
         
        retval, notecnt, ccevtcnt, textsyxevtcnt = r.MIDI_CountEvts( take )
        
        note_pos = 0
        
        for i = 0, notecnt -1 do
          retval, selected, muted, startppqpos, endppqpos, chan, pitch, vel = r.MIDI_GetNote( take, i )
          if selected then
             
             if startppqpos >= note_pos then
                note_pos = startppqpos  
             end
          end
        end   
         
        for i = 0, notecnt -1 do
          retval, selected, muted, startppqpos, endppqpos, chan, pitch, vel = r.MIDI_GetNote( take, i )
          if selected and startppqpos == note_pos then
             r.MIDI_SetNote( take, i  , false, muted, startppqpos, endppqpos, chan, pitch, vel, true )  
             
          end
        end
        ------------------------------------------------end of unselect last one--------------------------------------------
        
        
        ---------------------------------------- overlap-----------------------------------------------
        
        retval, notecnt, ccevtcnt, textsyxevtcnt = r.MIDI_CountEvts( take )
        
        for i = 0, notecnt -1 do
          retval, selected, muted, startppqpos, endppqpos, chan, pitch, vel = r.MIDI_GetNote( take, i )
          if selected then
            local retval,selected,muted,startppqpos,endppqpos,chan,pitch,vel = r.MIDI_GetNote(take,i);
            r.MIDI_SetNote(take,i,selected,muted,startppqpos,endppqpos+20000,chan,pitch,vel,true);
          end;
        end;
        r.MIDIEditor_LastFocused_OnCommand(40659,0) --Correct overlapping notes
        --------------------------------------- end overlap-----------------------------------------------
    
        ------------------------------
        ------------------------------
        ------------------------------
    
        for key,val in pairs(tblSel)do;
            local retval,selected,muted,startppqpos,endppqpos,chan,pitch,vel = r.MIDI_GetNote(take,key);
            r.MIDI_SetNote(take,key,true,muted,startppqpos,endppqpos,chan,pitch,vel,true);
        end;
    end;
    ------------------------------
    ------------------------------
    ------------------------------
    if correct then 
       r.MIDIEditor_LastFocused_OnCommand(40681,0) --Options: Correct overlapping notes while editing
    end
    r.MIDI_Sort(take);
    r.MIDIEditor_LastFocused_OnCommand(40214,0) --Unselect All
    r.PreventUIRefresh(-1);
    r.Undo_EndBlock("Overlap Notes (legato)",-1);