Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chardsp

Small C++17 header-only audio DSP library. Components are independent, allocation-free during sample processing, and support float or double.

Components

  • chardsp_ADSREnvelope.h — finite-time ADSR with linear or exponential stages, live edits, continuous retriggering, a forced linear fade for voice stealing, and stage reporting.

  • chardsp_BasicSynthVoice.h — combines two selectable oscillators, pulse width, colored noise, ADSR, a lowpass/bandpass/highpass filter, and velocity response into a synth voice.

  • chardsp_Biquad.h — stable biquad processing with lowpass, highpass, bandpass, notch, peak, and shelf designs.

  • chardsp_ColoredNoise.h — deterministic seeded brown, pink, white, and blue noise.

  • chardsp_DCBlocker.h — first-order DC removal with adjustable cutoff and bypass.

  • chardsp_DelayLine.h — fixed-capacity integer or linearly interpolated fractional delay with separate reads and writes for feedback.

  • chardsp_Detectors.h — peak, RMS, and attack/release envelope followers.

  • chardsp_EllipticBLEP.h — Signalsmith correction state for fractional step and slope discontinuities.

  • chardsp_Gain.h — linear and equal-power crossfades.

  • chardsp_MonoVoiceController.h — last-note-priority note logic with legato grace, sustain, note fallback, and off, always, or fingered portamento actions.

  • chardsp_Oscillator.h — naive, PolyBLEP, and Signalsmith elliptic-BLEP saw, pulse, and triangle oscillators, plus sine, saw direction, and pulse width.

  • chardsp_OscillatorEvents.h — allocation-free fractional edge scheduling for moving pulse waves.

  • chardsp_OscillatorPhase.h — normalized phase accumulation with arbitrary advances and fractional wrap timing.

  • chardsp_Oversampler.h — prepared multichannel Signalsmith FIR 2x/4x block upsampling and downsampling with CHOC views and latency reporting.

  • chardsp_Portamento.h — semitone-space pitch glides with variable curve and constant-time-to-constant-rate morphing.

  • chardsp_SamplePlayer.h — forward mono playback from caller-owned samples with rate, position, and linear interpolation.

  • chardsp_SimpleDownsampler.h — allocation-free power-of-two decimation for externally rendered samples.

  • chardsp_SmoothedValue.h — finite linear or multiplicative ramps with retargeting and fast skipping.

  • chardsp_StateVariableFilter.h — TPT state-variable filter with cutoff, Q, selectable lowpass/bandpass/highpass, and simultaneous lowpass, bandpass, highpass, and notch outputs.

  • chardsp_VoicePool.h — fixed polyphony with custom key types, sustain, normal release, release-aware stealing, and a configurable forced-steal fade.

See examples for interactive component demos and the polyphonic basic synth.

Dependencies

Pinned Git submodules:

chardsp is ISC-licensed; see LICENSE. Source distributions must retain the license files in this repository and its submodules.

Clone recursively:

git clone --recurse-submodules https://github.com/charCulbert/chardsp.git

For an existing checkout:

git submodule update --init --recursive

Use

Include only the components you need:

#include "chardsp/chardsp_Oscillator.h"
#include "chardsp/chardsp_ADSREnvelope.h"
#include "chardsp/chardsp_StateVariableFilter.h"

Or add the repository with CMake:

add_subdirectory(path/to/chardsp)
target_link_libraries(my_target PRIVATE chardsp::chardsp)

Build

cmake -S . -B build \
    -DCHARDSP_BUILD_TESTS=ON \
    -DCHARDSP_BUILD_EXAMPLES=ON
cmake --build build
./build/tests/chardsp_tests

Interactive examples are currently built on macOS.

About

C++17 header-only audio DSP

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages