SF syn.fun
← functions FUNCTION JS

beatGate

A tiny onset gate with adjustable decay for snapping events into motion.

#audio-reactive#beat

This is a cheap building block for turning threshold crossings into a value that can linger for a few frames.

export function beatGate(level, threshold, last, decay = 0.9) {
  if (level > threshold) {
    return 1;
  }

  return last * decay;
}
submitted by
@ogcraig
author
ogcraig
source
Submitted directly
license
MIT
Related · #audio-reactive