Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

DynamicsModulator

File: Rhapsodist/Processors/DynamicsModulator.js.

Important

This is a Script Time Variant Modulator, not a MIDI processor.

Overview

A Midi Controller-style smoothing modulator driven by note velocity as well as CC.

Below Value’s threshold, output eases toward roughly half the note’s velocity. Above it, output eases toward a point above Value.

Both approach that “snap” target over Attack, then ease back toward Value at independent SmoothUp/SmoothDown rates, optionally reshaped by a response table.

Legato/tied notes skip the snap, so retriggering an already-held note doesn’t produce a hard step.

Parameters

IDDescription
AttackTime to ease towards the snap target, 0–500 ms.
SmoothUp / SmoothDownRate at which output eases back towards Value once the snap target is reached, 0–2000 ms. Which one applies is chosen each sample by comparing current output to Value, not by which branch triggered the snap.
Value0–127. Both the resting target and the velocity threshold that decides whether a note’s snap target sits above or below it.
ResponseTableOptional response table that reshapes the final output value every sample (x-axis = normalised output 0-1, y-axis = shaped output 0-1), the same way the built-in Midi Controller modulator shapes its CC value.

Usage

Add a Script Time Variant Modulator to a sound generator’s gain modulation chain or as a global modulator, load this script into it and connect a UI control to the Value parameter.

Internal Reference

FunctionDescriptionReturns
updateSmootherCoefficients()Recomputes the one-pole smoothing coefficients for Attack, Smooth Up, and Smooth Down from their millisecond knob values. Called whenever any of those knobs changes.—
timeToCoefficient(timeMs)Converts a time in milliseconds to a one-pole filter coefficient at the modulator’s control rate.number