Old 08-30-2017, 12:06 PM   #1
johan-v
Human being with feelings
 
Join Date: Feb 2008
Posts: 52
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: 8,719
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: 52
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: 8,719
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
Posts: 2,224
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 | Stephan R÷mer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_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: 2,391
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
__________________
SoundCloud | MPL Scripts discussion | ReaPack | Donate

Last edited by mpl; 04-09-2019 at 11:59 AM.
mpl is offline   Reply With Quote
Old 04-10-2019, 08:08 AM   #7
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 2,224
Default

Thanks man!

My bad, I enlarged the item while setting the last note in the string.
I'm now iterating to the last note and checking if the position + new_position will exceed the item boundaries and extend the item BEFORE the notes are written in the take.
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan R÷mer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is offline   Reply With Quote
Old 05-13-2019, 08:20 AM   #8
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 5,138
Default

In one project I am having problems, a lot of random All Note Offs on some of my piano MIDI items, and I need to figure out why do I have them. How to know what can cause this? a MIDI script? I certainly have not inserted so many All Notes Off messages randomly.
__________________
HeDaScripts for REAPER
heda is offline   Reply With Quote
Old 05-13-2019, 08:40 AM   #9
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 2,224
Default

Yes indeed, my nudge notes scripts did this (I think), when moving the notes out of the boundaries. Hadn't thought of that case, but fixed it in the meanwhile. I could imagine that other scripters missed this too, maybe.
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan R÷mer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ 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 06:30 PM.


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