| Crates.io | torsh-signal |
| lib.rs | torsh-signal |
| version | 0.1.0-alpha.2 |
| created_at | 2025-09-30 01:13:31.159892+00 |
| updated_at | 2025-12-22 04:52:26.821447+00 |
| description | Signal processing utilities for ToRSh with SciRS2 integration |
| homepage | https://github.com/cool-japan/torsh/ |
| repository | https://github.com/cool-japan/torsh/ |
| max_upload_size | |
| id | 1860444 |
| size | 436,280 |
Signal processing operations for the ToRSh deep learning framework.
This crate provides PyTorch-compatible signal processing functionality built on top of the SciRS2 ecosystem for high-performance scientific computing. It leverages scirs2-signal and scirs2-fft to deliver state-of-the-art signal processing operations with excellent performance and PyTorch compatibility.
spectral: STFT, ISTFT, spectrograms, mel-scale filtering (scirs2-fft powered)windows: Various window functions for signal processing (scirs2-signal powered)filters: Convolution and correlation operations (scirs2-signal powered)use torsh_signal::prelude::*;
use torsh_tensor::Tensor;
// Create a signal
let signal: Tensor<f32> = Tensor::randn(&[1000])?;
// Apply Hann window
let window = hann_window(256, false)?;
let windowed = signal.slice(0, 0, 256)? * &window;
// Compute STFT
let stft_result = stft(
&signal,
256, // n_fft
Some(64), // hop_length
Some(256), // win_length
Some(Window::Hann),
true, // center
false, // normalized
true, // onesided
false, // return_complex
)?;
// Compute spectrogram
let spec = spectrogram(
&signal,
512, // n_fft
Some(128), // hop_length
Some(512), // win_length
Some(Window::Hann),
0.0, // power (0.0 for magnitude)
false, // normalized
)?;
torsh-core: Core types and device abstractiontorsh-tensor: Tensor operations and storagetorsh-functional: Functional API componentstorsh-linalg: Linear algebra operationsscirs2-signal: Advanced signal processing algorithms and optimizationsscirs2-fft: High-performance FFT operations with SIMD accelerationscirs2-core: Scientific computing primitives and memory managementnum-complex: Complex number supportnum-traits: Numeric trait abstractionsndarray: Multi-dimensional arrays (via scirs2-core)thiserror: Error handlingtorsh-signal delivers exceptional performance through the SciRS2 ecosystem:
Designed to be a drop-in replacement for PyTorch's signal processing operations:
torch.stft → torsh_signal::stfttorch.istft → torsh_signal::istfttorch.spectrogram → torsh_signal::spectrogramSee the examples/ directory for comprehensive usage examples and PyTorch compatibility demonstrations.