Old 08-30-2017, 12:06 PM   #1
johan-v
Human being with feelings
 
Join Date: Feb 2008
Posts: 67
Default Midi items bug? All Notes Off Question - Lua

Hello,

I had a problem when inserting notes in a midi item take.
A bit hard to explain but can be demonstrated with the interactive reascript.

Start with an empty reaper projet.
Insert the following lines in ireascript.

At the end there will be two All note offs in the take.
I know the notes are inserted out of the midi take length.
But can this be avoided?
Here are the steps.

reaper.InsertTrackAtIndex(0, true)
trk = reaper.GetTrack(0,0)
item = reaper.CreateNewMIDIItemInProj(trk, 0, 5, false)
take = reaper.GetMediaItemTake(item, 0)
dummy = reaper.MIDI_InsertNote(take, false,false,90*960,94 * 960,0,60,127,true)
dummy = reaper.MIDI_InsertNote(take, false,false,80*960,84 * 960,0,60,127,true)
dummy = reaper.MIDI_InsertNote(take, false,false,1*960,2 * 960,0,60,127,true)
sorty = reaper.MIDI_Sort(take)
reaper.Main_OnCommandEx(40612, 0, 0)
( The last command changes the item length to the take length.


So the question is.
How to avoid two or more all note offs after MIDI_sort outside the take length.

Regards,

Johan
johan-v is offline   Reply With Quote
Old 08-30-2017, 04:09 PM   #2
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,107
Default

Not a complete answer to your question but Reaper inserts All notes off messages automatically in MIDI items.

This can be observed e.g. when inserting a new blank MIDI item via Insert - New MIDI item and switch to event list in the MIDI editor.

So I think having that All notes off message is not totally avoidable (someone correct me if wrong).

I don't know why you get two of them in your case though and how this can be avoided.
nofish is offline   Reply With Quote
Old 08-30-2017, 04:18 PM   #3
johan-v
Human being with feelings
 
Join Date: Feb 2008
Posts: 67
Default

Hello,

The all note offs is not a problem if there is only one at the end of a take.

I think I get them because my notes are inserted outside the take lenght.
When reaper does the midi_sort function I suppose reaper does keep the original all notes off and ads a new one.
When doing this multiple times with a take there will be multiple all note offs.

Regards,

Johan
johan-v is offline   Reply With Quote
Old 08-30-2017, 04:24 PM   #4
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,107
Default

Ok, I thought you wasn't aware of the auto adding All notes off by Reaper to start with, sorry.

Other than that, I have close to none experience with MIDI scripting, so no idea how to help further, hopefully a more experienced MIDI scripter comes by.

Good luck.
nofish is offline   Reply With Quote
Old 04-08-2019, 04:54 PM   #5
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,066
Default

Been experiencing the same, tons of all notes off are being added, when notes cross the all notes off message, that limits the take.
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 04-09-2019, 11:50 AM   #6
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,984
Default

1) Extend MIDI take with MIDI_SetItemExtents()
2) modify MIDI data, preserving last AllNotesOff message


OR just do stuff preserving last AllNotesOff message, see Julian Sader`s MIDI scripts

Last edited by mpl; 04-09-2019 at 11:59 AM.
mpl 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 02:19 AM.


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