Envelope

class Envelope(attackPerSecond: Float = 14.0f, releasePerSecond: Float = 2.4f, initial: Float = 0.0f)

Rises fast and falls slowly, which is what the bars in every music player do.

Both rates are in units per second rather than per frame, so it looks the same at 60 Hz and at 120 Hz. That matters more than it sounds: rates per frame would make it twice as twitchy on a fast display.

Constructors

Link copied to clipboard
constructor(attackPerSecond: Float = 14.0f, releasePerSecond: Float = 2.4f, initial: Float = 0.0f)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun advance(target: Float, deltaSeconds: Float): Float
Link copied to clipboard
fun hit(amount: Float)

Lifts the value immediately, for an onset that should be felt at once.

Link copied to clipboard
fun reset(to: Float = 0.0f)