Skip to content
cccskills
FreePublished on GitHub

dsp-algorithm-guide

Implementation guide for common DSP algorithms. Use when the user asks "implement a lowpass filter", "how do I write a compressor", "reverb algorithm", "FFT convolution", "pitch shifter", or "oscillator with no aliasing". Trigger on phrases like "biquad filter", "state variable filter", "feedback delay network", "phase vocoder", "overlap-add", "PolyBLEP", or any request to implement a specific DSP processing block.

The English summary is being prepared. Showing the original description.

See how to install

Files included (2)

  • SKILL.md3.6 KB
  • references/algorithm-cookbook.md6.9 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

DSP Algorithm Guide

Three steps: pick the right algorithm family, address implementation concerns, then verify correctness.

Step 1 — Identify the algorithm family

User requestAlgorithm familyRecommended starting point
Lowpass / highpass / bandpass / notchBiquad (IIR)Direct Form II transposed
High-quality parametric EQ, resonant filterBiquad cascade or SVFState Variable Filter (SVF)
Shelving / high-shelf / low-shelfBiquad (Audio EQ Cookbook)Peaking EQ or shelf coefficients
Reverb (algorithmic)FDN or Schroeder/MoorerFeedback Delay Network (FDN)
Reverb (convolution / IR)OLA / OLSOverlap-Add with FFT
Compressor / limiter / expander / gateLevel detector + gain computerRMS or peak detector + knee curve
Pitch shift / time stretchPhase vocoder or granularPhase vocoder for tonal material
Anti-aliased oscillatorBLIT / PolyBLEP / wavetablePolyBLEP for simple waveforms
Spectral processing / analysisSTFT pipelineOverlap-Add / Overlap-Save
Waveshaper / saturationMemoryless nonlinearitySoft-clip with oversampling

Step 2 — Implementation concerns

Work through this checklist before writing any DSP code:

  • Stability — confirm the algorithm's stability condition and check it after every coefficient update (e.g., biquad poles inside unit circle).
  • Coefficient precision — use double for coefficient computation; cast to float for the inner loop only if profiling demands it.
  • Denormal protection — use ScopedNoDenormals/FTZ where available, or add explicit state clamps/noise around feedback paths.
  • Latency reporting — if the algorithm introduces latency (e.g., FFT block size), call setLatencySamples() so the host can compensate.
  • Initialisation — clear all delay-line and state memory in prepareToPlay; never assume zero-init across transport loops.
  • Parameter smoothing — ramp filter coefficients or gain values over a block; abrupt changes cause clicks and, for IIR filters, instability.
  • Oversampling — nonlinear stages (waveshapers, saturators) need at least 2x oversampling to suppress alias products.

Step 3 — Test the implementation

  • Frequency response: compare magnitude/phase against the reference formula at multiple frequencies (e.g., plot with Python or MATLAB).
  • Step response: feed a unit step; verify overshoot and decay match the algorithm's expected behaviour.
  • Silence-in → silence-out: verify the output reaches and stays at zero after silent input (no denormal crawl).
  • No NaN / Inf: run with extreme parameter values (fc = 1 Hz, fc = Nyquist − 1 Hz, gain = 0 dB, gain = +24 dB).
  • Impulse response (convolution / reverb): verify IR matches the target via inverse FFT.
  • CPU profiling: measure per-block worst case before shipping; compare against the buffer deadline on the target CPU instead of relying on fixed ns/sample budgets.

See references/algorithm-cookbook.md for difference equations, stability conditions, coefficient mappings, and numerical tips for each family.

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Reviews AudioUnit v2/v3 plugin implementations for spec compliance, thread safety, and correctness. Use when the user asks to review an AudioUnit plugin, check an AUv3 app extension, audit property or parameter handling, or asks "is my AUComponent thread-safe?" or "why does my AU crash in Logic?". Trigger on phrases like "review my AudioUnit", "check my AUv3", "is my render block safe?", or when you see AURenderCallback, internalRenderBlock, kAudioUnitProperty_*, or AUAudioUnit in the code.

The English summary is being prepared. Showing the original description.

kunitoki/sonic-skills22Updated May 21, 2026

Systematic checklist for diagnosing audio artifacts. Use when the user describes a sound quality problem — clicks, pops, crackling, silence, DC offset, aliasing, phase issues, or latency problems. Trigger on phrases like "why do I hear clicks?", "my output has DC offset", "there's aliasing in my oscillator", "phase is wrong in mono", "dropout when CPU spikes". Pairs with audio-dsp-review (realtime safety) and audio-numerics-review (numeric correctness) — use those to fix once the cause is found.

The English summary is being prepared. Showing the original description.

kunitoki/sonic-skills22Updated May 21, 2026

Reviews audio DSP and audio processing code for realtime safety violations. Use whenever the user asks to review, audit, or check audio processing code — including plugin process callbacks, audio engine render functions, DSP implementations, or any code that runs on the audio thread. Trigger on phrases like "review my processBlock", "check this DSP code", "is this safe for the audio thread?", "review my JUCE plugin", or when you see an audio callback and spot potential realtime violations. Flag issues proactively even when the user hasn't explicitly asked for a review.

The English summary is being prepared. Showing the original description.

kunitoki/sonic-skills22Updated May 21, 2026

Explains DSP math concepts to developers who need the theory behind an algorithm. Use whenever the user asks how a signal-processing concept works, wants intuition behind a formula, or hits a math-shaped bug. Trigger on phrases like "how does a Fourier transform work", "explain z-transforms", "what is convolution", "why does my biquad ring", "what is windowing for", "what causes aliasing", or "how do I convert gain to dB". Also trigger when the user pastes DSP code and asks why it behaves a certain way.

The English summary is being prepared. Showing the original description.

kunitoki/sonic-skills22Updated May 21, 2026

Reviews audio DSP code for numerical correctness. Use when the user asks to review, audit, or check DSP code for correctness issues — filters, feedback loops, fixed-point arithmetic, accumulation loops, or any numeric computation in audio code. Trigger on "check this filter for NaN", "why does my reverb blow up?", "is this numerically stable?", "why do I hear DC in my output?". Pairs with audio-dsp-review (realtime safety); this skill covers numeric correctness. Flag issues proactively.

The English summary is being prepared. Showing the original description.

kunitoki/sonic-skills22Updated May 21, 2026

Profiling strategy for audio CPU issues — xruns, spikes, and buffer underruns. Use when the user reports CPU overload, audio glitches under load, or performance regressions. Trigger on phrases like "I'm getting xruns", "my plugin causes CPU spikes", "dropouts under high voice count", "audio thread is too slow", "how do I profile my DSP". References audio-numerics-review for denormal slowdown and audio-dsp-review for lock contention.

The English summary is being prepared. Showing the original description.

kunitoki/sonic-skills22Updated May 21, 2026

See all skills by kunitoki

Report a problem with this skill