Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 05-29-2023, 02:31 PM   #1
Dansereal
Human being with feelings
 
Join Date: Jul 2021
Posts: 6
Default Can the “nosort” option be used with the Midi_InsertCC command?

Hi,

I have reason to think the “nosort” / “sort” option that gets mentioned on this forum might help me refine a script I’m working on. The workhorse commands in the script are Midi_GetNote and Midi_InsertCC. The idea of the script is to draw segmented wind-controller-like “breath” curves that are tightly coupled with non-overlapping note-on/off events. If I run it on a long (monophonic) midi line, it mostly gives me what I want, a 6-point breath curve, with some scripted variance in curve shape and tilt, around each note or group of (non-overlapping) slurred notes:



But other times it inserts a wild cc point between notes, and even more unexpectedly, it will sometimes insert a whole bunch of cc points around a single note,





For me it’s not a big deal to clean up these anomalies just by re-running the script with just the “weird” notes selected. But I wonder if the problem is caused by some kind of background sorting going on while the script is running, such that the cc I think I’m inserting in place X is actually getting shifted elsewhere down the line to place Y, and a bunch of them sometimes pile up around note Z. I’m setting just one cc shape (slow start/end) on all cc points so I don’t get any clues from that. Also, I don’t wind up with too few points on any notes. Which, come to think of it, may be a clue that there’s something wrong with my looping logic, such that I’m inadvertently generating extra ccs that are getting shifted down the line and piling up in unpredictable ways.

So I’d like to try the nosort/sort trick to see if that will help. The thing is, Midi_InsertCC doesn’t appear to be one of the commands that support the nosort option. What do y’all think? I don’t mind posting the code if anyone thinks that would help.

Greg
Attached Images
File Type: jpeg IMG_2023-5-29-133733.jpeg (107.4 KB, 105 views)
File Type: jpeg IMG_2023-5-29-134113.jpeg (106.3 KB, 93 views)
File Type: jpeg IMG_2023-5-29-134533.jpeg (87.8 KB, 93 views)
Dansereal is offline   Reply With Quote
Old 05-29-2023, 02:43 PM   #2
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

MIDI_DisableSort + many MIDI_InsertCC here + MIDI_Sort
cfillion is offline   Reply With Quote
Old 05-29-2023, 03:32 PM   #3
Dansereal
Human being with feelings
 
Join Date: Jul 2021
Posts: 6
Default

Quote:
Originally Posted by cfillion View Post
MIDI_DisableSort + many MIDI_InsertCC here + MIDI_Sort
Awesome! Overlooked the standalone MIDI_DisableSort in the API.

Thanks!

Greg
Dansereal 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 08:24 AM.


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