For stepped random modulation, choose a new value at regular intervals and hold it between updates. This REAPER workflow uses a synthetic tone and a small custom JSFX gain effect to create random volume steps with an explicit duration and range.
The task is deliberately narrow: make one sustained tone change level unpredictably without continuously sliding between levels. The automatic method below requires copying a complete effect program once. A later section explains how to build an editable, repeating staircase with REAPER’s native automation envelopes.
What makes random modulation stepped?
Three choices determine the result: when a value changes, which new value is chosen, and how the effect moves to that value. For this workflow, the timing is regular, the level is pseudorandom, and the transition is immediate. Between updates, the gain remains constant.
An illustrative sequence might hold −15 dB for 250 milliseconds, jump to −9 dB for the next 250 milliseconds, then jump to −18 dB. Those numbers illustrate the behavior; they are not measurements or a promised output sequence.
REAPER’s parameter modulation system provides an LFO with controls for Speed, Strength, Phase, and direction. Its automation system separately provides Square envelope points. These are different tools: LFO speed controls modulation rate, while square envelope segments define held values between points. See chapters 18 and 19 of Up and Running: A REAPER User Guide.
The custom effect below makes the hold behavior explicit in its code. It processes stereo gain directly; it does not configure a universal stepped-random source for every other plug-in parameter.
Prepare a sustained synthetic tone
Start with an empty REAPER project and one track. Add ReaSynth to that track’s FX chain. REAPER documents ReaSynth as a synthesizer that can be played from MIDI items, so no recording or external sound file is needed. Its controls include output volume, sustain, and waveform mixes. The REAPER Cockos Effects Summary Guide, ReaSynth.
Use this simple source setup:
- Set the project tempo to 120 BPM and use a four-bar section in 4/4 time.
- Select the track and make a time selection covering those four bars.
- Choose
Insert→New MIDI Item. - Double-click the MIDI item to open the MIDI editor. Draw one note and extend its right edge across the item.
- In ReaSynth, start with
Volumearound −12 dB andSustainat 0 dB. LeaveSquare mix,Sawtooth mix, andTriangle mixat zero for a simple tone.
The MIDI item creation and editing workflow is documented in chapter 13 of the REAPER User Guide. The specific tempo, duration, and levels here are example settings, not application requirements.
Play the section before adding modulation. Confirm that the track produces a sustained tone. If it stops early, check the note length and sustain setting. The changing gain will be easier to assess when the source itself holds a steady level.
Add an effect that holds each random level
JSFX is REAPER’s built-in system for effects written as text programs. REAPER compiles them when loaded; this example needs no external programming library. Its structure follows the official JSFX Programming reference.
Open View → FX Browser. In the browser’s FX menu, choose Create new JS FX and give the effect a distinct name, such as Stepped Random Gain. Open its source using Edit JS FX, replace the starter contents with the complete program below, and save it. These creation and editing commands are documented in section 16.16 of the REAPER User Guide.
desc:Stepped Random Gain
slider1:250<20,2000,1>Step duration (ms)
slider2:-18<-60,0,0.1>Level endpoint A (dB)
slider3:-6<-60,0,0.1>Level endpoint B (dB)
in_pin:Left
in_pin:Right
out_pin:Left
out_pin:Right
@init
remaining = 0;
gain = 1;
@slider
interval_samples = max(1, floor(srate * slider1 / 1000 + 0.5));
low_db = min(slider2, slider3);
high_db = max(slider2, slider3);
remaining = 0;
@sample
remaining <= 0 ? (
level_db = low_db + rand(1) * (high_db - low_db);
gain = 10 ^ (level_db / 20);
remaining = interval_samples;
);
spl0 *= gain;
spl1 *= gain;
remaining -= 1;
This is a complete stereo audio effect, not a fragment. Add it after ReaSynth in the track’s FX chain. Clear any FX-browser search filter if its name is not visible.
The program uses rand(1) to obtain a pseudorandom value and maps that value between the two dB endpoints. The language’s conditional syntax, exponent operator, and random function are documented in JSFX Programming Reference — Language Essentials.
The counter uses srate, REAPER’s current sample rate. Each sample passes through the same stored gain until the counter expires. Both channels receive that gain, so the effect does not independently randomize their levels. REAPER documents srate, spl0, and spl1 in JSFX Programming Reference — Special Variables.
The program was inspected against those references. Its counter arithmetic was also checked separately at 44.1 and 48 kHz; the JSFX itself was not executed in REAPER for this article.
Set the step duration and level range
Start with Step duration (ms) at 250, Level endpoint A (dB) at −18, and Level endpoint B (dB) at −6. These settings select a new attenuation value four times per second. Every selected value lasts for the full interval unless you change a control.
The endpoints specify gain applied after the synthesizer. They are not target output-meter readings. For example, −6 dB corresponds to a sample multiplier of about 0.501, while −18 dB corresponds to about 0.126. The source signal and subsequent track processing still determine the final output.
| Desired behavior | Example setting | What changes |
|---|---|---|
| Slow, distinct plateaus | 1,000 ms | One new level per second |
| Moderate stepping | 250 ms | Four new levels per second |
| Faster stepping | 125 ms | Eight new levels per second |
| Smaller level differences | Endpoints −9 and −6 dB | A narrower selection range |
| Constant attenuation for comparison | Both endpoints −6 dB | Every selection produces the same gain |
At 120 BPM, an eighth note lasts 250 milliseconds: 60 seconds divided by 120 beats, then divided by two. This is a worked timing calculation. The supplied effect uses milliseconds and does not follow tempo changes or align its steps to the project’s musical grid.
The endpoints can be entered in either order because the program sorts them. Changing any slider starts a fresh interval on the next processed sample. The random level is held without interpolation, although two consecutive selections can happen to be close together.
Build an editable repeating staircase instead
Use an automation envelope when you want exact values at exact timeline positions. This is also the supported native route for applying held changes to an exposed effect parameter. REAPER documents parameter envelopes and the Square point shape in chapter 18 of its User Guide.
For a fixed volume pattern, bypass the custom JSFX first. Open the track’s envelope controls and display its Volume envelope. Keep the track in Trim/Read while editing manually.
Create points at 250-millisecond intervals using Shift-click, then move them to irregular levels. Right-click a point and use Set Point Shape → Square. Apply that shape to every point whose outgoing segment should hold its value. The envelope should show horizontal plateaus followed by vertical changes.
For another effect’s parameter, touch the desired control and choose Param → Show track envelope. Add and shape points on that envelope instead. The parameter-menu workflow is described in The REAPER Cockos Effects Summary Guide.
Manually placing irregular values creates a fixed pattern; it does not generate new random values on each playback. To reuse it, select its time range, right-click the envelope, and choose Automation items → Insert new automation item. REAPER supports looping automation items and pooled copies whose edits propagate to other copies. REAPER User Guide, Automation Items.
Troubleshoot smooth movement, missing changes, and repeatability
If the envelope still slopes, inspect the outgoing point shape. Linear creates a ramp; Square creates the held segment needed here. A square LFO and a manually drawn multi-level staircase also serve different purposes: simply alternating two levels does not create an arbitrary sequence of levels.
If the custom effect produces no obvious changes, confirm that it follows ReaSynth, that it is enabled, and that the endpoints differ. Try 1,000-millisecond steps with endpoints −24 and −6 dB to make the structure easier to inspect. Then return to the range your project needs.
Abrupt gain changes can introduce clicks because the sample multiplier changes immediately. This program intentionally contains no smoothing. Smaller level differences can reduce the size of those discontinuities, but they do not guarantee click-free output. Adding a transition ramp would change the exact immediate-step behavior.
The effect is designed for a stereo track and modifies only its first two audio channels. It does not write automation points, save a chosen random sequence, quantize values to a small set of levels, or provide tempo synchronization. REAPER normally runs a JSFX @init section when playback starts; this program resets its counter there. Do not rely on it to reproduce the same random sequence after restarting. JSFX code-section reference.
Use the custom gain effect when you want automatically generated held levels. Use square automation when you want to edit, repeat, and preserve particular changes. Both approaches let the synthetic tone move through distinct plateaus; choosing between them depends on whether fresh values or an exact timeline pattern matters more.
Sources
- Up and Running: A REAPER User Guide v7.84 — REAPER / Geoffrey Francis.
- The REAPER Cockos Effects Summary Guide — REAPER / Geoffrey Francis.
- JSFX Programming — Cockos.
- JSFX Programming Reference — Language Essentials — Cockos.
- JSFX Programming Reference — Special Variables — Cockos.