Gin
Loading...
Searching...
No Matches
VoicedStereoOscillator< O, P > Class Template Reference

Stereo oscillator with multiple voices for unison/detuning effects. More...

#include <gin_oscillators.h>

Public Member Functions

 VoicedStereoOscillator ()=default
void setSampleRate (double sr)
void noteOn (float phase=-1)
void noteOn (float phases[])
void process (float note, const P &params, juce::AudioSampleBuffer &buffer)
void processAdding (float note, const P &params, juce::AudioSampleBuffer &buffer)

Protected Attributes

juce::OwnedArray< O > oscillators

Detailed Description

template<typename O, typename P>
class VoicedStereoOscillator< O, P >

Stereo oscillator with multiple voices for unison/detuning effects.

VoicedStereoOscillator is a template class that wraps any oscillator type (O) and adds multi-voice capabilities with stereo spread, detuning, and panning. This creates rich, thick unison sounds commonly used in synthesizers.

Key Features:

  • Multiple voices (1 to N) for unison effects
  • Per-voice detuning with adjustable spread
  • Stereo panning and spread controls
  • Automatic gain compensation for multiple voices
  • Works with any oscillator type (template-based)

The voices are evenly distributed across:

  • Pitch range: controlled by detune parameter
  • Stereo field: controlled by spread parameter
  • Base position: controlled by pan parameter

Template Parameters:

Usage:

// Typically used via derived classes like BLLTVoicedStereoOscillator
// or WTVoicedStereoOscillator, but can be used directly:
osc.setSampleRate(44100.0);
osc.noteOn(); // Initialize all voices
params.voices = 4; // 4 voices for thick sound
params.detune = 0.15f; // Detune range in semitones
params.spread = 0.7f; // Stereo spread amount
params.pan = 0.0f; // Center pan
params.gain = 1.0f;
osc.process(60.0f, params, audioBuffer);
void process(float note, const P &params, juce::AudioSampleBuffer &buffer)
Definition gin_oscillators.h:209
void noteOn(float phase=-1)
Definition gin_oscillators.h:197
void setSampleRate(double sr)
Definition gin_oscillators.h:191
VoicedStereoOscillator()=default
float spread
Stereo spread amount (0.0 = mono, 1.0 = full stereo).
Definition gin_oscillators.h:135
float detune
Detune amount between voices (in semitones or cents).
Definition gin_oscillators.h:136
float gain
Overall gain/volume (0.0 to 1.0+).
Definition gin_oscillators.h:137
float pan
Stereo pan position (-1.0 = left, 0.0 = center, 1.0 = right).
Definition gin_oscillators.h:134
int voices
Number of voices (1-N for unison).
Definition gin_oscillators.h:133
Extended parameters for band-limited voiced stereo oscillator.
Definition gin_oscillators.h:267
See also
VoicedOscillatorParams, BLLTVoicedStereoOscillator, WTVoicedStereoOscillator

Constructor & Destructor Documentation

◆ VoicedStereoOscillator()

template<typename O, typename P>
VoicedStereoOscillator< O, P >::VoicedStereoOscillator ( )
default

Member Function Documentation

◆ setSampleRate()

template<typename O, typename P>
void VoicedStereoOscillator< O, P >::setSampleRate ( double sr)

References oscillators.

◆ noteOn() [1/2]

template<typename O, typename P>
void VoicedStereoOscillator< O, P >::noteOn ( float phase = -1)

References oscillators.

◆ noteOn() [2/2]

template<typename O, typename P>
void VoicedStereoOscillator< O, P >::noteOn ( float phases[])

References oscillators.

◆ process()

template<typename O, typename P>
void VoicedStereoOscillator< O, P >::process ( float note,
const P & params,
juce::AudioSampleBuffer & buffer )

References processAdding().

◆ processAdding()

template<typename O, typename P>
void VoicedStereoOscillator< O, P >::processAdding ( float note,
const P & params,
juce::AudioSampleBuffer & buffer )

References oscillators.

Referenced by process().

Member Data Documentation

◆ oscillators

template<typename O, typename P>
juce::OwnedArray<O> VoicedStereoOscillator< O, P >::oscillators
protected

The documentation for this class was generated from the following file: