Ruina Module — Stereo Distortion Processor
Three distortion algorithms designed for the Ruina Versio character: hard clipping with asymmetric wavefolding, gated distortion (Ruina v2), and multiband compression with bit crushing. Stereo width parameter applies different drive/fold amounts to each channel.
Available as a send effect in the sequencer (Ruina card in the master collapsible section, Snd tab per-sound send fader).
Signal Flow
input (mono send sum)
→ ChannelSplitter(2)
├→ L: driveGain → clipWaveshaper → foldGain → foldWaveshaper → gateWaveshaper → crushWaveshaper → levelGain
└→ R: driveGain(×width) → clipWaveshaper(×width) → foldGain(×width) → foldWaveshaper(×width) → gateWaveshaper(×width) → crushWaveshaper → levelGain
→ ChannelMerger(2) → wetGain → output
dry path ──────────────→ dryGain → output
Parameters
| Param | Range | Default | Description |
|---|---|---|---|
ruinaMode |
ruina/ruina2/comp | ruina | Distortion algorithm |
ruinaDrive |
0–1 | 0.5 | Input gain before clipping |
ruinaFold |
0–1 | 0 | Wavefolding depth |
ruinaCrush |
0–1 | 0 | Bit reduction (4–16 bits) |
ruinaMix |
0–1 | 0.5 | Wet/dry blend |
ruinaWidth |
0–1 | 0.5 | Stereo separation (L/R channel difference) |
Modes
Ruina
Asymmetric hard clipping using tanh with different positive/negative scaling
(×0.7 vs ×1.3). The fold parameter adds sine-based wavefolding for aggressive,
metallic textures. drive controls input gain before the clip stage.
Ruina v2
Same clip + fold as Ruina, but with a noise gate that drops the signal to zero
when the input amplitude is below drive × 0.3. Creates the signature gated,
chopped sound.
Comp
OTT-style compression (split into 3 bands, each band compressed) combined with
bit crushing. fold acts as compression ratio makeup gain. crush sets bit
depth via quantised waveshaper curve.
Stereo Width
L channel uses drive × (1 − width/3) and fold × (1 − width/3).
R channel uses drive × (1 + width/3) and fold × (1 + width/3).
At width = 0 both channels are identical (mono). At width = 1, L gets
~67% and R gets ~133% of the nominal parameter values.
Curve Generation
| Curve | Function | Description |
|---|---|---|
buildHardClipCurve(drive) |
Asymmetric tanh | Positive clips softer than negative |
buildFoldCurve(amount) |
sin(x × π × (1 + amount × 5)) scaled |
Sine-based wavefolder |
buildCrushCurve(bits) |
Quantised levels 2^(4 + bits × 12) |
Bit crusher |
buildGateCurve(threshold) |
Zero below threshold, pass above | Noise gate |
Exports
| Export | Signature | Purpose |
|---|---|---|
paramDefs |
— | UI param definitions (6 params, ruinaMode as pills) |
build |
(ctx, engine) |
Create stereo processor chain, returns { input, output, nodes } |
update |
(nodes, engine) |
Update curves and gains from engine params |
Integration
As sequencer send FX
The Ruina is wired in ensureMasterBus alongside reverb:
engine._ruinaInput = ac.createGain()
engine._ruinaNode = ruinaMod.build(ac, engine)
engine._ruinaInput → engine._ruinaNode.input
engine._ruinaNode.output → ChannelSplitter(2) → _limSumL / _limSumR
Per-sound send level is controlled via sound.sends.ruina (set in Snd tab).
As a processor module
Can be added to any engine's modules array, but designed primarily as a
master send FX.
Files
| File | Purpose |
|---|---|
modules/ruina.js |
Module implementation (193 lines) |
sequencer-audio.js |
Master bus wiring (ensureMasterBus) |
sequencer-ui.js |
Master section Ruina card + Snd tab slider |
sequencer.js |
_playNote ruina send routing |
See Also
docs/synth/sequencer.md— master section, send FXdocs/synth/sequencer-audio.md— stereo master bus