dspx is a production-ready digital signal processing library that harnesses native C++ acceleration and Redis state persistence. Designed for Node.js backends, it excels in processing real-time biosignals, audio streams, and sensor data with speed and efficiency, offering a comprehensive suite of features for modern applications.
I built dspx after hitting a wall with real-time EMG processing in Node.js.
The problem: 2000 Hz streams × 8 channels → filters → decimation → FFT
The solution: Native C++ DSP with Redis-persisted state. Workers can process a chunk, save state, die, and resume elsewhere — serverless DSP without losing filter history.
Repo: https://github.com/a-kgeorge/dspx Benchmarks: https://github.com/a-kgeorge/dspx-benchmark npm: https://www.npmjs.com/package/dspx
Traditional DSP assumes persistent processes. But serverless / Kubernetes deployments scale to zero, killing your filter state.
dspx serializes:
to Redis in ~1–2 ms. New workers restore state + resume mid-stream.
Environment: Intel i5-12600T • Node v22.21.1 • 16 GB RAM
Full benchmarks: https://github.com/a-kgeorge/dspx-benchmark
Zero leaks observed across 10,000+ Redis save/restore cycles (C++ + JS GC verified clean)
Stable on Pixel 9 Pro XL under production-like loads (NEON tuning would improve further)
WASM was considered, but N-API fit better:
const pipeline = await createDspPipeline({
redisHost: "localhost",
redisPort: 6379,
stateKey: "dsp:user:ch1",
});
pipeline
.filter({
type: "butterworth",
mode: "bandpass",
lowCutoffFrequency: 20,
highCutoffFrequency: 450
})
.stft({ windowSize: 512, hopSize: 160 })
.melSpectrogram({ numMelBands: 26 })
.mfcc({ numCoefficients: 13 });
await pipeline.process(audioData, { sampleRate: 16000 });
// Save state to Redis (1–2 ms)
const state = await pipeline.saveState();
// Worker can die here...
// New worker restores + resumes
await pipeline.loadState(state);
await pipeline.process(nextChunk);
✅ x64 + ARM Tested on Pixel 9 Pro XL — stable under large streams (even without NEON tuning)
✅ Node 18 / 20 / 22 N-API v8 (single prebuild works across versions)
✅ Prebuilt binaries
Because dspx serializes state + Redis is low-latency, workers can:
Seeking contributors for portable NEON paths (generic ARM) — especially convolution/FFT hot loops.
Where have you hit limits with DSP in Node? What primitives/patterns are missing?
Exploring clean patterns to pipe Kafka topics into dspx pipelines (backpressure, batching, checkpoints). Feedback welcome.
✅ Good fit
❌ Not ideal for
✅ STFT / Mel / MFCC ✅ Convolution + FFT (native C/C++) ✅ Redis state persistence ✅ ARM functional (not yet optimized) ✅ 891 tests passing (including chaining tests) 🔄 Kafka integration — seeking input
Feedback welcome — especially around:
Repo: https://github.com/a-kgeorge/dspx
Benchmarks: https://github.com/a-kgeorge/dspx-benchmark
Thanks!
No comments yet.
Sign in to be the first to comment.