Orkid Singularity Audio/Synth Engine Reference
When answering questions about audio or the synthesizer in orkid, consult the files below. All under ork.lev2/.
Key Files
| Component | Header |
|-----------|--------|
| Synth Engine | inc/ork/lev2/aud/singularity/synth.h |
| Layer (Voice) | inc/ork/lev2/aud/singularity/layer.h |
| DSP Blocks/Pipeline | inc/ork/lev2/aud/singularity/dspblocks.h |
| Program/Bank Data | inc/ork/lev2/aud/singularity/synthdata.h |
| Oscillators | inc/ork/lev2/aud/singularity/alg_oscil.h |
| Filters | inc/ork/lev2/aud/singularity/alg_filters.h |
| Amplitude/Gain | inc/ork/lev2/aud/singularity/alg_amp.h |
| Nonlinear/Distortion | inc/ork/lev2/aud/singularity/alg_nonlin.h |
| Envelopes | inc/ork/lev2/aud/singularity/envelope.h |
| Controllers/LFO | inc/ork/lev2/aud/singularity/controller.h |
| Modulation Routing | inc/ork/lev2/aud/singularity/modulation.h |
| Sampler | inc/ork/lev2/aud/singularity/sampler.h |
| Wavetable | inc/ork/lev2/aud/singularity/wavetable.h |
| FM Operators | inc/ork/lev2/aud/singularity/fmosc.h |
| TX81Z Emulation | inc/ork/lev2/aud/singularity/tx81z.h |
| CZ1 Phase Distortion | inc/ork/lev2/aud/singularity/cz1.h |
| Delays | inc/ork/lev2/aud/singularity/delays.h |
| DSP Buffer | inc/ork/lev2/aud/singularity/dspbuffer.h |
| Key On/Off | inc/ork/lev2/aud/singularity/konoff.h |
| Types | inc/ork/lev2/aud/singularity/krztypes.h |
| Audio Device | inc/ork/lev2/aud/audiodevice.h |
Architecture Overview
Execution Model
- Voice-based polyphonic synthesis (up to 512 voices)
- Control rate: 1500 Hz (32 frames @ 48kHz)
- Sample rate: 48 kHz
- Per-voice DSP pipeline with stages in series
Signal Flow
Voice -> Layer -> Algorithm (multi-stage)
-> DspStage 0 [Block0, Block1, ...] -> DspStage 1 -> ... -> OutputBus
-> Insert Effects -> Master EQ -> Audio Device
Core Classes
synth— main engine, voice allocation, output busesLayer— runtime voice instance, holds DSP stateLayerData— voice config (algorithm, controllers, keymap, pitch)Alg/AlgData— algorithm container (up to 16 stages)DspStage/DspStageData— stack of up to 32 DSP blocksDspBlock/DspBlockData— individual DSP unit (abstract base)
Program/Bank Structure
BankData
+-- programs (int -> ProgramData)
+-- keymaps (int -> KeyMapData)
+-- multisamples (int -> MultiSampleData)
ProgramData
+-- name, tags, monophonic, portamento
+-- _layerdatas[] (multiple layers per program)
+-- LayerData
+-- _algdata (DSP algorithm)
+-- _ctrlBlock (controllers)
+-- _kmpBlock (keymap for samples)
+-- loKey/hiKey, loVel/hiVel (range)
+-- output bus routing
Oscillator Types
- SINE, SAW, SQUARE (band-limited with PolyBLEP)
- SINEPLUS, SAWPLUS, SWPLUSSHP (harmonically enriched)
- SHAPEMODOSC, PLUSSHAPEMODOSC (shape modulation)
- SYNCM / SYNCS (oscillator sync master/slave)
- SAMPLER (multi-sample playback with keymaps)
- TX81Z FM operators (4-op Yamaha emulation)
- CZ1 phase distortion
Filter Types
TrapSVF— state variable (LPF/HPF/BPF/Notch, trap-rule)BiQuad— 2nd-order IIROnePoleLoPass/OnePoleHiPass— 1st orderParaOne— parametric EQ with shelving- DSP blocks: LP2RES, LOPAS2, LPGATE, BANDPASS_FILT, NOTCH_FILT, etc.
Envelope Types
RateLevelEnvData— ADSR-style with segment times/levelsAsrData— Attack-Sustain-ReleaseYmEnvData— Yamaha: AR/D1/S/D2TX81ZEnvData— TX81Z with polynomial rate scaling
Modulation System
DspParamData
+-- _coarse (base value)
+-- _fine (fine tuning)
+-- _keyTrack (keyboard follow)
+-- _velTrack (velocity follow)
+-- _mods (BlockModulationData)
+-- _src1 (primary: LFO, envelope, etc.)
+-- _src2 (depth modulation)
Custom evaluators: pitch, frequency, amplitude, or lambda-based.
Key On/Off
synth::keyOn(note, vel, program, keyonmods)
-> Layer::keyOn(note, vel, layerdata, outputbus)
-> Alg::keyOn() -> all DspBlocks, Controllers
How to Answer
- For DSP blocks: check
dspblocks.hfor base class,alg_*.hfor specific types - For modulation: read
modulation.hfor routing,controller.hfor LFO/envelope sources - For sample playback: read
sampler.hfor KeyMapData, MultiSampleData, SampleOscillator - For program structure: read
synthdata.hfor BankData/ProgramData hierarchy