theallelectricsmartgrid

Sub Oscillator

The sub oscillator is a per-voice, mono signal path that runs one octave below the main pitch and is mixed alongside each voice before the global mixdown. It is always driven by the current voice pitch (even in Physical Modeling mode), but only becomes audible when the amp section enables it.

Signal Path

  1. Per-voice oscillator: Each SquiggleBoyVoice owns a VCO that generates a sine at baseFreq / 2 (one octave down) on every audio sample. The base frequency is always set in the voice input (m_subInput.m_baseFreq).
  2. Amp-section shaping: The sub signal runs through a per-voice tanh saturator and low-pass filter inside the amp section before it is added to the mix.
  3. Mono injection: The amp section produces a m_subOut mono signal per voice, which is injected into the mixer as monoIn.

Mono Mixing and Saturation

The sub oscillator stays mono by design, but it is saturated alongside the main voice:

Unison Behavior

When unison is active, only the unison master voice is allowed to trigger the sub:

This keeps a single, coherent sub in unison modes rather than stacking multiple sub oscillators on the same pitch.

Key locations in the codebase: