Battling Cpu another scenario

Studiowaves Member Posts: 414 Advisor
edited March 2022 in Building With Reaktor

After going crazy figuring this out I thought I'd pass it on. This module attaches to an XR gate the can shut down and envelope generator when it's output is 60 db down. The objective was to shut the envelope generator down when the release phase reached -60 db. Regardless of whether the input midi gate was on or off.

As shown the feedback from the operators z-1 fbk enters into the middle input. The sensing circuitry for it produces a 0 at FBG when the output of the env gen falls -60db, or .001.

The bottom On Off is a master switch from a panel button 0 off 1 on. Simple enough.

The top input "from midi in gate" attaches to a midi gate.

The logic is setup to hold the external XR gate on once the gate is turned on or initiated by the midi gate. But once the external XR gate is triggered it must not be stopped with a note off. If you do stop it there is no release phase. That's what made this a tough one right there.

This a broader view of the system.

See the 3 inputs labeled G FBgate and OP2. This is the above module. The external z-1 is on the output on the top right. In reality the FB gate is internally attached the sensing gate (GT) as shown below. I only put it inside the top picture for clarity.

There's no point explaining this module, only to show that the z-1 fbk is attached to the env gen final output. The system works the same with or without the Dup Filter or the latch.

This is the actual front module, The actual gate (GT) is shown above.

When the XR gate shuts the system down the final output is .001 or -60 db. As a side note the external Clk Gen underclocks the entire system. That's a different story but it works well when a fast attack is not needed. So it also save's cpu when it's not needed. Just another way of battling CPU. Hope it makes sense

One final note, the XR gate on/off travels further downstream into the final audio output to a multipliers which switches the final .001 value to 0. Personally I can't hear 60 db down and the click is transparent. Also in this system there is a final low pass filter at the end that further slows the transition down from -60db to off.



  • colB
    colB Member Posts: 674 Guru
    edited March 2022

    Seems very complicated?

    Here's a simple approach that maybe does the same thing

    The only 'trick' here is that the envelope state OBC has been externalised at the input of the envelope, but that is a really easy mod, it's literally just adding some OBC input ports and wiring them up (they have to be set to 64bit).

    Any oscillator or whatever else running on the SR clock at this level or lower will be turned off when there is no gate and the env level is below threshold (threshold is fairly high here for testing, better much lower to avoid glitches, and to ensure that the resting state of 'off' outputs is always near zero - otherwise extra logic would be required to explicitly sent a zero value to voices being switched off (easy enough to do, but complicates the code and obscures the clarity of the example)

    One thing to look out for is the difference between '..SR' and 'SR'.

    '..SR', '..SR.C' etc. with those two leading dots, explicitly taps the clock bundle form the parent level in the hierarchy, so can be running even when we switch off SR at the current layer/level of the structure

    The counter/dbg section was just me setting up a debug visualisation just for sanity checking to make sure the clock was being switched off - it was!

  • Studiowaves
    Studiowaves Member Posts: 414 Advisor

    Sanity is a sense of conformity. When you get this deep into logic all hell can break loose. lol

    What you did there seems to be functionally identical but as usual a much better approach. There is no need for the z-1 fbk using the obc connection. Hmm, very resourceful I must say. Other than that the logic is virtually identical with the two comparators directing the clock itself into the merge. I was using events to turn off the XR gate which does the same thing. So it appears to be logically equivalent, meaning it lets the generator finish its release phase. The XR gate sends out a reset command though, did you check this to be sure it restarts properly?

    I noticed the 64 bit output values so I see the need for the external obc read module. That's one of things that will drive you batty because logically it should work yet it doesn't. So, good find there!

    The magic of the merge has come thru with flying colors again. Without the merge function I seriously don't think it's possible.

    Well cool, that's pretty slick. In my application I plan on monitoring the cpu usage and as it approaches the limits I'll start raising the -60db threshold. It's FM12 and stepping on the sustain pedal can really add up the voices. I'm hoping to minimize brute force voice stealing by adding more voices and gating the fading voices. It's the type of thing that you might not notice if that many voices are going at one time. So in a sense its a form of cpu compression.

    Thanks again, for expert advise. Also this gating technique with the merge has many good uses. Another good use is gating audio inputs. Any envelope generator can fade out an unused microphone when the vocalist stops singing but without this feedback solution it's hard to avoid a choppy threshold. This allows a few more milliseconds of guaranteed off time as it ignores incoming events until it's done. So who's in control here. lol

    Talk later, I'll see if I can implement your method as it's appears more robust. Nice!!!

Back To Top