fsh::stk
fantastic spatial holophonic synthesis toolkit
Loading...
Searching...
No Matches
fsh::synth::Oscillator Class Reference

Represents a single band-limited oscillator with multiple waveforms. More...

#include <Oscillator.h>

Classes

struct  Params
 Oscillator parameters. More...
 

Public Types

enum class  Waveform {
  TrueSaw , TrueTriangle , Square , Sine ,
  Saw , Noise , Triangle
}
 Waveform. More...
 

Public Member Functions

void setSampleRate (double sampleRate)
 Set the sample rate in Hz.
 
void setFrequency (double)
 Set the oscillator's frequency.
 
void setParams (const Params &)
 Set the oscillator's parameters.
 
auto nextSample () -> float
 Compute the oscillator's next sample.
 
void reset ()
 Reset the oscillator's phase/freq/amplitude to zero.
 

Detailed Description

Represents a single band-limited oscillator with multiple waveforms.

Before using

Set the sample rate using setSampleRate() and set the oscillator's parameters using setParams().

To use

‍This class is loosely based on code from the JX10 synthesizer by Matthijs Hollemans.

Member Enumeration Documentation

◆ Waveform

Waveform.

The GUI picker relies on the specific ordering of these values, so be very careful when changing it.

Enumerator
TrueSaw 

True sawtooth wave with alternating sign harmonics.

TrueTriangle 

True triangle wave with alternating sign harmonics≤

Square 

Square wave.

Sine 

Sine wave.

Saw 

Sawtooth wave with all positive positive harmonics.

Noise 

White noise.

Triangle 

Triangle wave with all positive harmonics≤


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