[continue autosave] Learn Sporth
log in learn new browse

Gates and Triggers

All about the trigger

Triggers are a very important part of the Sporth ecosystem. They are a convention inspired by supercollider as well as the eurorack modular synth community.

A single trigger is exactly one sample that is a non-zero value (typically, this value is just a '1'). Since everything in Sporth is sample accurate, triggers are sample accurate and can work at audio rate.

Trigger-based signals feed into trigger-based ugens to generate signals. Some of these ugens include:

To generate trigger signals, a few ugens are available:

All about the gate

A gate is a unipolar, steady state-based signal that is either 0 or 1. These aren't as commonly used as triggers, but they are still used in some ugens that utilize gates:

Gates are signals that can be multipled directly with other signals. They are very useful for things like reverb throws. You can also make a decent makeshift envelope putting a gate through a portamento filter to smooth out the edges:

 1 metro tog 0.01 port

A 1Hz metronome object is being fed into a toggle generator, whose value is going between 1 and 0 every second. This creates a gate signal which is then fed into the portamento filter, whose half time value is 10ms. The portamento filter (a simple one pole smoothing filter), creates the ideal exponential curves for envelope, with a convex exponential slope on the attack, and a concave exponential slope on the release. The "adsr" and "tenvx" ugens have been meticulously built and rebuilt to show these curves using this method. (You would be surprised how many envelope implementations I've seen that mess this up. Csound gets it wrong, as do most of the Eurorack modules!)

There are few ways to generate gate signals in Sporth:

Gate signals come into play more with APIs and other software, as gates are easier to make than one-sample trigger signals. Using gate with a thresh hold generator is often a good approach.

Previous: Stack Operations | Back | Next: F-Tables

Compile & play Stop audio