Modern C++20 library and CLI tools for CSV time-series processing and WAV signal analysis.
This library powers a desktop application:
The viewer provides an interactive GUI for:
- CSV anomaly analysis
- WAV signal and spectrum analysis
- visualization and export tools
This project demonstrates modern C++ development practices and serves as a portfolio example.
Key aspects:
- Modern C++20 design
- Clean separation between CLI and reusable core library
- Reproducible builds using CMake presets
- CI (GCC + Clang)
- Sanitizers (ASan + UBSan)
- Static analysis (clang-tidy)
- Debugging and memory analysis (GDB + Valgrind)
- Unit testing
Development notes and CI instructions are available here: docs/DEVELOPMENT.md.
Notes and instructions are available here: docs/CSV.md.
- CLI data processing tool for CSV files (
pdt_csv_cli) - Robust CSV parsing with error reporting and skipped row inspection
- ISO 8601 timestamp parsing
- Filtering by sensor and time range
- Statistical analysis with optional per-sensor breakdown
- Configurable anomaly detection (
zscore,iqr,mad) with threshold and top-N selection - JSON and CSV export with anomaly highlighting
Notes and instructions are available here: docs/WAV.md.
- CLI spectrum analysis tool for WAV files (
pdt_wav_cli) - Spectrum computation using DFT / FFT with optional CUDA acceleration (cuFFT)
- Backend abstraction for CPU / GPU spectrum computation
- Single-sided spectrum computation
- Window functions: Hann and Hamming
- Spectral peak detection and dominant peak selection
- WAV reader (RIFF/WAVE PCM16 mono)
- Synthetic signal spectrum analysis demo (
pdt_wav_synth_demo) - CSV and text report export (
--out,--out-r) - Recommended FFT size listing for CPU/GPU (
--list-sizes) - FFT benchmark tool (
fft_benchmark)
CSV CLI can:
- print import/skipped row summaries
- generate JSON reports
- export anomaly-marked CSV files
WAV CLI can:
- print spectral peak reports
- export spectrum CSV
- export text reports
cmake --preset debug
cmake --build --preset debugRun CSV CLI:
./build/debug/pdt_csv_cli --in examples/sample.csvRun WAV CLI:
./build/debug/pdt_wav_cli --in examples/HDSDR_20230515_072359Z_15047kHz_AF.wavdebugβ CPU only (default, sanitizers enabled)debug-nosanβ CPU only, no sanitizersdebug-cuda-nosanβ CUDA enabled, no sanitizersreleaseβ optimized CPU buildrelease-cudaβ optimized CUDA build
Note: CUDA builds require sanitizers to be disabled.
The project is organized in two complementary views:
csvβ CSV time-series processing, filtering, statistics, anomaly detectionwavβ offline signal/spectrum analysis for WAV inputrtlsdrβ planned live SDR input module
pdt/ioβ input/output modules (currently WAV I/O, later also RTL-SDR)pdt/dspβ core DSP algorithms: DFT, FFT, windows, peak detection, spectrum typespdt/computeβ spectrum computation backends (IFftBackend, CPU, CUDA/cuFFT)pdt/pipelineβ backend-driven analysis flow (SpectrumEngine)
include/pdt/
βββ compute/ FFT/spectrum backends (CPU, CUDA)
βββ csv/ CSV processing public API
βββ dsp/ DSP public API
βββ io/
β βββ wav/ WAV I/O public API
βββ pipeline/ analysis pipeline public API
src/
βββ compute/ backend implementations
βββ csv/ CSV processing implementation
βββ dsp/ DSP implementation
βββ io/
β βββ wav/ WAV I/O implementation
βββ pipeline/ analysis pipeline implementation
app/ CLI applications
bench/ performance benchmarks
tests/ unit tests
examples/ sample CSV and WAV inputs and outputs
.github/ CI workflows- CMake 3.25+
- Ninja
- C++20 compatible compiler
- Linux environment is recommended
CUDA backend can be enabled to accelerate FFT computation.
Requirements:
- NVIDIA GPU
- CUDA Toolkit (with cuFFT)
When enabled:
CudaFftBackendandfft_benchmarkare available- FFT can be executed on GPU (cuFFT)
Ο = sqrt( Ξ£(x - ΞΌ)Β² / N )The CSV CLI supports three anomaly detection methods:
z = (x - ΞΌ) / ΟSamples with |z| > threshold are reported as anomalies.
The interquartile range method uses:
IQR = Q3 - Q1Samples outside the interval
[Q1 - threshold Β· IQR, Q3 + threshold Β· IQR]
are reported as anomalies.
The median absolute deviation method uses:
MAD = median(|x - median(x)|)A robust anomaly score is computed:
score = (x - median(x)) / MADSamples with |score| > threshold are reported as anomalies.
X[k] = Ξ£ x[n] Β· e^(βj2Οkn/N), k = 0..Nβ1Current implementation is O(NΒ²) and serves as a reference implementation.
The project implements a radix-2 CooleyβTukey FFT algorithm.
The FFT recursively decomposes the DFT into even and odd indexed samples:
X[k] = E[k] + W_N^k Β· O[k]
X[k + N/2] = E[k] - W_N^k Β· O[k]where:
W_N^k = e^(βj2Οk/N)The algorithm requires the input size to be a power of two and has time complexity O(N log N)
Two strategies:
ThresholdOnly
X[i] >= threshold_ratio Β· max(X)LocalMaxima
X[i] > X[i-1] && X[i] > X[i+1]Example:
#include <pdt/csv/dataset.h>
#include <pdt/csv/csv_reader.h>
#include <fstream>
int main() {
std::ifstream in("examples/sample.csv");
auto import = pdt::read_csv(in);
pdt::DataSet ds{std::move(import.samples)};
auto stats = ds.stats();
return 0;
}Possible next steps:
- Streaming / online anomaly detection
- Additional window functions
- Spectrogram computation
MIT License