Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Feature Requests

Reply
 
Thread Tools Display Modes
Old 02-19-2021, 08:42 AM   #1
mccrabney
Human being with feelings
 
mccrabney's Avatar
 
Join Date: Aug 2015
Posts: 3,671
Default [DONE by script] Track MIDI Input Quantize: "use grid" setting, ala Normal Quantize



the normal quantize box has a nice option to "use grid," which uses ME grid/swing settings to quantize MIDI.

i really this preference. you can quickly see the grid change against your recorded notes, giving you a preview of what a quantize would do at that setting. this is particularly useful when using swing -- you can see how your swing is going to line up to other off-grid elements of your composition.

track input quantize, however, doesn't have a "use grid" setting. this is a bummer when you're trying to use project swing, as you have to keep track of the input quantize swing param in addition to the grid param.

could track input get that "use grid" option? maybe by pulling grid settings from the current/last open MIDI editor? hopefully this would be an easy addition, because it would go a LONG way for quick, grid-expressive note entry.

thanks for reading.
__________________
mccrabney scripts: MIDI edits from the Arrange screen ala jjos/MPC sequencer
|sis - - - anacru| isn't what we performed: pls no extra noteons in loop recording
| - - - - - anacru|sis <==this is what we actually performed.

Last edited by mccrabney; 03-19-2021 at 01:50 PM.
mccrabney is online now   Reply With Quote
Old 02-22-2021, 05:38 AM   #2
Daodan
Human being with feelings
 
Join Date: Jan 2011
Posts: 1,167
Default

Just use "Track: Set MIDI input quantize to grid for selected tracks" action
Daodan is online now   Reply With Quote
Old 02-22-2021, 10:04 AM   #3
mccrabney
Human being with feelings
 
mccrabney's Avatar
 
Join Date: Aug 2015
Posts: 3,671
Default

Quote:
Originally Posted by Daodan View Post
Just use "Track: Set MIDI input quantize to grid for selected tracks" action
thanks, but that's the step i'm trying to bypass. like the Quantize window, i want an option in the Input Quantize window to be automatically aware of midi editor grid changes.

for example, if you open the normal quantize window and select "use grid," you can change the grid in realtime and see the results, without having to re-engage quantize.

using the action recommended above in the context of input quantize would require the user to re-engage the input quantize setting every time i adjust the midi grid -- doable, but not nearly as clean/inattentive as the "use grid" setting in Quantize
__________________
mccrabney scripts: MIDI edits from the Arrange screen ala jjos/MPC sequencer
|sis - - - anacru| isn't what we performed: pls no extra noteons in loop recording
| - - - - - anacru|sis <==this is what we actually performed.
mccrabney is online now   Reply With Quote
Old 02-23-2021, 04:49 PM   #4
Daodan
Human being with feelings
 
Join Date: Jan 2011
Posts: 1,167
Default

Quote:
Originally Posted by mccrabney View Post
thanks, but that's the step i'm trying to bypass. like the Quantize window, i want an option in the Input Quantize window to be automatically aware of midi editor grid changes.

for example, if you open the normal quantize window and select "use grid," you can change the grid in realtime and see the results, without having to re-engage quantize.

using the action recommended above in the context of input quantize would require the user to re-engage the input quantize setting every time i adjust the midi grid -- doable, but not nearly as clean/inattentive as the "use grid" setting in Quantize
I guess, changing input quantize settings in realtime every time you change grid size can cause lower performance, as input quantize is a per track feature, not global, and you can change the grid a hundred times while you work, so...

In my workflow I set grid to 1/16 or 1/8 then pres button with "input quantize to grid" action, and then I can continue work on project, switch grid here and there, but when I press REC I want to be sure that the input quantize the same as I set it before.

Maybe you just need to use option "use the same grid division in arrange and midi editor" and bind action "set input quantize to grid" to keyboard shortcut and you'll be happy?🙂
Daodan is online now   Reply With Quote
Old 03-19-2021, 01:42 PM   #5
mccrabney
Human being with feelings
 
mccrabney's Avatar
 
Join Date: Aug 2015
Posts: 3,671
Default

in case anyone else wants to link project grid to input quantize grid, check this out --

FeedTheCat wrote me this nice little script. originally, it used an open MIDI editor to push the grid values to the input quantize function. i slowed it down, and changed it to use the main arrange grid instead, because i change the swing grid and have the arrange/midi editor grids linked.

given the above settings/linkage, i can now adjust the swing via mousewheel and have it populate to both Arrange, MIDI editor, and input quantize.

Code:
local prev_grid_val, prev_grid_swing
local _, _, sec, cmd = reaper.get_action_context()
lasttime = os.time()
loopcount = 0

function Main()
    
    local newtime = os.time()
        --local hwnd = reaper.MIDIEditor_GetActive()
        --local editor_take = reaper.MIDIEditor_GetTake(hwnd)
        --if reaper.ValidatePtr(editor_take, 'MediaItem_Take*') then
            -- Detect changes in MIDI editor grid
            --local grid_val, grid_swing = reaper.MIDI_GetGrid(editor_take)
            local _, grid_val, swingon, grid_swing = reaper.GetSetProjectGrid(0, false)
            grid_val=grid_val*4
            
            if newtime-lasttime >= 2 then
                if prev_grid_val ~= grid_val or prev_grid_swing ~= grid_swing then
                    prev_grid_val = grid_val
                    prev_grid_swing = grid_swing
                    for i = 0, reaper.CountTracks() - 1 do
                        local track = reaper.GetTrack(0, i)
                        _, tr_name = reaper.GetSetMediaTrackInfo_String( track, 'P_NAME', '', 0 )
                        
                        if tr_name:lower():find("ch") or tr_name:lower():find("sequencer") then
                            local _, chunk = reaper.GetTrackStateChunk(track, '')
                            local is_input_quantize_on = chunk:match('\nINQ (.-) ') == '1'
                                
                            if is_input_quantize_on then  -- Apply grid settings to track input quantize
                                lasttime=newtime
                                local swing = math.floor(math.abs(grid_swing * 100))
                                local pattern = '(\nINQ .- .- .- ).-( .- ).- '
                                local repl = '%1' .. grid_val .. '%2' .. swing .. ' '
                                chunk = chunk:gsub(pattern, repl, 1)
                                reaper.SetTrackStateChunk(track, chunk)
           
                            end
                        end
                    end
                end
                lasttime=newtime
            end

    reaper.defer(Main)
end

function Exit()
    reaper.SetToggleCommandState(sec, cmd, 0)
    reaper.RefreshToolbar2(sec, cmd)
end

reaper.SetToggleCommandState(sec, cmd, 1)
reaper.RefreshToolbar2(sec, cmd)

reaper.atexit(Exit)
Main()
__________________
mccrabney scripts: MIDI edits from the Arrange screen ala jjos/MPC sequencer
|sis - - - anacru| isn't what we performed: pls no extra noteons in loop recording
| - - - - - anacru|sis <==this is what we actually performed.
mccrabney is online now   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 07:16 AM.


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