DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
dspark::synthesizer Namespace Reference

Synthesizer's sample-type-independent vocabulary: choice values, parameter ids and the parameter table. More...

Namespaces

namespace  table
 

Classes

struct  ParamInfo
 Description of one parameter (the shape of the plugin layer's parameter declarations, so a host can map them one to one). More...
 

Enumerations

enum class  Engine { Analog , Fm , Wavetable }
 
enum class  VoiceMode { Poly , Mono , Legato }
 
enum class  GlideMode { Always , Legato }
 
enum class  PhaseMode { Reset , Random }
 
enum class  OscWave { Sine , Triangle , Saw , Pulse }
 
enum class  SubWave { Square , Triangle , Sine }
 
enum class  FilterType {
  Off , LadderLp24 , LadderLp12 , LadderBp12 ,
  LadderHp24 , SvfLp , SvfHp , SvfBp ,
  SvfNotch
}
 
enum class  LfoMode { Free , Retrigger }
 
enum class  ModSource {
  None , Velocity , ReleaseVelocity , Key ,
  ModWheel , Pressure , PitchBend , Expression ,
  Breath , Lfo1 , Lfo2 , Env1 ,
  Env2 , Env3 , Random
}
 Modulation sources (values: velocity, pressure, wheel, expression and breath 0..1; key (key - 60) / 60; bend, LFOs and random -1..1; envelopes 0..1). More...
 
enum class  ModDest {
  None , Pitch , Osc1Pitch , Osc2Pitch ,
  Osc3Pitch , Osc1Level , Osc2Level , Osc3Level ,
  SubLevel , NoiseLevel , SampleLevel , PulseWidth ,
  WtPosition , Wt1Position , Wt2Position , Op1Level ,
  Op2Level , Op3Level , Op4Level , FmFeedback ,
  Cutoff , Resonance , Amp , Pan ,
  Lfo1Rate , Lfo2Rate
}
 Modulation destinations. OscN Pitch and OscN Level reach analog oscillator N and wavetable oscillator N; FM operators have their own. LFO Rate acts on retriggered LFOs only (a free LFO is shared by every voice) and sees an LFO source one control period late. More...
 
enum class  Param : int {
  Engine , VoiceMode , Polyphony , Glide ,
  GlideMode , BendRange , Unison , UnisonDetune ,
  UnisonSpread , Drift , Seed , PhaseMode ,
  MasterVolume , MasterTune , Oversampling , Osc1Wave ,
  Osc1Level , Osc1Octave , Osc1Semitone , Osc1Fine ,
  Osc1PulseWidth , Osc1Sync , Osc2Wave , Osc2Level ,
  Osc2Octave , Osc2Semitone , Osc2Fine , Osc2PulseWidth ,
  Osc2Sync , Osc3Wave , Osc3Level , Osc3Octave ,
  Osc3Semitone , Osc3Fine , Osc3PulseWidth , Osc3Sync ,
  SubLevel , SubOctave , SubWave , NoiseLevel ,
  SampleLevel , SampleOctave , SampleSemitone , SampleFine ,
  SampleKeyTrack , FmAlgorithm , FmFeedback , Op1Ratio ,
  Op1Detune , Op1Fixed , Op1Frequency , Op1Level ,
  Op1Velocity , Op1KeyScale , Op1Attack , Op1Decay ,
  Op1Sustain , Op1Release , Op2Ratio , Op2Detune ,
  Op2Fixed , Op2Frequency , Op2Level , Op2Velocity ,
  Op2KeyScale , Op2Attack , Op2Decay , Op2Sustain ,
  Op2Release , Op3Ratio , Op3Detune , Op3Fixed ,
  Op3Frequency , Op3Level , Op3Velocity , Op3KeyScale ,
  Op3Attack , Op3Decay , Op3Sustain , Op3Release ,
  Op4Ratio , Op4Detune , Op4Fixed , Op4Frequency ,
  Op4Level , Op4Velocity , Op4KeyScale , Op4Attack ,
  Op4Decay , Op4Sustain , Op4Release , Wt1Bank ,
  Wt1Position , Wt1Level , Wt1Octave , Wt1Semitone ,
  Wt1Fine , Wt2Bank , Wt2Position , Wt2Level ,
  Wt2Octave , Wt2Semitone , Wt2Fine , FilterType ,
  FilterCutoff , FilterResonance , FilterDrive , FilterKeyTrack ,
  FilterEnvAmount , FilterVelocity , AmpVelocity , AmpPan ,
  Env1Attack , Env1Decay , Env1Sustain , Env1Release ,
  Env1Curve , Env2Attack , Env2Decay , Env2Sustain ,
  Env2Release , Env2Curve , Env3Attack , Env3Decay ,
  Env3Sustain , Env3Release , Env3Curve , Lfo1Shape ,
  Lfo1Rate , Lfo1Sync , Lfo1Division , Lfo1Delay ,
  Lfo1FadeIn , Lfo1Phase , Lfo1Mode , Lfo2Shape ,
  Lfo2Rate , Lfo2Sync , Lfo2Division , Lfo2Delay ,
  Lfo2FadeIn , Lfo2Phase , Lfo2Mode , Mod1Source ,
  Mod1Via , Mod1Destination , Mod1Amount , Mod2Source ,
  Mod2Via , Mod2Destination , Mod2Amount , Mod3Source ,
  Mod3Via , Mod3Destination , Mod3Amount , Mod4Source ,
  Mod4Via , Mod4Destination , Mod4Amount , Mod5Source ,
  Mod5Via , Mod5Destination , Mod5Amount , Mod6Source ,
  Mod6Via , Mod6Destination , Mod6Amount , Mod7Source ,
  Mod7Via , Mod7Destination , Mod7Amount , Mod8Source ,
  Mod8Via , Mod8Destination , Mod8Amount , Count
}
 Every parameter, in the order of the parameter table. More...
 

Functions

constexpr bool tableIsConsistent () noexcept
 True when the table is in Param order, ids are unique and every default lies in its range.
 
int findParam (std::string_view id) noexcept
 Index of the parameter with this id, or -1.
 

Variables

constexpr int kNumModSources = 15
 
constexpr int kNumModDests = 26
 
constexpr int kNumParams = static_cast<int>(Param::Count)
 
constexpr int kMaxUnison = 8
 
constexpr int kModSlots = 8
 
constexpr int kMaxPolyphony = 64
 
constexpr const char * kEngineLabels [] = { "Analog", "FM", "Wavetable" }
 
constexpr const char * kVoiceModeLabels [] = { "Poly", "Mono", "Legato" }
 
constexpr const char * kGlideModeLabels [] = { "Always", "Legato" }
 
constexpr const char * kPhaseLabels [] = { "Reset", "Random" }
 
constexpr const char * kOversamplingLabels [] = { "1x", "2x", "4x" }
 
constexpr const char * kOscWaveLabels [] = { "Sine", "Triangle", "Saw", "Pulse" }
 
constexpr const char * kSubOctaveLabels [] = { "-1", "-2" }
 
constexpr const char * kSubWaveLabels [] = { "Square", "Triangle", "Sine" }
 
constexpr const char * kAlgorithmLabels []
 
constexpr const char * kBankLabels [] = { "Basic", "Harmonic", "Formant", "FM", "User" }
 
constexpr const char * kFilterLabels []
 
constexpr const char * kLfoShapeLabels []
 
constexpr const char * kDivisionLabels []
 
constexpr const char * kLfoModeLabels [] = { "Free", "Retrigger" }
 
constexpr const char * kModSourceLabels []
 
constexpr const char * kModDestLabels []
 
constexpr std::array< ParamInfo, kNumParams > kParams
 The parameter table, indexed by Param.
 

Detailed Description

Synthesizer's sample-type-independent vocabulary: choice values, parameter ids and the parameter table.

Enumeration Type Documentation

◆ Engine

enum class dspark::synthesizer::Engine
strong
Enumerator
Analog 
Fm 
Wavetable 

Definition at line 130 of file Synthesizer.h.

◆ FilterType

Enumerator
Off 
LadderLp24 
LadderLp12 
LadderBp12 
LadderHp24 
SvfLp 
SvfHp 
SvfBp 
SvfNotch 

Definition at line 136 of file Synthesizer.h.

◆ GlideMode

enum class dspark::synthesizer::GlideMode
strong
Enumerator
Always 
Legato 

Definition at line 132 of file Synthesizer.h.

◆ LfoMode

enum class dspark::synthesizer::LfoMode
strong
Enumerator
Free 
Retrigger 

Definition at line 137 of file Synthesizer.h.

◆ ModDest

enum class dspark::synthesizer::ModDest
strong

Modulation destinations. OscN Pitch and OscN Level reach analog oscillator N and wavetable oscillator N; FM operators have their own. LFO Rate acts on retriggered LFOs only (a free LFO is shared by every voice) and sees an LFO source one control period late.

Enumerator
None 
Pitch 
Osc1Pitch 
Osc2Pitch 
Osc3Pitch 
Osc1Level 
Osc2Level 
Osc3Level 
SubLevel 
NoiseLevel 
SampleLevel 
PulseWidth 
WtPosition 
Wt1Position 
Wt2Position 
Op1Level 
Op2Level 
Op3Level 
Op4Level 
FmFeedback 
Cutoff 
Resonance 
Amp 
Pan 
Lfo1Rate 
Lfo2Rate 

Definition at line 153 of file Synthesizer.h.

◆ ModSource

enum class dspark::synthesizer::ModSource
strong

Modulation sources (values: velocity, pressure, wheel, expression and breath 0..1; key (key - 60) / 60; bend, LFOs and random -1..1; envelopes 0..1).

Enumerator
None 
Velocity 
ReleaseVelocity 
Key 
ModWheel 
Pressure 
PitchBend 
Expression 
Breath 
Lfo1 
Lfo2 
Env1 
Env2 
Env3 
Random 

Definition at line 142 of file Synthesizer.h.

◆ OscWave

enum class dspark::synthesizer::OscWave
strong
Enumerator
Sine 
Triangle 
Saw 
Pulse 

Definition at line 134 of file Synthesizer.h.

◆ Param

enum class dspark::synthesizer::Param : int
strong

Every parameter, in the order of the parameter table.

Enumerator
Engine 
VoiceMode 
Polyphony 
Glide 
GlideMode 
BendRange 
Unison 
UnisonDetune 
UnisonSpread 
Drift 
Seed 
PhaseMode 
MasterVolume 
MasterTune 
Oversampling 
Osc1Wave 
Osc1Level 
Osc1Octave 
Osc1Semitone 
Osc1Fine 
Osc1PulseWidth 
Osc1Sync 
Osc2Wave 
Osc2Level 
Osc2Octave 
Osc2Semitone 
Osc2Fine 
Osc2PulseWidth 
Osc2Sync 
Osc3Wave 
Osc3Level 
Osc3Octave 
Osc3Semitone 
Osc3Fine 
Osc3PulseWidth 
Osc3Sync 
SubLevel 
SubOctave 
SubWave 
NoiseLevel 
SampleLevel 
SampleOctave 
SampleSemitone 
SampleFine 
SampleKeyTrack 
FmAlgorithm 
FmFeedback 
Op1Ratio 
Op1Detune 
Op1Fixed 
Op1Frequency 
Op1Level 
Op1Velocity 
Op1KeyScale 
Op1Attack 
Op1Decay 
Op1Sustain 
Op1Release 
Op2Ratio 
Op2Detune 
Op2Fixed 
Op2Frequency 
Op2Level 
Op2Velocity 
Op2KeyScale 
Op2Attack 
Op2Decay 
Op2Sustain 
Op2Release 
Op3Ratio 
Op3Detune 
Op3Fixed 
Op3Frequency 
Op3Level 
Op3Velocity 
Op3KeyScale 
Op3Attack 
Op3Decay 
Op3Sustain 
Op3Release 
Op4Ratio 
Op4Detune 
Op4Fixed 
Op4Frequency 
Op4Level 
Op4Velocity 
Op4KeyScale 
Op4Attack 
Op4Decay 
Op4Sustain 
Op4Release 
Wt1Bank 
Wt1Position 
Wt1Level 
Wt1Octave 
Wt1Semitone 
Wt1Fine 
Wt2Bank 
Wt2Position 
Wt2Level 
Wt2Octave 
Wt2Semitone 
Wt2Fine 
FilterType 
FilterCutoff 
FilterResonance 
FilterDrive 
FilterKeyTrack 
FilterEnvAmount 
FilterVelocity 
AmpVelocity 
AmpPan 
Env1Attack 
Env1Decay 
Env1Sustain 
Env1Release 
Env1Curve 
Env2Attack 
Env2Decay 
Env2Sustain 
Env2Release 
Env2Curve 
Env3Attack 
Env3Decay 
Env3Sustain 
Env3Release 
Env3Curve 
Lfo1Shape 
Lfo1Rate 
Lfo1Sync 
Lfo1Division 
Lfo1Delay 
Lfo1FadeIn 
Lfo1Phase 
Lfo1Mode 
Lfo2Shape 
Lfo2Rate 
Lfo2Sync 
Lfo2Division 
Lfo2Delay 
Lfo2FadeIn 
Lfo2Phase 
Lfo2Mode 
Mod1Source 
Mod1Via 
Mod1Destination 
Mod1Amount 
Mod2Source 
Mod2Via 
Mod2Destination 
Mod2Amount 
Mod3Source 
Mod3Via 
Mod3Destination 
Mod3Amount 
Mod4Source 
Mod4Via 
Mod4Destination 
Mod4Amount 
Mod5Source 
Mod5Via 
Mod5Destination 
Mod5Amount 
Mod6Source 
Mod6Via 
Mod6Destination 
Mod6Amount 
Mod7Source 
Mod7Via 
Mod7Destination 
Mod7Amount 
Mod8Source 
Mod8Via 
Mod8Destination 
Mod8Amount 
Count 

Definition at line 163 of file Synthesizer.h.

◆ PhaseMode

enum class dspark::synthesizer::PhaseMode
strong
Enumerator
Reset 
Random 

Definition at line 133 of file Synthesizer.h.

◆ SubWave

enum class dspark::synthesizer::SubWave
strong
Enumerator
Square 
Triangle 
Sine 

Definition at line 135 of file Synthesizer.h.

◆ VoiceMode

enum class dspark::synthesizer::VoiceMode
strong
Enumerator
Poly 
Mono 
Legato 

Definition at line 131 of file Synthesizer.h.

Function Documentation

◆ findParam()

int dspark::synthesizer::findParam ( std::string_view  id)
inlinenoexcept

Index of the parameter with this id, or -1.

Definition at line 491 of file Synthesizer.h.

◆ tableIsConsistent()

constexpr bool dspark::synthesizer::tableIsConsistent ( )
constexprnoexcept

True when the table is in Param order, ids are unique and every default lies in its range.

Definition at line 473 of file Synthesizer.h.

Variable Documentation

◆ kAlgorithmLabels

constexpr const char* dspark::synthesizer::kAlgorithmLabels[]
inlineconstexpr
Initial value:
= {
"1: 4>3>2>1", "2: (3+4)>2>1", "3: (4 + 3>2)>1", "4: (4>3 + 2)>1",
"5: 4>3, 2>1", "6: 4>(1, 2, 3)", "7: 4>3, 2, 1", "8: 1, 2, 3, 4" }

Definition at line 236 of file Synthesizer.h.

◆ kBankLabels

constexpr const char* dspark::synthesizer::kBankLabels[] = { "Basic", "Harmonic", "Formant", "FM", "User" }
inlineconstexpr

Definition at line 239 of file Synthesizer.h.

◆ kDivisionLabels

constexpr const char* dspark::synthesizer::kDivisionLabels[]
inlineconstexpr
Initial value:
= {
"8 bars", "4 bars", "2 bars", "1/1", "1/2.", "1/2", "1/2T", "1/4.", "1/4", "1/4T",
"1/8.", "1/8", "1/8T", "1/16.", "1/16", "1/16T", "1/32", "1/32T", "1/64" }

Definition at line 245 of file Synthesizer.h.

◆ kEngineLabels

constexpr const char* dspark::synthesizer::kEngineLabels[] = { "Analog", "FM", "Wavetable" }
inlineconstexpr

Definition at line 228 of file Synthesizer.h.

◆ kFilterLabels

constexpr const char* dspark::synthesizer::kFilterLabels[]
inlineconstexpr
Initial value:
= {
"Off", "Ladder LP24", "Ladder LP12", "Ladder BP12", "Ladder HP24",
"SVF LP", "SVF HP", "SVF BP", "SVF Notch" }

Definition at line 240 of file Synthesizer.h.

◆ kGlideModeLabels

constexpr const char* dspark::synthesizer::kGlideModeLabels[] = { "Always", "Legato" }
inlineconstexpr

Definition at line 230 of file Synthesizer.h.

◆ kLfoModeLabels

constexpr const char* dspark::synthesizer::kLfoModeLabels[] = { "Free", "Retrigger" }
inlineconstexpr

Definition at line 248 of file Synthesizer.h.

◆ kLfoShapeLabels

constexpr const char* dspark::synthesizer::kLfoShapeLabels[]
inlineconstexpr
Initial value:
= {
"Sine", "Triangle", "Saw Up", "Saw Down", "Square", "Sample and Hold", "Smooth Random" }

Definition at line 243 of file Synthesizer.h.

◆ kMaxPolyphony

constexpr int dspark::synthesizer::kMaxPolyphony = 64
inlineconstexpr

Definition at line 226 of file Synthesizer.h.

◆ kMaxUnison

constexpr int dspark::synthesizer::kMaxUnison = 8
inlineconstexpr

Definition at line 224 of file Synthesizer.h.

◆ kModDestLabels

constexpr const char* dspark::synthesizer::kModDestLabels[]
inlineconstexpr
Initial value:
= {
"None", "Pitch", "Osc 1 Pitch", "Osc 2 Pitch", "Osc 3 Pitch", "Osc 1 Level",
"Osc 2 Level", "Osc 3 Level", "Sub Level", "Noise Level", "Sample Level",
"Pulse Width", "WT Position", "WT 1 Position", "WT 2 Position", "Op 1 Level",
"Op 2 Level", "Op 3 Level", "Op 4 Level", "FM Feedback", "Cutoff", "Resonance",
"Amp", "Pan", "LFO 1 Rate", "LFO 2 Rate" }

Definition at line 252 of file Synthesizer.h.

◆ kModSlots

constexpr int dspark::synthesizer::kModSlots = 8
inlineconstexpr

Definition at line 225 of file Synthesizer.h.

◆ kModSourceLabels

constexpr const char* dspark::synthesizer::kModSourceLabels[]
inlineconstexpr
Initial value:
= {
"None", "Velocity", "Release Velocity", "Key", "Mod Wheel", "Pressure", "Pitch Bend",
"Expression", "Breath", "LFO 1", "LFO 2", "Env 1", "Env 2", "Env 3", "Random" }

Definition at line 249 of file Synthesizer.h.

◆ kNumModDests

constexpr int dspark::synthesizer::kNumModDests = 26
inlineconstexpr

Definition at line 160 of file Synthesizer.h.

◆ kNumModSources

constexpr int dspark::synthesizer::kNumModSources = 15
inlineconstexpr

Definition at line 147 of file Synthesizer.h.

◆ kNumParams

constexpr int dspark::synthesizer::kNumParams = static_cast<int>(Param::Count)
inlineconstexpr

Definition at line 201 of file Synthesizer.h.

◆ kOscWaveLabels

constexpr const char* dspark::synthesizer::kOscWaveLabels[] = { "Sine", "Triangle", "Saw", "Pulse" }
inlineconstexpr

Definition at line 233 of file Synthesizer.h.

◆ kOversamplingLabels

constexpr const char* dspark::synthesizer::kOversamplingLabels[] = { "1x", "2x", "4x" }
inlineconstexpr

Definition at line 232 of file Synthesizer.h.

◆ kParams

constexpr std::array<ParamInfo, kNumParams> dspark::synthesizer::kParams
inlineconstexpr

The parameter table, indexed by Param.

Definition at line 285 of file Synthesizer.h.

◆ kPhaseLabels

constexpr const char* dspark::synthesizer::kPhaseLabels[] = { "Reset", "Random" }
inlineconstexpr

Definition at line 231 of file Synthesizer.h.

◆ kSubOctaveLabels

constexpr const char* dspark::synthesizer::kSubOctaveLabels[] = { "-1", "-2" }
inlineconstexpr

Definition at line 234 of file Synthesizer.h.

◆ kSubWaveLabels

constexpr const char* dspark::synthesizer::kSubWaveLabels[] = { "Square", "Triangle", "Sine" }
inlineconstexpr

Definition at line 235 of file Synthesizer.h.

◆ kVoiceModeLabels

constexpr const char* dspark::synthesizer::kVoiceModeLabels[] = { "Poly", "Mono", "Legato" }
inlineconstexpr

Definition at line 229 of file Synthesizer.h.