Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER General Discussion Forum

Reply
 
Thread Tools Display Modes
Old 08-29-2019, 06:05 PM   #1
Joe90
Human being with feelings
 
Join Date: Aug 2019
Posts: 855
Default Set MIDI note length in item from arrange window?

Does anyone know of a way to to set all midi notes in selected items to grid length from the main arrange window?

It's an essential one for me, and I'm very surprised that I can't seem to figure out a way to do it... I'm hoping it's possible.

I've figured out my shortcuts for pitch and velocity without needing to load the midi editor, but not note length.

Cheers!
Joe90 is offline   Reply With Quote
Old 08-29-2019, 07:01 PM   #2
mehmethan
Human being with feelings
 
mehmethan's Avatar
 
Join Date: Jun 2011
Posts: 610
Default

Option 1 :

There are "quantize note end to closest grid" scripts for main window. You need reapack installed.

Option 2 :

Use the inline midi editor for items. This way you don't need to open the Midi editor window.
mehmethan is offline   Reply With Quote
Old 08-29-2019, 08:03 PM   #3
Joe90
Human being with feelings
 
Join Date: Aug 2019
Posts: 855
Default

Quote:
Originally Posted by mehmethan View Post
Option 1 :

There are "quantize note end to closest grid" scripts for main window. You need reapack installed.

Option 2 :

Use the inline midi editor for items. This way you don't need to open the Midi editor window.
Thanks for your quick reply! However I really need a way to set all notes to one length, rather than quantizing the ends - they are quite different functions.

Also, regarding the inline editor - once you're 'inside' the inline editor it has it's own set of shortcuts that can't be combined with the main ones, so I still can't set all the note lengths with one shortcut, which is what I really need, because I need to do be able to do it to multiple items at a time rather then clicking each one and opening individually, selecting all the notes - hitting the shortcut - then doing the same again for each item individually.

I'm aware I can open up multiple midi parts and edit them all together in one window, and I do have all the midi editing preference set up correctly so that it does this by default - I can select multiple midi parts, open the editor, Ctrl-A to select the notes in all the items, and move or resize them all together, but when I fire off the 'set selected notes to X velocity' script, it only effects the part that's focused, regardless of selection. Same with the 'set note lengths to grid size' command... which is strange.

If this method worked as expected for me then it wouldn't be such a big issue - as I could just select all the midi items I want, open them all together, select all and fire off the shortcut - still not as quick as doing it from the main window but not a big deal. However the current workaround of having to open each midi item individually is really not ideal, neither is gluing them, as they may be spread around in different places.
Joe90 is offline   Reply With Quote
Old 08-29-2019, 08:31 PM   #4
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,618
Default

not sure if this helps but

either while in the Inline or MIDI Ed., select all notes and hit Cntrl+F2

enter the note length you want in the field and OK

the values can be a little funny but things like 1/2 or 1/4 work
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva
hopi is offline   Reply With Quote
Old 09-11-2019, 07:24 PM   #5
Joe90
Human being with feelings
 
Join Date: Aug 2019
Posts: 855
Default

Cheers for this Hopi, not specifically what I was after but still very helpful to know. Much appreciated.
Joe90 is offline   Reply With Quote
Old 09-13-2019, 02:46 PM   #6
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Does anyone know of a way to to set all midi notes in selected items to grid length from the main arrange window?
Should swing be applied? If not, try this script:
Code:
-- BEWARE of creating overlapping notes, especially when lengthening notes
_, grid = reaper.GetSetProjectGrid(0, false)
for i = 0, reaper.CountSelectedMediaItems(0)-1 do
    item = reaper.GetSelectedMediaItem(0, i)
    for t = 0, reaper.CountTakes(item)-1 do
        take = reaper.GetTake(item, t)
        if reaper.ValidatePtr2(0, take, "MediaItem_Take*") and reaper.TakeIsMIDI(take) then -- Must validate to check for empty takes
            countOK, numNotes = reaper.MIDI_CountEvts(take)
            if countOK and numNotes > 0 then
                ppq = reaper.MIDI_GetPPQPosFromProjQN(take, 1+reaper.MIDI_GetProjQNFromPPQPos(take, 0))
                newNoteLength = 4*ppq*grid
                reaper.MIDI_DisableSort(take)
                for n = 0, numNotes-1 do
                    noteOK, _, _, startppqpos = reaper.MIDI_GetNote(take, n)
                    if noteOK then
                        reaper.MIDI_SetNote(take, n, nil, nil, startppqpos, startppqpos+newNoteLength, nil, nil, nil, true)
                    end
                end
                reaper.MIDI_Sort(take)
            end
        end
    end
end
reaper.Undo_OnStateChange2(0, "Set note length to grid length")
juliansader is offline   Reply With Quote
Old 09-13-2019, 05:19 PM   #7
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,721
Default

Quote:
Originally Posted by juliansader View Post
Should swing be applied? If not, try this script:
Code:
-- BEWARE of creating overlapping notes, especially when lengthening notes
.
.
.
.
        end
    end
end
reaper.Undo_OnStateChange2(0, "Set note length to grid length")
Will test this during the weekend!!

Thanks a ton JS!!
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
Thonex is offline   Reply With Quote
Old 09-13-2019, 09:11 PM   #8
Joe90
Human being with feelings
 
Join Date: Aug 2019
Posts: 855
Default

From my short testing it works brilliantly Julian. Thank you!

If you have a means for accepting donations then please let me know, I'd be happy to do so.

I have to say of all unique and fascinating things about this particular DAW, I think the most appealing is actually the community that continues to support and augment it.
Joe90 is offline   Reply With Quote
Old 09-14-2019, 09:27 AM   #9
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,721
Default

Quote:
Originally Posted by Joe90 View Post
From my short testing it works brilliantly Julian. Thank you!

If you have a means for accepting donations then please let me know, I'd be happy to do so.

I have to say of all unique and fascinating things about this particular DAW, I think the most appealing is actually the community that continues to support and augment it.
Agreed on all counts. 1) JS is amazing. 2) I would have abandoned Reaper long ago if it wasn’t for the help from this community.
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
Thonex is offline   Reply With Quote
Old 11-19-2022, 07:05 PM   #10
inthevoid
Human being with feelings
 
inthevoid's Avatar
 
Join Date: May 2022
Location: London
Posts: 444
Default

Just came across this thread as it's something I've needed for my workflow and wanted to say - Thanks for this script Julian! The Reaper community is fantastic.
inthevoid 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 09:50 PM.


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