Conditional Execution with Macro Modules

A serious problem with many SoftSynths and SoftSynth-like composing programs comes to light only when you are well into a very large project: while things worked great with only a few dozen modules, when you start connecting hundreds of modules, the CPU load goes up to max, and the patch fails.

A very few have the ability to shut down sections not needed at any particular moment in such a way that the CPU does not see them and thus a patch of hundreds or even thousands of modules can be set up to take only the resources of a few dozen modules at any one time. ArtWonk/MusicWonk can do this.

The trick is to use Macro modules to encapsulate the sections you will be turning off and on. Macro modules, when set to not run, take up virtually no processing time. You can have hundreds, even thousands of them without loading down the CPU - as long as only a few dozen are active at any one time.

Macro modules have 3 ways to do this, the 3 Exec options in the Macro Properties: on Change, on Strobe, and Loop.

When a Macro is set to execute on Change or Strobe, nothing inside the macro will be processed except at the tick in which the input changes when set to on Change, or the leading edge (the start of the On cycle) when set to on Strobe. For a Loop macro, when the Loop number input is set to 0, nothing inside the macro is processed.

There is one subtle difference between the Loop macro and the other two. Both the Change and the Strobe macros only execute once, during the one tick that the condition is met. But a Loop macro will execute continuously while its input is non zero. This means you can't just put a clock strobe into the loop input of a Loop macro, as you can in a Strobe macro, and expect the Loop macro to execute only once when the clock ticks; as long as the input is held to 1 - which will be controlled by the Clock Dur and %On inputs, the Loop macro will continue to execute exactly as if it were set to Always. Only on the Off part of the clock will the Loop macro will shut down.

For this reason, it is often useful to place a Loop macro inside a Strobe or Change macro. So, for example, if you want the Loop macro to execute some process 10 times exactly at the start of some event, set a Strobe or Change macro to trip on the event, then put a Loop macro inside, and have it set to a Loop count of 10. Then when the event trips, the Strobe or Change will execute once, meaning the Loop macro inside it will execute once; and all modules within the Loop macro will execute 10 times during the one event tick.

[Return to Tutorial Page]