{"id":40077100,"url":"https://github.com/cutedsp/rscutedsp","last_synced_at":"2026-01-19T09:00:57.796Z","repository":{"id":299830591,"uuid":"1003850721","full_name":"CuteDSP/RSCuteDSP","owner":"CuteDSP","description":"A Rust clone of the Signalsmith DSP C++ library for audio and signal processing","archived":false,"fork":false,"pushed_at":"2025-09-23T10:02:33.000Z","size":204,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-23T12:15:32.079Z","etag":null,"topics":["audio","cutedsp","dsp","fft","iir","iir-filter","iir-filters","no-std","no-std-alloc","pitch-shift","rust","signal-processing","signalsmith","stft","time-stretch"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CuteDSP.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-17T19:04:30.000Z","updated_at":"2025-09-23T10:02:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"26896bb6-10d3-439d-8e61-cca7c8a2fc08","html_url":"https://github.com/CuteDSP/RSCuteDSP","commit_stats":null,"previous_names":["cutedsp/rssignalsmithdsp","cutedsp/rscutedsp"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/CuteDSP/RSCuteDSP","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CuteDSP%2FRSCuteDSP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CuteDSP%2FRSCuteDSP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CuteDSP%2FRSCuteDSP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CuteDSP%2FRSCuteDSP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CuteDSP","download_url":"https://codeload.github.com/CuteDSP/RSCuteDSP/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CuteDSP%2FRSCuteDSP/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28565001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T08:53:44.001Z","status":"ssl_error","status_checked_at":"2026-01-19T08:52:40.245Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","cutedsp","dsp","fft","iir","iir-filter","iir-filters","no-std","no-std-alloc","pitch-shift","rust","signal-processing","signalsmith","stft","time-stretch"],"created_at":"2026-01-19T09:00:42.273Z","updated_at":"2026-01-19T09:00:57.787Z","avatar_url":"https://github.com/CuteDSP.png","language":"Rust","readme":"# RSCuteDSP\n\nA Rust port of the Signalsmith DSP C++ library, providing various DSP (Digital Signal Processing) algorithms for audio and signal processing. This library implements the same high-quality algorithms as the original C++ library, optimized for Rust performance and ergonomics.\n\n[![Crates.io](https://img.shields.io/crates/v/cute-dsp)](https://crates.io/crates/cute-dsp)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n## Features\n\n- **FFT**: Fast Fourier Transform implementation optimized for sizes that are products of 2^a * 3^b, with both complex and real-valued implementations\n- **Filters**: Biquad filters with various configurations (lowpass, highpass, bandpass, etc.) and design methods (Butterworth, cookbook)\n- **Delay Lines**: Efficient delay line implementation with multiple interpolation methods (nearest, linear, cubic)\n- **Curves**: Cubic curve interpolation with control over slope and curvature\n- **Windows**: Window functions for spectral processing (Hann, Hamming, Kaiser, Blackman-Harris, etc.)\n- **Envelopes**: LFOs and envelope generators with precise control and minimal aliasing\n- **Spectral Processing**: Tools for spectral manipulation, phase vocoding, and frequency-domain operations\n- **Time Stretching**: High-quality time stretching and pitch shifting using phase vocoder techniques\n- **STFT**: Short-time Fourier transform implementation with overlap-add processing\n- **Mixing Utilities**: Multi-channel mixing matrices and stereo-to-multi-channel conversion\n- **Linear Algebra**: Expression template system for efficient vector operations\n- **no_std Support**: Can be used in environments without the standard library, with optional `alloc` feature\n- **Spacing (Room Reverb)**: Simulate room acoustics with customizable geometry, early reflections, and multi-channel output\n\n## Installation\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\ncute-dsp = \"0.0.2\"\n```\n\n## WebAssembly Support\n\nThis library supports compilation to WebAssembly for use in web browsers and Node.js, with full DSP functionality exposed.\n\nTo build for WASM (no-modules target for broad compatibility):\n\n1. Install `wasm-pack`:\n   ```bash\n   cargo install wasm-pack\n   ```\n\n2. Build the WASM package:\n   ```bash\n   wasm-pack build --target no-modules --out-dir pkg --features wasm\n   ```\n\n3. Use in HTML/JavaScript (no-modules target):\n   ```html\n   \u003c!DOCTYPE html\u003e\n   \u003chtml\u003e\n   \u003chead\u003e\n       \u003cmeta charset=\"utf-8\"\u003e\n       \u003ctitle\u003eCuteDSP WASM Demo\u003c/title\u003e\n   \u003c/head\u003e\n   \u003cbody\u003e\n       \u003cscript src=\"pkg/cute_dsp.js\"\u003e\u003c/script\u003e\n       \u003cscript\u003e\n       async function run() {\n           // Initialize WASM\n           await wasm_bindgen();\n\n           // Create FFT instance\n           const fft = new wasm_bindgen.WasmFFT(1024);\n\n           // Create input arrays\n           const realIn = new Float32Array(1024);\n           const imagIn = new Float32Array(1024);\n           const realOut = new Float32Array(1024);\n           const imagOut = new Float32Array(1024);\n\n           // Fill input with a sine wave\n           for (let i = 0; i \u003c 1024; i++) {\n               realIn[i] = Math.sin(2 * Math.PI * i / 1024);\n               imagIn[i] = 0;\n           }\n\n           // Perform FFT\n           fft.fft_forward(realIn, imagIn, realOut, imagOut);\n\n           // Create and use a biquad filter\n           const filter = new wasm_bindgen.WasmBiquad();\n           filter.lowpass(0.1, 0.7); // Normalized frequency, Q factor\n\n           const audioIn = new Float32Array(1024);\n           const audioOut = new Float32Array(1024);\n           // Fill audioIn with audio data...\n\n           filter.process(audioIn, audioOut);\n\n           // Create a delay line\n           const delay = new wasm_bindgen.WasmDelay(44100); // Max delay samples\n           const delayedSample = delay.process(0.5, 22050.0); // Input sample, delay in samples\n\n           // Create an LFO\n           const lfo = new wasm_bindgen.WasmLFO();\n           lfo.set_params(0.0, 1.0, 5.0, 0.0, 0.0); // low, high, rate, rate_variation, depth_variation\n           const lfoSample = lfo.process();\n\n           // Create window functions\n           const kaiser = new wasm_bindgen.WasmKaiser(0.1); // Beta parameter\n           const windowData = new Float32Array(512);\n           kaiser.fill(windowData);\n\n           // Hann and Hamming windows\n           wasm_bindgen.WasmHann.fill(windowData);\n           wasm_bindgen.WasmHamming.fill(windowData);\n\n           // Create a delay line\n           const delay = new wasm_bindgen.WasmDelay(44100); // Max delay samples\n           const delayedSample = delay.process(0.5, 22050.0); // Input sample, delay in samples\n\n           // Create an LFO\n           const lfo = new wasm_bindgen.WasmLFO();\n           lfo.set_params(0.0, 1.0, 5.0, 0.0, 0.0); // low, high, rate, rate_variation, depth_variation\n           const lfoSample = lfo.process();\n\n           // Create window functions\n           const kaiser = new wasm_bindgen.WasmKaiser(0.1); // Beta parameter\n           const windowData = new Float32Array(512);\n           kaiser.fill(windowData);\n\n           // Hann and Hamming windows\n           wasm_bindgen.WasmHann.fill(windowData);\n           wasm_bindgen.WasmHamming.fill(windowData);\n\n           // Create STFT\n           const stft = new wasm_bindgen.WasmSTFT(false); // false for non-modified\n           stft.configure(1, 1, 512); // input channels, output channels, block size\n\n           // Linear curve mapping\n           const curve = wasm_bindgen.WasmLinearCurve.from_points(0.0, 1.0, 0.0, 100.0);\n           const mappedValue = curve.evaluate(0.5);\n\n           // Sample rate conversion filters\n           const srcFilter = new Float32Array(256);\n           wasm_bindgen.WasmSampleRateConverter.fill_kaiser_sinc_filter(srcFilter, 0.45, 0.55);\n\n           // Spectral utilities\n           const complex = wasm_bindgen.WasmSpectralUtils.mag_phase_to_complex(1.0, 0.5);\n           const magPhase = wasm_bindgen.WasmSpectralUtils.complex_to_mag_phase(1.0, 0.0);\n           const dbValue = wasm_bindgen.WasmSpectralUtils.linear_to_db(10.0);\n\n           // Multi-channel mixing\n           const hadamard = new wasm_bindgen.WasmHadamardMixer(4); // 4-channel mixer\n           const channels = new Float32Array([1.0, 0.5, 0.3, 0.1]);\n           hadamard.mix_in_place(channels);\n\n           console.log('DSP operations completed!');\n       }\n\n       run();\n       \u003c/script\u003e\n   \u003c/body\u003e\n   \u003c/html\u003e\n   ```\n\n   Or try the included real-time demo: `wasm_demo.html`\n\n## Usage Examples\n\n### FFT Example\n\n```rust\nuse cute_dsp::fft::{SimpleFFT, SimpleRealFFT};\nuse num_complex::Complex;\n\nfn fft_example() {\n    // Create a new FFT instance for size 1024\n    let fft = SimpleFFT::\u003cf32\u003e::new(1024);\n\n    // Input and output buffers\n    let mut time_domain = vec![Complex::new(0.0, 0.0); 1024];\n    let mut freq_domain = vec![Complex::new(0.0, 0.0); 1024];\n\n    // Fill input with a sine wave\n    for i in 0..1024 {\n        time_domain[i] = Complex::new((i as f32 * 0.1).sin(), 0.0);\n    }\n\n    // Perform forward FFT\n    fft.fft(\u0026time_domain, \u0026mut freq_domain);\n\n    // Process in frequency domain if needed\n\n    // Perform inverse FFT\n    fft.ifft(\u0026freq_domain, \u0026mut time_domain);\n}\n```\n\n### Biquad Filter Example\n\n```rust\nuse cute_dsp::filters::{Biquad, BiquadDesign, FilterType};\n\nfn filter_example() {\n    // Create a new biquad filter\n    let mut filter = Biquad::\u003cf32\u003e::new(true);\n\n    // Configure as a lowpass filter at 1000 Hz with Q=0.7 (assuming 44.1 kHz sample rate)\n    filter.lowpass(1000.0 / 44100.0, 0.7, BiquadDesign::Cookbook);\n\n    // Process a buffer of audio\n    let mut audio_buffer = vec![0.0; 1024];\n    // Fill buffer with audio data...\n\n    // Apply the filter\n    filter.process_buffer(\u0026mut audio_buffer);\n}\n```\n\n### Delay Line Example\n\n```rust\nuse cute_dsp::delay::{Delay, InterpolatorCubic};\n\nfn delay_example() {\n    // Create a delay line with cubic interpolation and 1 second capacity at 44.1 kHz\n    let mut delay = Delay::new(InterpolatorCubic::\u003cf32\u003e::new(), 44100);\n\n    // Process audio\n    let mut output = 0.0;\n    for _ in 0..1000 {\n        let input = 0.5; // Replace with your input sample\n\n        // Read from the delay line (500 ms delay)\n        output = delay.read(22050.0);\n\n        // Write to the delay line\n        delay.write(input);\n\n        // Use output...\n    }\n}\n```\n\n### Time Stretching and Pitch Shifting Example\n\n```rust\nuse cute_dsp::stretch::SignalsmithStretch;\n\nfn time_stretch_example() {\n    // Create a new stretch processor\n    let mut stretcher = SignalsmithStretch::\u003cf32\u003e::new();\n\n    // Configure for 2x time stretching with pitch shift up 3 semitones\n    stretcher.configure(1, 1024, 256, false); // 1 channel, 1024 block size, 256 interval\n    stretcher.set_transpose_semitones(3.0, 0.5); // Pitch up 3 semitones\n    stretcher.set_formant_semitones(1.0, false); // Formant shift\n\n    // Input and output buffers\n    let input_len = 1024;\n    let output_len = 2048; // 2x longer output\n    let input = vec![vec![0.0; input_len]]; // Fill with audio data\n    let mut output = vec![vec![0.0; output_len]];\n\n    // Process the audio\n    stretcher.process(\u0026input, input_len, \u0026mut output, output_len);\n}\n```\n\n### Multichannel Mixing Example\n\n```rust\nuse cute_dsp::mix::{Hadamard, StereoMultiMixer};\n\nfn mixing_example() {\n    // Create a Hadamard matrix for 4-channel mixing\n    let hadamard = Hadamard::\u003cf32\u003e::new(4);\n\n    // Mix 4 channels in-place\n    let mut data = vec![1.0, 2.0, 3.0, 4.0];\n    hadamard.in_place(\u0026mut data);\n    // data now contains orthogonal mix of input channels\n\n    // Create a stereo-to-multichannel mixer (must be even number of channels)\n    let mixer = StereoMultiMixer::\u003cf32\u003e::new(6);\n\n    // Convert stereo to 6 channels\n    let stereo_input = [0.5, 0.8];\n    let mut multi_output = vec![0.0; 6];\n    mixer.stereo_to_multi(\u0026stereo_input, \u0026mut multi_output);\n\n    // Convert back to stereo\n    let mut stereo_output = [0.0, 0.0];\n    mixer.multi_to_stereo(\u0026multi_output, \u0026mut stereo_output);\n\n    // Apply energy-preserving crossfade\n    let mut to_coeff = 0.0;\n    let mut from_coeff = 0.0;\n    cute_dsp::mix::cheap_energy_crossfade(0.3, \u0026mut to_coeff, \u0026mut from_coeff);\n    // Use coefficients for crossfading between signals\n}\n```\n\n### Spacing (Room Reverb) Example\n\n```rust\nuse cute_dsp::spacing::{Spacing, Position};\n\nfn spacing_example() {\n    // Create a new Spacing effect with a given sample rate\n    let mut spacing = Spacing::\u003cf32\u003e::new(48000.0);\n    // Add source and receiver positions (in meters)\n    let src = spacing.add_source(Position { x: 0.0, y: 0.0, z: 0.0 });\n    let recv = spacing.add_receiver(Position { x: 3.43, y: 0.0, z: 0.0 });\n    // Add a direct path\n    spacing.add_path(src, recv, 1.0, 0.0);\n    // Prepare input and output buffers\n    let mut input = vec![0.0; 500];\n    input[0] = 1.0; // Impulse\n    let mut outputs = vec![vec![0.0; 500]];\n    // Process the input through the effect\n    spacing.process(\u0026[\u0026input], \u0026mut outputs);\n    // outputs[0] now contains the processed signal\n}\n```\n\n## Advanced Usage\n\nFor more advanced usage examples, see the examples directory:\n\n- [FFT Example](examples/fft_example.rs) - Fast Fourier Transform\n- [Filter Example](examples/filter_example.rs) - Biquad filters\n- [Delay Example](examples/delay_example.rs) - Delay lines\n- [STFT Example](examples/stft_example.rs) - Short-time Fourier transform\n- [Stretch Example](examples/stretch_example.rs) - Time stretching and pitch shifting\n- [Curves Example](examples/curves_example.rs) - Curve interpolation\n- [Envelopes Example](examples/envelopes_example.rs) - LFOs and envelope generators\n- [Linear Example](examples/linear_example.rs) - Linear operations\n- [Mix Example](examples/mix_example.rs) - Audio mixing utilities\n- [Performance Example](examples/perf_example.rs) - Performance optimizations\n- [Rates Example](examples/rates_example.rs) - Sample rate conversion\n- [Spectral Example](examples/spectral_example.rs) - Spectral processing\n- [Windows Example](examples/windows_example.rs) - Window functions\n\n## Module Overview\n\n### FFT (`fft` module)\nProvides Fast Fourier Transform implementations optimized for different use cases:\n- `SimpleFFT`: General purpose complex-to-complex FFT\n- `SimpleRealFFT`: Optimized for real-valued inputs\n- Support for non-power-of-2 sizes (factorizable into 2^a × 3^b)\n\n### Filters (`filters` module)\nDigital filter implementations:\n- `Biquad`: Second-order filter section with various design methods\n- Various filter types: lowpass, highpass, bandpass, notch, peaking, etc.\n- Support for filter cascading and multi-channel processing\n\n### Delay (`delay` module)\nDelay line utilities:\n- Various interpolation methods (nearest, linear, cubic)\n- Single and multi-channel delay lines\n- Buffer abstractions for efficient memory usage\n\n### Spectral Processing (`spectral` module)\nFrequency-domain processing tools:\n- Magnitude/phase conversion utilities\n- Phase vocoder techniques for pitch and time manipulation\n- Frequency-domain filtering and manipulation\n\n### STFT (`stft` module)\nShort-time Fourier transform processing:\n- Overlap-add processing framework\n- Window function application\n- Spectral processing utilities\n\n### Stretch (`stretch` module)\nTime stretching and pitch shifting:\n- High-quality phase vocoder implementation using `SignalsmithStretch`\n- Independent control of time and pitch\n- Formant preservation and frequency mapping\n- Real-time processing capabilities\n\n### Mix (`mix` module)\nMultichannel mixing utilities:\n- Orthogonal matrices (Hadamard, Householder) for efficient mixing\n- Stereo to multichannel conversion\n- Energy-preserving crossfading\n\n### Windows (`windows` module)\nWindow functions for spectral processing:\n- Common window types (Hann, Hamming, Kaiser, etc.)\n- Window design utilities\n- Overlap handling and perfect reconstruction\n\n### Envelopes (`envelopes` module)\nLow-frequency oscillators and envelope generators:\n- Precise control with minimal aliasing\n- Multiple waveform types\n- Configurable frequency and amplitude\n\n### Linear (`linear` module)\nLinear algebra utilities:\n- Expression template system for efficient vector operations\n- Optimized mathematical operations\n\n### Curves (`curves` module)\nCurve interpolation:\n- Cubic curve interpolation with control over slope and curvature\n- Smooth parameter transitions\n\n### Rates (`rates` module)\nSample rate conversion:\n- High-quality resampling algorithms\n- Configurable quality settings\n\n### Spacing (`spacing` module)\nProvides a customizable room reverb effect:\n- Multi-tap delay network simulating early reflections\n- 3D source and receiver positioning\n- Adjustable room size, damping, diffusion, bass, decay, and cross-mix\n- Suitable for spatial audio and immersive effects\n\n## Feature Flags\n\n- `std` (default): Use the Rust standard library\n- `alloc`: Enable allocation without std (for no_std environments)\n\n## Performance\n\nThis library is designed with performance in mind and offers several optimizations:\n\n- **SIMD Opportunities**: Code structure allows for SIMD optimizations where applicable\n- **Cache-Friendly Algorithms**: Algorithms are designed to minimize cache misses\n- **Minimal Allocations**: Operations avoid allocations during processing\n- **Trade-offs**: Where appropriate, there are options to trade between quality and performance\n\nFor maximum performance:\n- Use the largest practical buffer sizes for batch processing\n- Reuse processor instances rather than creating new ones\n- Consider using the `f32` type for most audio applications unless higher precision is needed\n- Review the examples in `examples/perf_example.rs` for performance-critical applications\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## Acknowledgments\n\n- Original C++ library: [Signalsmith Audio DSP Library](https://github.com/signalsmith-audio/dsp)\n- Signalsmith Audio's excellent [technical blog](https://signalsmith-audio.co.uk/writing/) with in-depth explanations of DSP concepts\n- The comprehensive [design documentation](https://signalsmith-audio.co.uk/code/stretch/) for the time stretching algorithm\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcutedsp%2Frscutedsp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcutedsp%2Frscutedsp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcutedsp%2Frscutedsp/lists"}