Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easy patch to drastically reduce CPU overhead of trigSeq(64) and and voldSeq #51

Open
Stubs42 opened this issue Apr 19, 2021 · 0 comments

Comments

@Stubs42
Copy link

Stubs42 commented Apr 19, 2021

Hi,

did a patch in my sandbox to reduce the cpu overhead of your sequencers when running on external clock.
This was neccessary for me because I like trigSeq64 very much but with more than 10% CPU usage it rendered no longer usable for my patches. With the performance patch I implemented, trigSeq64 now uses less than 1 % CPU without running in any issue yet.

The code changes are Module_trigSeq.cpp and Module_voltSeq.cpp in their process() method:

. . .
if (!initialized)
        return;

// adapt the lightLambda used to calculate step light fading
// because the process is executed completely only every 32nd time
if (inputs[EXT_CLOCK_INPUT].isConnected())
        lightLambda = 0.05 / IDLESKIP;
else
        lightLambda = 0.05;
 idleCnt = (idleCnt + 1) % IDLESKIP;
 double newExtTrg = inputs[EXT_CLOCK_INPUT].getVoltage();
 // return if not each 32th sample, ext clk is connected and the trigger input did not change
 if (idleCnt != 0 && inputs[EXT_CLOCK_INPUT].isConnected() && newExtTrg == extTrg) {
        return; // return if idle to reduce cpu time
}
// save old ext trigger input state to detect change
extTrg = newExtTrg;

bool gOn = true;
bool pulse = false;
. . .

and in TSSequencerModuleBase.hpp:

. . .
// If this was loaded from a save, what version
int saveVersion = -1;
// removed conts to allow changing depending on ext clk connect state
float lightLambda = 0.05;
// The number of structured random patterns to actually use. 
// Should be <= TROWA_SEQ_NUM_RANDOM_PATTERNS.
int numStructuredRandomPatterns = TROWA_SEQ_BOOLEAN_NUM_RANDOM_PATTERNS;

// defines and global variables used by my hack 
#define IDLESKIP 32
int idleCnt = -1;
double extTrg = 0;

//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
. . .

See also https://community.vcvrack.com/t/trowasoft-trigseq-and-voltseq-performance/13082

Would be great if you would include this patch in your code line or implement a similar patch.

Regards
Dieter

@Stubs42 Stubs42 changed the title Easy patch to drstically raise performance of trigSeq(64) and and voldSeq Easy patch to darstically reduce CPU overhead of trigSeq(64) and and voldSeq Apr 19, 2021
@Stubs42 Stubs42 changed the title Easy patch to darstically reduce CPU overhead of trigSeq(64) and and voldSeq Easy patch to drastically reduce CPU overhead of trigSeq(64) and and voldSeq Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant