Back to list
rolandzwaga

dsp-architecture

by rolandzwaga

A DSP and VST audio repository

0🍴 0📅 Jan 25, 2026

SKILL.md


name: dsp-architecture description: DSP development patterns for this VST3 plugin. Use when working on audio processing, dsp/ folder, processors, effects, delay algorithms, filters, or any code that runs on the audio thread. Covers real-time safety, layered architecture, interpolation choices, and performance budgets. allowed-tools: Read, Grep, Glob, Bash

DSP Architecture Guide

This skill provides guidance for DSP development in this VST3 plugin project.

Quick Reference


Layered Architecture Overview

┌─────────────────────────────────────────────────────────────┐
│                    LAYER 4: USER FEATURES                   │
│            (Complete delay modes, full effects)             │
├─────────────────────────────────────────────────────────────┤
│                  LAYER 3: SYSTEM COMPONENTS                 │
│         (Composed processors, modulation systems)           │
├─────────────────────────────────────────────────────────────┤
│                   LAYER 2: DSP PROCESSORS                   │
│            (Filters, saturators, diffusers)                 │
├─────────────────────────────────────────────────────────────┤
│                  LAYER 1: DSP PRIMITIVES                    │
│         (Delay lines, oscillators, envelopes)               │
├─────────────────────────────────────────────────────────────┤
│                    LAYER 0: CORE UTILITIES                  │
│           (Math, conversions, buffer helpers)               │
└─────────────────────────────────────────────────────────────┘

Dependency Rules

  • Each layer can ONLY depend on layers below it
  • No circular dependencies
  • Extract utilities to Layer 0 if used by 2+ Layer 1 primitives

Layer Include Matrix

Your LayerLocationCan Include
0 (core/)dsp/include/krate/dsp/core/stdlib only
1 (primitives/)dsp/include/krate/dsp/primitives/Layer 0
2 (processors/)dsp/include/krate/dsp/processors/Layers 0, 1
3 (systems/)dsp/include/krate/dsp/systems/Layers 0, 1, 2
4 (effects/)dsp/include/krate/dsp/effects/Layers 0, 1, 2, 3

Critical Rules Summary

Real-Time Thread Safety

The audio thread (Processor::process()) has hard real-time constraints.

FORBIDDEN on audio thread:

new / delete / malloc / free          // Memory allocation
std::vector::push_back()              // May reallocate
std::mutex / std::lock_guard          // Blocking synchronization
throw / catch                         // Exception handling
std::cout / printf / logging          // I/O operations

See REALTIME-SAFETY.md for safe alternatives.

ODR Prevention (CRITICAL)

Before creating ANY new class/struct, search codebase:

grep -r "class ClassName" dsp/ plugins/

Two classes with same name in same namespace = undefined behavior (garbage values, mysterious test failures). Check dsp_utils.h and specs/_architecture_/ before adding components.


Performance Budgets

ComponentCPU TargetMemory
Layer 1 primitive< 0.1%Minimal
Layer 2 processor< 0.5%Pre-allocated
Layer 3 system< 1%Fixed buffers
Full plugin< 5%10s @ 192kHz max

DSP Implementation Quick Reference

Use CaseInterpolation
Fixed delay in feedbackAllpass
LFO-modulated delayLinear/Cubic (NOT allpass)
Pitch shiftingLagrange/Sinc
TechniqueWhen to Apply
OversamplingNonlinear processing (saturation, waveshaping)
DC BlockingAfter asymmetric saturation (~5-20Hz highpass)
Feedback SafetyWhen feedback > 100% (soft-limit with std::tanh())

See IMPLEMENTATION.md for detailed guidance.


File Organization

dsp/                              # Shared KrateDSP library (Krate::DSP namespace)
├── include/krate/dsp/
│   ├── core/                     # Layer 0 - math, conversions, utilities
│   ├── primitives/               # Layer 1 - delay lines, oscillators, envelopes
│   ├── processors/               # Layer 2 - filters, saturators, diffusers
│   ├── systems/                  # Layer 3 - composed processors, mod systems
│   └── effects/                  # Layer 4 - complete delay modes
└── tests/                        # DSP unit tests (mirrors structure above)

Include patterns:

#include <krate/dsp/core/math_utils.h>
#include <krate/dsp/primitives/delay_line.h>
#include <krate/dsp/processors/biquad_filter.h>

Score

Total Score

65/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon