Skip to content

Ring Modulator

Tier: Primitives | ComponentType: 16 | Params: 5

Ring modulation and amplitude modulation with internal carrier oscillator.

Overview

RingModulator multiplies the input signal by an internal carrier oscillator. In ring modulation mode, the multiplication produces sum and difference frequencies — the classic metallic, inharmonic sound used in sci-fi effects and experimental music. In AM mode, the carrier modulates the input's amplitude envelope without creating new sum/difference partials, producing a tremolo-like effect at low frequencies and sideband tones at audio rate.

The carrier oscillator supports sine, triangle, square, and sawtooth waveforms. At sub-Hz carrier frequencies, both modes produce amplitude variation; at audio-rate frequencies, the distinction between ring mod (bilateral multiplication) and AM (unipolar modulation) becomes clearly audible.

File Locations

Path
Header Sources/FolioDSP/include/FolioDSP/Primitives/RingModulator.h
Implementation Sources/FolioDSP/src/Primitives/RingModulator.cpp
Tests Tests/FolioDSPTests/RingModulatorTests.swift
Bridge Sources/FolioDSPBridge/src/FolioDSPBridge.mm (RingModulatorBridge)

Parameters

Index Name Description Min Max Default Min Default Max Default Unit
0 Carrier Freq Carrier oscillator frequency 0.1 20000.0 50.0 2000.0 440.0 Hz
1 Waveform Carrier waveform: 0=Sine, 1=Tri, 2=Square, 3=Saw 0.0 3.0 0.0 3.0 0.0
2 Depth Modulation depth 0.0 100.0 0.0 100.0 100.0 %
3 Mode 0=Ring Modulation, 1=Amplitude Modulation 0.0 1.0 0.0 1.0 0.0
4 Mix Dry/wet blend 0.0 100.0 0.0 100.0 100.0 %

Processing Algorithm

1. Generate Carrier

The internal oscillator ticks at the carrier frequency:

\[c = \text{osc}(\phi_c)\]

2. Ring Modulation (mode = 0)

\[y_{\text{mod}} = x \cdot c \cdot \frac{d}{100}\]

Bilateral multiplication creates sum and difference frequencies: \(f_{\text{in}} \pm f_c\).

3. Amplitude Modulation (mode = 1)

\[y_{\text{mod}} = x \cdot \left(1 + \frac{d}{100} \cdot c\right)\]

Unipolar modulation preserves the original frequency plus sidebands.

4. Dry/Wet Mix

\[y = x \cdot (1 - m) + y_{\text{mod}} \cdot m\]

Snapshot Fields

Field Type Range Unit Description
Carrier Freq Float 0.1–20000 Hz Current frequency
Carrier Phase Float 0–1 Normalized phase
Depth Float 0–100 % Modulation depth
Waveform Uint8 0–3 Active waveform
Mode Uint8 0–1 Ring/AM mode
Input Level Float 0–1 Smoothed input
Output Level Float 0–1 Smoothed output
Mod Amount Float -1–1 Instantaneous modulation value

Implementation Notes

  • Carrier is an internal Oscillator instance (reuses the Oscillator component)
  • Level tracking uses exponential smoothing (α = 0.01) for display
  • At sub-Hz carrier frequencies, both modes produce LFO-style amplitude variation
  • Carrier waveform selection: square produces hard on/off gating, saw produces asymmetric modulation

Equation Summary

y = x · (1 + depth·osc(f))