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

Reply
 
Thread Tools Display Modes
Old 07-10-2024, 07:12 PM   #1
Kheaven
Human being with feelings
 
Join Date: Feb 2024
Location: United States
Posts: 17
Default Note Off CC message increase RT CPU usage significantly

There are dozens of kontakt instances in my project. Force Auto-bypass on silence is set for all plugins. When there is no note on message RT CPU usage is almost zero. Even though there are many instance, there is no RT CPU usage. But things change completely when we send any CC message like Note off(CC 123). When note off or other cc messages sent, the real time CPU performance rate increases significantly. Even though there is no note playing, the entire instances of Kontakt consumes CPU as they are playing all at once. Sometimes RT CPU is about %90.00. When no CC message is sent, CPU usage drops to zero again.

It is very important for me to Send note off (CC-123) to all instances of kontakt to silence them when quickly switching between midi routing presets. I use bome midi translator pro to control my midi traffic. However, I think this problem is not caused by bome midi translator.

Is it normal for those plugins to consume RT CPU like all instruments are heavily playing, only because they are getting a cc message or a sustain pedal message?

Do you know any solution?

Thank you in advance.
Kheaven is offline   Reply With Quote
Old 07-10-2024, 08:24 PM   #2
Sid
Human being with feelings
 
Join Date: Apr 2018
Posts: 572
Default

Have you tried MIDI CC120 (all sound off) instead of CC123?

I was not able to reproduce your issue, so this is just something to try.
I was able to boost the RT CPU by setting my block size to 64 while playing actual notes.
__________________
Reaper v6.81 Windows 10

Last edited by Sid; 07-10-2024 at 08:49 PM.
Sid is online now   Reply With Quote
Old 07-10-2024, 11:49 PM   #3
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 15,288
Default

Very obviously all Kontrakt instances need CPU to handle any Midi message. With Kontakt it totally depends on the loaded libraries.

Are all these instance "active" all the time ? If not it might make sense to mute the inactive tracks and use the appropriate options to stall the plugins in these tracks, saving CPU.

Is this a "live playing" installation ? You might want to take a look in the "live" subforum. Especially the first/sticky thread.
mschnell is online now   Reply With Quote
Old 07-11-2024, 04:48 AM   #4
F1308
Human being with feelings
 
F1308's Avatar
 
Join Date: Nov 2022
Location: It is season dependant.
Posts: 853
Default

Quote:
Originally Posted by Kheaven View Post
....

It is very important for me to Send note off (CC-123) to all instances of kontakt to silence them when quickly switching between midi routing presets.....
I use this collection of scripts to unmute and mute tracks based on labels in their names...

See if they suit you.

Unmute tracks by labels in name and Mute after Tail
----------------------------------------------------------
#0 Mute Master -Mute & Unmute

#0 Unmute Tracks -Labels Ch1

#0 Unmute Tracks -Labels Ch2 & Ch1 @Tail

#0 Unmute Tracks -Labels Ch3 & Ch2 @Tail

#0 Unmute Tracks -Labels Ch4 & Ch3 @Tail

#0 Unmute Tracks -Labels Ch5 & Ch4 @Tail

#0 Unmute Tracks -Labels Ch6 & Ch5 @Tail

#0 Unmute Tracks -Labels Ch7 & Ch6 @Tail

#0 Unmute Tracks -Labels Ch8 & Ch7 @Tail
---------------------------------------------------------




FGM Wood. Maestro's Keyboard Arsenal: Actions & Effects Scripts.
A collection of tools that will elevate your projects
to embody the timeless beauty and emotional power of music.
Customize every detail, even on a per-key basis.


https://forum.cockos.com/showthread.php?t=279068


😀😀😀😀
🎹🎹🎹🎹
F1308 is offline   Reply With Quote
Old 07-11-2024, 07:20 AM   #5
F1308
Human being with feelings
 
F1308's Avatar
 
Join Date: Nov 2022
Location: It is season dependant.
Posts: 853
Default

Kheaven, I have made another script, JSFX, that releases all keys
when an incoming CC message matches the sliders.


See if it works on your system.

I have placed 100 tracks with Kontakt 7 (VST The Gentleman Piano) on each.

Played 4 fingers chord and RT CPU showed 9.6 %

Moved wheel 2 from bottom to top (CC13 0/50 values) and upon reaching 50 and matching
the sliders in the script all keys were released (sustain kept) and RT CPU showed 10.7 %.

With ten pianos numbers are 3.3 then 3.6.

😀😀😀😀
🎹🎹🎹🎹


FGM #Key Release -All Keys -CC Message

Code:
//// START OF SCRIPT
//
desc: FGM #Key Release -All Keys -CC Message
//
// Script by FGM using AI
//
// FGM #Key Release -All Keys -CC Message
//
/**
 * This JSFX will:
 * 1. Allow the user to specify a CC number and value using sliders.
 * 2. Enable or disable handling of the specified CC message using a toggle.
 * 3. When handling is enabled and the specified CC message is received, 
 *    send silent Note Off messages (velocity = 0) for all notes (0 to 127).
 * 4. Pass through all other MIDI messages unchanged.
 */

slider1:0<0,127,1>CC Number
slider2:0<0,127>CC Value
slider3:1<0,1,1{Script Disabled- No Key release,Keys released when CC Message is matched}> >>>>

@slider
cc_number = slider1;
cc_value = slider2;
handle_cc = slider3;

@block
while (midirecv(offset, msg1, msg2, msg3))
(
  // Check if handling of CC messages is enabled
  handle_cc ?
  (
    // Check if the message is a Control Change (CC) message
    ((msg1 & $xF0) == $xB0) ? 
    (
      // Check if the CC number and value match the slider settings
      (msg2 == cc_number && msg3 == cc_value) ? 
      (
        // Send Note Off messages for all notes (0 to 127)
        fixedNote = 0;
        while (fixedNote < 128)
        (
          // Send Note Off message (velocity = 0)
          midisend(offset, $x80 | (msg1 & $x0F), fixedNote, 0);
          fixedNote += 1;
        );
      ) :
      (
        // Pass through other CC messages unchanged
        midisend(offset, msg1, msg2, msg3);
      );
    ) :
    (
      // Pass through non-CC messages unchanged
      midisend(offset, msg1, msg2, msg3);
    );
  ) :
  (
    // If handling is disabled, pass through all messages unchanged
    midisend(offset, msg1, msg2, msg3);
  );
);

//
//// END OF SCRIPT

-----------------------------------------------------------------------------------------------


😀😀😀😀
🎹🎹🎹🎹

Last edited by F1308; 07-11-2024 at 07:27 AM.
F1308 is offline   Reply With Quote
Old 07-11-2024, 08:19 AM   #6
Kheaven
Human being with feelings
 
Join Date: Feb 2024
Location: United States
Posts: 17
Default

F1308,
I do not know anything about KSP scripting so when I apply your script it says error in first line. :-(

Quote:
Originally Posted by F1308 View Post
Kheaven, I have made another script, JSFX, that releases all keys
when an incoming CC message matches the sliders.
See if it works on your system.

Last edited by Kheaven; 07-11-2024 at 08:26 AM.
Kheaven is offline   Reply With Quote
Old 07-11-2024, 08:29 AM   #7
Kheaven
Human being with feelings
 
Join Date: Feb 2024
Location: United States
Posts: 17
Default

Thanks,

That thread gives a general idea of handling everything. Helpful. But my situation is different. All I need is not to consume cpu when an unused midi message is being received. At last you are not playing or processing any sound. If a very high cpu consuming instrument is loaded then it consumes a lot of RT CPU even you are not using any sound or effect of that instrument.

Quote:
Originally Posted by mschnell View Post
Very obviously all Kontrakt instances need CPU to handle any Midi message. With Kontakt it totally depends on the loaded libraries.

Are all these instance "active" all the time ? If not it might make sense to mute the inactive tracks and use the appropriate options to stall the plugins in these tracks, saving CPU.

Is this a "live playing" installation ? You might want to take a look in the "live" subforum. Especially the first/sticky thread.

Last edited by Kheaven; 07-11-2024 at 08:34 AM.
Kheaven is offline   Reply With Quote
Old 07-11-2024, 08:29 AM   #8
F1308
Human being with feelings
 
F1308's Avatar
 
Join Date: Nov 2022
Location: It is season dependant.
Posts: 853
Default

[QUOTE=Kheaven;2795205]F1308,
I do not know anything about KSP scripting so when I apply your script it says error in first line. :-(

Quote:
Originally Posted by F1308 View Post
Kheaven, I have made another script, JSFX, that releases all keys
when an incoming CC message matches the sliders.
See if it works on your system.
Thoroughly tested before posted.

Copied the text again, placed in my system, all harpsichords go silent.

This time RTU CPU went 4.4 to 7.3

The script is to be copied from

//// START OF SCRIPT


to


//// END OF SCRIPT






And that is it.

😀😀😀😀
🎹🎹🎹🎹
F1308 is offline   Reply With Quote
Old 07-11-2024, 08:42 AM   #9
F1308
Human being with feelings
 
F1308's Avatar
 
Join Date: Nov 2022
Location: It is season dependant.
Posts: 853
Default

Quote:
Originally Posted by Kheaven View Post
Thanks,

That thread gives a general idea of handling everything. Helpful. But my situation is different. All I need is not to consume cpu when an unused midi message is being received. At last you are not playing or processing any sound. If a very high cpu consuming instrument is loaded then it consumes a lot of RT CPU even you are not using any sound or effect of that instrument.

Then the scripts I talked about at first are ideal.


See where it all started....

https://forum.cockos.com/showthread.php?t=288933

Also...

RT CPU from 72.6% down to 30.7@257 Tracks.
https://forum.cockos.com/showthread.php?t=286836



-------------------------------------------------

😀😀😀😀
🎹🎹🎹🎹

Last edited by F1308; 07-11-2024 at 09:03 AM.
F1308 is offline   Reply With Quote
Old 07-11-2024, 09:15 AM   #10
strachupl
Human being with feelings
 
strachupl's Avatar
 
Join Date: Jan 2013
Posts: 681
Default

First of all you should not treat everyone asking for help here as a programmer. He seem to think you pass him a KSP Kontakt script, not Reaper's script and most likely he doesn't know what to do with it.

You have to go to actions list in Reaper and click on new script there, choose place to save it and paste code there. Then save it again and run it from action list. Or... if it is jsfx you need to go to fx chain, and create new jsfx from fx menu, laste code, save, load jsfx after(?) kontakt.
__________________
Love is patient and kind; love does not envy or boast; it is not arrogant or rude.
It does not insist on its own way; it is not irritable or resentful;
it does not rejoice at wrongdoing, but rejoices with the truth. Corinthians 13:4-6

Last edited by strachupl; 07-11-2024 at 09:21 AM.
strachupl is offline   Reply With Quote
Old 07-11-2024, 09:25 AM   #11
F1308
Human being with feelings
 
F1308's Avatar
 
Join Date: Nov 2022
Location: It is season dependant.
Posts: 853
Default

Quote:
Originally Posted by strachupl View Post
First of all you should not treat everyone asking for help here as a programmer. He seem to think you pass him a KSP Kontakt script, not Reaper's script and most likely he doesn't know what to do with it.

You have to go to actions list in Reaper and click on new script there, choose place to save it and paste code there. Then save it again and run it from action list.
It is important to clarify that while this forum welcomes individuals of all skill levels, it is also a place where users are expected to have a basic understanding of the topics they are engaging with or to clearly state their lack of knowledge. Your assumptions about the user's intentions and abilities are both presumptive and unconstructive. Instead of making broad generalizations, it would be more helpful to directly guide them towards the right resources or ask clarifying questions to better understand their needs. Remember, this community thrives on respectful and supportive interactions.

Please keep this in mind in future responses.

And finally, do not go telling me what I should say.


By the way, I said very clearly:

Kheaven, I have made another script, JSFX...

😀😀😀😀
🎹🎹🎹🎹
F1308 is offline   Reply With Quote
Old 07-11-2024, 10:59 AM   #12
strachupl
Human being with feelings
 
strachupl's Avatar
 
Join Date: Jan 2013
Posts: 681
Default

Quote:
Originally Posted by F1308 View Post
It is important to clarify that while this forum welcomes individuals of all skill levels, it is also a place where users are expected to have a basic understanding of the topics they are engaging with or to clearly state their lack of knowledge. Your assumptions about the user's intentions and abilities are both presumptive and unconstructive. Instead of making broad generalizations, it would be more helpful to directly guide them towards the right resources or ask clarifying questions to better understand their needs. Remember, this community thrives on respectful and supportive interactions.

Please keep this in mind in future responses.

And finally, do not go telling me what I should say.


By the way, I said very clearly:

Kheaven, I have made another script, JSFX...

😀😀😀😀
🎹🎹🎹🎹
You write a lot but it doesn't mean much.
I see that you got upset because someone pointed something out to you. While your coding skills can be helpful, they are only useful if they relate to the topic operator's problem and you communicate it in a way that they can do something with it. You are writing to an anonymous user of a music program in a general section, not to programmers in a software section.

JSFX plugins are not common in the music/DAW world, as evidenced by the fact that the topic operator associated your script with a KSP script. He mentioned KSP, which is a script for "Kontakt," and you tell him to copy the code from here to there. He could keep copying forever, but it won't improve his situation.

Additionally, you weave in advertisements for your scripts, which nobody asked for, along with a lot of emoticons, which creates chaos.

My comment was EXTREMELY constructive because it pointed out that this is not a "KSP Kontakt" script but a script/plugin for Reaper. Therefore, instead of spamming and making a mess for the topic operator, try to avoid unnecessary links, references, images, and emoticons, and instead provide concise solutions. Please, these are my suggestions, and you can take them or not, don't feel offended. Keep it in mind for next time that everyone can judge your response and you can't really telling me I can't see? uno card.

I don't personally need forum training. I use common sense instead.
__________________
Love is patient and kind; love does not envy or boast; it is not arrogant or rude.
It does not insist on its own way; it is not irritable or resentful;
it does not rejoice at wrongdoing, but rejoices with the truth. Corinthians 13:4-6

Last edited by strachupl; 07-11-2024 at 11:04 AM.
strachupl is offline   Reply With Quote
Old 07-11-2024, 11:35 AM   #13
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 15,288
Default

Quote:
Originally Posted by Kheaven View Post
ot to consume cpu when an unused midi message is being received.
How do you know that a midi message is unused ?
mschnell is online now   Reply With Quote
Old 07-11-2024, 10:05 PM   #14
Kheaven
Human being with feelings
 
Join Date: Feb 2024
Location: United States
Posts: 17
Default

Lets consider that the instrument in kontakt has nothing to do with CC#32 with value of 127. There is no function associated with that. But still consumes equal amount of rt cpu when it is being played.

Quote:
Originally Posted by mschnell View Post
How do you know that a midi message is unused ?
Kheaven is offline   Reply With Quote
Old 07-11-2024, 11:50 PM   #15
F1308
Human being with feelings
 
F1308's Avatar
 
Join Date: Nov 2022
Location: It is season dependant.
Posts: 853
Default

Quote:
Originally Posted by Kheaven View Post
Lets consider that the instrument in kontakt has nothing to do with CC#32 with value of 127. There is no function associated with that. But still consumes equal amount of rt cpu when it is being played.
Have fun trying to see if the issue is related
to white or perhaps black keys...

https://forum.cockos.com/showthread.php?t=287071

😀😀😀😀
🎹🎹🎹🎹
F1308 is offline   Reply With Quote
Old 07-11-2024, 11:53 PM   #16
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 15,288
Default

Quote:
Originally Posted by Kheaven View Post
Lets consider that the instrument in kontakt has nothing to do with CC#32 with value of 127.
You actually don't know what is happening internally with a library. So this is just a guess.
mschnell is online now   Reply With Quote
Old 07-12-2024, 12:01 AM   #17
smandrap
Human being with feelings
 
smandrap's Avatar
 
Join Date: Feb 2021
Location: Right here
Posts: 1,940
Default

Quote:
Originally Posted by mschnell View Post
You actually don't know what is happening internally with a library. So this is just a guess.
If the KSP script is not password protected, you can peek into it and see if a CC is doing something. If it's not there and it doesn't show up as mapped in the midi automation tab, then yes, you know it's unused.
__________________
My Scripts
smandrap is offline   Reply With Quote
Old 07-12-2024, 01:29 AM   #18
F1308
Human being with feelings
 
F1308's Avatar
 
Join Date: Nov 2022
Location: It is season dependant.
Posts: 853
Default

See what arrives to Kontakt...

See what comes out from Kontakt...


😀😀😀😀
🎹🎹🎹🎹


FGM #MIDI Relator

Code:
//// START OF SCRIPT
//
// desc: FGM #MIDI Relator
//
// SCRIPT BY FGM USING AI
// 
// FGM #MIDI Relator
//
/**
 * 
 * This JSFX will:
 * 
 * 1. Log all incoming MIDI messages, including Note On, Note Off, and Control Change messages.
 * 2. Display the logged MIDI messages in real-time within the Reaper JSFX interface.
 * 3. Pass through all MIDI messages unchanged, ensuring that downstream plugins receive the original MIDI data.
 * 
 * Usage:
 * 
 * 1. Add this script to the track where you want to monitor MIDI messages.
 * 2. Open the FX chain window for the track and insert this JSFX.
 * 3. Click on the "Edit" button next to the JSFX plugin to open the interface.
 * 4. Play your MIDI instrument or send MIDI messages to the track.
 * 5. Observe the logged messages displayed in the JSFX interface to debug and analyze MIDI data.
 * 6. You can place this script either before or after a VST plugin (such as Kontakt) to monitor the incoming or outgoing MIDI messages respectively.
 */


slider1: 0<0,0,0{Click on the "Edit..." button above this slider to open the interface}> >>>>
slider2: 0<0,0,0{Observe the logged messages displayed}> >>

// Set MIDI input and output pins to none
in_pin:none // MIDI input pin
out_pin:none // MIDI output pin

// Define constants for MIDI message types
@init
NOTE_OFF = 8;  // MIDI note off message type
NOTE_ON = 9;   // MIDI note on message type
CC = 11;       // MIDI control change message type

// Initialize variables to store message data
msg_count = 0;
max_msgs = 100;

// Initialize an array to store MIDI messages
messages = max_msgs;

// Main processing loop
@block
while (
  // Wait for MIDI input
  input = midirecv(mpos, msg1, msg23);
  input ? (
    // Extract MIDI message data
    statusHi = (msg1/16)|0;
    statusLo = (msg1-(statusHi*16))|0;
    data2 = (msg23/256)|0;
    data1 = (msg23-(data2*256))|0;

    // Log the MIDI message
    messages[msg_count] = sprintf("%02X %02X %02X", msg1, data1, data2);
    msg_count = (msg_count + 1) % max_msgs;

    // Send the message through
    midisend(mpos, msg1, msg23);
  );
);

// Graphics code to display the logged messages
@gfx
gfx_clear = 0;
gfx_r = gfx_g = gfx_b = 1;

i = 0;
while (i < max_msgs) (
  j = (msg_count + i) % max_msgs;
  gfx_x = 10;
  gfx_y = 10 + i * 15;
  gfx_printf("%s", messages[j]);
  i += 1;
);

//
//// END OF SCRIPT

-----------------------------------------------------------------------------------------------
F1308 is offline   Reply With Quote
Old 07-12-2024, 01:56 AM   #19
smandrap
Human being with feelings
 
smandrap's Avatar
 
Join Date: Feb 2021
Location: Right here
Posts: 1,940
Default

@Kheaven, testing this with a single instance of Kontakt, force auto-bypass on silence, and no instrument inside kontakt, so only upkeep cost is considered. With no MIDI data, the cpu usage is 0 (as expected). But indeed, sending a single CC64 (or anything else really) bumps up cpu usage to 0.22%.

I can only guess this is by design, to "wake up" instruments on any input. Again, it's only a guess of course, but it makes sense in my book since if the plug is bypassed then it wouldn't be able to accept any input (?), so it has to wake up on input received to do its thing. Could someone more knowledgeable chime in on this please?

Btw, 90% RT cpu is pretty extreme, yeah.

Quote:
Originally Posted by F1308
FGM #MIDI Relator
ReaControlMidi exists
__________________
My Scripts
smandrap is offline   Reply With Quote
Old 07-12-2024, 05:13 AM   #20
F1308
Human being with feelings
 
F1308's Avatar
 
Join Date: Nov 2022
Location: It is season dependant.
Posts: 853
Default

Quote:
Originally Posted by smandrap View Post

ReaControlMidi exists
Thank you very much.

Have no time to explore, learn and use.

😀😀😀😀
🎹🎹🎹🎹
F1308 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 07:57 AM.


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