Optimization: Stream connections

Stream

Audio Off=Shutoff

Here’s a trick to shut off an effect when the audio stream isn’t on (eg no notes playing). For convience, we will chop premade modules. Inside the Stereo Chorus effect, remove the On/Off switch from the Switch module. Connect an In to the bool on the Switch, so we can turn it on & off from the outside. I riped out some guts from SM’s Mono Readout module, and connected everything like so:
The Boolean connected to the Graph to Float is optional (to give a visual), and the Tick25 may be replaced by a Tick100 or what have you.
This example hack saved about 3% CPU on my Athlon64 3000 while idol. In your schematic, be careful of where you connect the Poly/Mono to Float reader, because you may shut off the effect too soon, say chop off the tail of a reverb. Note This will only detour around the effect’s code, providing a pass-through for the signal. You must always have a connection to the audio-out stream for this to work. If you don’t want to, then you must provide a manual switch for it.

Poly instead of Mono

Mono signals are always running, so avoid the use of a Mono path as much as you can.
Avoid this if possible:

Optimized, going from 1.2% (without sound playing), to 0.8% after optimization, 33% reduction:

Mono4 instead of left and right

Use Pack and Unpack with just one Stream code sequence instead of using twice the mono code. before…


..after! Inside the Filter module, I removed half (the “Right” channel) of the code, & had to manually change some connectors to Mono4. Not quite 50% CPU savings, since Pack & Unpack use CPU, but close.

Reduce ASM

Keep in mind SM’s smaller listing of available opcodes (as of 1.0.9).

Forum Topics

user_creations/optimization/stream_data.txt · Last modified: 2009/11/15 21:30 by infuzion