| Crates.io | bbx_dsp |
| lib.rs | bbx_dsp |
| version | 0.4.3 |
| created_at | 2025-12-30 00:38:19.313332+00 |
| updated_at | 2026-01-15 17:29:22.029789+00 |
| description | Block-based audio DSP graph system with oscillators, effects, modulators, and realtime-safe processing |
| homepage | |
| repository | https://github.com/blackboxaudio/bbx_audio |
| max_upload_size | |
| id | 2011771 |
| size | 534,959 |
A block-based audio DSP system for building signal processing graphs.
set_smoothing()OscillatorBlock - Waveform generator (sine, square, saw, triangle, pulse, noise)GainBlock - Level control in dBOverdriveBlock - Asymmetric soft-clipping distortionPannerBlock - Stereo, surround (VBAP), and ambisonic panningDcBlockerBlock - DC offset removalChannelRouterBlock - Simple stereo channel routingChannelSplitterBlock - Split multi-channel to mono outputsChannelMergerBlock - Merge mono inputs to multi-channelMatrixMixerBlock - NxM mixing matrixAmbisonicDecoderBlock - Ambisonics B-format decoderBinauralDecoderBlock - Ambisonics B-format to stereo binaural for headphonesLowPassFilterBlock - SVF-based TPT low-pass filter with cutoff/resonanceLfoBlock - Low-frequency oscillator for parameter modulationEnvelopeBlock - ADSR envelope generatorFileInputBlock - Read audio from filesFileOutputBlock - Write audio to files (non-blocking I/O)OutputBlock - Terminal graph outputBeyond basic stereo, bbx_dsp supports surround and ambisonic formats:
Mono - 1 channelStereo - 2 channels (default)Surround51 - 6 channels (5.1)Surround71 - 8 channels (7.1)AmbisonicFoa - 4 channels (1st order)AmbisonicSoa - 9 channels (2nd order)AmbisonicToa - 16 channels (3rd order)Custom(n) - Arbitrary channel countBlocks declare how they handle multi-channel audio:
Parallel (default) - Process each channel independentlyExplicit - Block handles routing internally (panners, mixers, decoders)Use GraphBuilder::with_layout() to create graphs with specific channel configurations.
simdEnables SIMD optimizations for supported blocks. Requires nightly Rust.
[dependencies]
bbx_dsp = { version = "...", features = ["simd"] }
Optimized blocks:
OscillatorBlock - Vectorized waveform generationLfoBlock - Vectorized modulation signal generationGainBlock - Vectorized gain applicationFor plugin integration, implement PluginDsp with optional MIDI support:
process() receives midi_events: &[MidiEvent] parameternote_on(), note_off(), control_change(), pitch_bend() for MIDI handlingRun performance benchmarks to measure SIMD optimization effectiveness:
# Scalar baseline
cargo bench --benches -p bbx_dsp -- --save-baseline scalar
# SIMD comparison (requires nightly)
cargo +nightly bench --benches -p bbx_dsp --features simd -- --save-baseline scalar
HTML reports are generated in target/criterion/. See the full documentation for details.
use bbx_dsp::{graph::GraphBuilder, waveform::Waveform};
// Create a graph with 44.1kHz sample rate, 512 sample buffer, stereo output
let mut builder = GraphBuilder::<f32>::new(44100.0, 512, 2);
// Add an oscillator
let osc = builder.add_oscillator(440.0, Waveform::Sine, None);
// Build the graph (automatically adds output block)
let mut graph = builder.build();
// Process audio
let mut left = vec![0.0f32; 512];
let mut right = vec![0.0f32; 512];
let mut outputs: [&mut [f32]; 2] = [&mut left, &mut right];
graph.process_buffers(&mut outputs);
MIT