Skip to main content

Fast differentiable audio transforms (STFT, mel, MFCC, CQT, chroma) on CPU and GPU

Project description

auvux-dsp

Fast differentiable audio transforms (STFT, iSTFT, mel, MFCC, CQT/VQT, chroma) plus differentiable scalar/temporal features (spectral moments & flatness, RMS, spectral flux, onset strength, tempogram) with native CPU backends (vDSP on macOS, PFFFT elsewhere) and GPU support (Metal, CUDA). Forward and backward passes run in native kernels; PyTorch autograd plugs in when you pass a torch tensor, and torch is never required otherwise.

import auvux.dsp as dsp

mel = dsp.MelSpectrogram(sr=44100, n_fft=2048, hop_length=512, n_mels=128)
S = mel(y)                       # numpy in -> numpy out
S = mel(y, backend="gpu")        # Metal / CUDA kernels

y = torch.tensor(clip, requires_grad=True)
loss = mel(y, output="db").sum() # native forward
loss.backward()                  # native adjoint kernel, no torch recompute
pip install auvux-dsp --pre    # preview release; drop --pre once 0.1.0 is out

Performance

Benchmarks against librosa and torchaudio (forward passes and full training steps, CPU / staged GPU / GPU-resident) live in benchmarks/benchmark.py:

python benchmarks/benchmark.py

Results table to be published with the first release.

Complex STFT layout

Complex spectra are returned as (..., bins, frames) backed by frame-major memory — each frame's spectrum contiguous, the freq axis strided. This is the same physical layout both references use (librosa allocates its stft output order='F'; torch.stft returns a transposed view over frame-major memory), so values and bytes match librosa, and the GPU-resident path returns a tensor with the exact strides torch.stft produces. It is also what makes the STFT fast: no backend ever materializes the bins-major transpose. istft accepts both this layout (zero-copy) and compact C-order arrays. Float outputs (power/db/mel/...) are ordinary C-contiguous arrays.

Dtypes

Outputs follow the input dtype, torch-style:

input CPU GPU (Metal / CUDA)
float32 / ints (promote) native float32 native float32
float64 / complex128 native double engines (validation grade: torch.autograd.gradcheck passes on every adjoint; librosa-double parity ~1e-10) backend="auto" routes to CPU; explicit GPU backend raises
float16 (torch, GPU-resident) computed in float32, cast back native half kernels (Metal; CUDA planned): f16 in → f16/complex32 out, FFT arithmetic in half with float accumulators — torch.stft-CUDA-half numerics (~1e-3) at half the bandwidth
float16 (numpy / staged) / bfloat16 computed in float32, real outputs cast back to the input dtype same (upcast on device)

torch CPU rejects half-precision FFTs outright and torch cannot create float64 MPS tensors, so this is a superset of torch.stft's dtype matrix. Complex outputs for staged half inputs stay complex64; the native Metal path returns torch.complex32 exactly like torch.stft on CUDA half (normalize signals to ~±1 — half overflows at 65504, like every fp16 pipeline).

FFT sizes

Any even n_fft works, torch-style, picked per size at plan time: powers of two run radix-2 (vDSP on macOS, PFFFT elsewhere), other 2^a·3^b·5^c sizes (96, 384, 960, …) run PFFFT mixed-radix at full speed, and everything else (400, 1000, primes·2, …) falls back to a Bluestein chirp-z on the pow2 engines (~5× a direct FFT — the same penalty torch pays inside pocketfft/cuFFT for such sizes). Whisper's n_fft=400 / hop=160 / 80 mels works out of the box. On GPU, pow2 sizes use the Stockham kernels and any other even size in [64, 4096] uses direct-DFT kernels; gradients flow through every path.

Status: under construction.

  • CPU (vDSP/PFFFT): STFT, ISTFT, MelSpectrogram, MFCC, CQT, VQT, Chroma — forward and native backward, librosa-parity tested, torch autograd built in.
  • Differentiable features: SpectralMoments (centroid, bandwidth, skewness, kurtosis, flatness, slope, decrease, crest, entropy), RMS, SpectralFlux, OnsetStrength, Tempogram — native forward + analytic adjoint, librosa-parity / torch-grad tested.
  • Composed descriptors (built on the transforms above, so they inherit the GPU path and stay differentiable): SpectralContrast, BandEnergy, Tonnetz, ChromaCENS, FourierTempogram. Plus delta (Savitzky-Golay derivative) and pool post-processing over any feature matrix.
  • Metal: every native transform on GPU (n_fft <= 4096), forward + backward, parity-tested against the CPU path. torch MPS tensors stay on the GPU end to end (DLPack), and backend="auto" routes them there — no flags needed.
  • CUDA: kernel-for-kernel twin of the Metal backend including the resident paths; parity-tested on NVIDIA hardware (RTX 4090, CUDA 12.9), with pinned double-buffered staging for the numpy-in/numpy-out GPU paths.
  • Pending: iCQT.

Development

pip install scikit-build-core pybind11 numpy pytest
./scripts/dev-build.sh
pytest
pytest -m soak          # memory-plateau soak (deselected by default)
./scripts/sanitize.sh   # ASan+UBSan+LSan suite; Linux, or via docker (see header)

Note for packagers: python/auvux/ is a PEP 420 namespace package — it must never contain an __init__.py, or it will shadow sibling auvux-* distributions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

auvux_dsp-0.1.0.dev4.tar.gz (268.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

auvux_dsp-0.1.0.dev4-cp313-cp313-win_amd64.whl (4.1 MB view details)

Uploaded CPython 3.13Windows x86-64

auvux_dsp-0.1.0.dev4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

auvux_dsp-0.1.0.dev4-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (4.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

auvux_dsp-0.1.0.dev4-cp313-cp313-macosx_11_0_arm64.whl (439.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

auvux_dsp-0.1.0.dev4-cp313-cp313-macosx_10_13_x86_64.whl (505.2 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

auvux_dsp-0.1.0.dev4-cp312-cp312-win_amd64.whl (4.1 MB view details)

Uploaded CPython 3.12Windows x86-64

auvux_dsp-0.1.0.dev4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

auvux_dsp-0.1.0.dev4-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (4.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

auvux_dsp-0.1.0.dev4-cp312-cp312-macosx_11_0_arm64.whl (439.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

auvux_dsp-0.1.0.dev4-cp312-cp312-macosx_10_13_x86_64.whl (505.2 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

auvux_dsp-0.1.0.dev4-cp311-cp311-win_amd64.whl (4.1 MB view details)

Uploaded CPython 3.11Windows x86-64

auvux_dsp-0.1.0.dev4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

auvux_dsp-0.1.0.dev4-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (4.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

auvux_dsp-0.1.0.dev4-cp311-cp311-macosx_11_0_arm64.whl (438.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

auvux_dsp-0.1.0.dev4-cp311-cp311-macosx_10_9_x86_64.whl (501.9 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

auvux_dsp-0.1.0.dev4-cp310-cp310-win_amd64.whl (4.1 MB view details)

Uploaded CPython 3.10Windows x86-64

auvux_dsp-0.1.0.dev4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

auvux_dsp-0.1.0.dev4-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (4.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

auvux_dsp-0.1.0.dev4-cp310-cp310-macosx_11_0_arm64.whl (437.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

auvux_dsp-0.1.0.dev4-cp310-cp310-macosx_10_9_x86_64.whl (500.7 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file auvux_dsp-0.1.0.dev4.tar.gz.

File metadata

  • Download URL: auvux_dsp-0.1.0.dev4.tar.gz
  • Upload date:
  • Size: 268.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for auvux_dsp-0.1.0.dev4.tar.gz
Algorithm Hash digest
SHA256 94f8c56479245a6ae3f2e93d6ab6663240b105916d4e3d2d5a0dd5b520c4e48c
MD5 d8b78b35b3abf1797f4c1192faa3b560
BLAKE2b-256 ceb0109f93d9dda8a02147468b4f4f6203aea8444c401a878752302763a2ed7e

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8803bc1e3b7962d58757d3debffca7a46eaa340c74c70b66d694c079ed496e1a
MD5 d42b0702c6128b501d8ff11af67ba420
BLAKE2b-256 11ff74f0b14b9b883198c92bf37f2dcb1508f691b02a74dad690603fa4ef32f7

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d80b70ca38948f67ee672b5b25e0d43527a199ae6b232a3f297e9714bef86f64
MD5 e27b2a07236e64c8c3fc4b37cee9f45d
BLAKE2b-256 d067e315d2beff17e4b8665eeac9a205651d5e8c450d0551045dc141c41ac296

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 dcf522f3ac9baa6e886b884893f5fe4a048165692c90280d9223a7ec98c203c2
MD5 2810b46a76a6ab4bb7eb028ca1fd456d
BLAKE2b-256 cab3d23cc4e0c7fd3ad5eca1af2994090c2c5e5344cc9a9f9cc4368b2eafdb5d

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 556f5de265448def672cbc5f155cef413f49cf241335f0bca19a7e298a5d7809
MD5 daa9ecaa4c423038710deb50e06894aa
BLAKE2b-256 ad5187279a7d01826c70814c34c9aa18f024181bb8cd86deca3a6b43335262ff

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 fe87ec464975891bf36124afce5b2f36b6db603ebd0071fd6dcd354562fda1c8
MD5 68bec7cf9f03fc811db301db8c0576b5
BLAKE2b-256 267f270ce05947a3a7e11dbb0d0059407001fd9856790052fcfc3d449766fe77

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b9ca825a901d636c0cfb96c7e87776a2726fe3231e3f34d771d914613bda9e6f
MD5 1efe02624fde7b05c4783ca39a812234
BLAKE2b-256 de8820ab944e357fd18d8ba0178cbcffd692e0c2e08f9e31cb6d5554cf801e7b

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2606ddf2e0aef313dabb2b40cc958d0af2920282d49add142d61f0a9c1a5266c
MD5 f16269a57b85b9f6b9e7c5f4c34bca1a
BLAKE2b-256 181c9c64094056e8ae9ba9f8c50fe1840a1fdea3cbc067d3bc9963d69e25d887

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 98e666ef7e571df0b330ed70b374914614c0c5d16aa2a0f3ac1a6d59a29f86ba
MD5 4c594c0f991533e0cd25245bf62464db
BLAKE2b-256 da6b696aa97ec2512e47a329a9e1d4f393072d216086db31876c7e9368f18bd6

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4604d23886e95501bc84e71b0206bb2f68d4aa880019d7ae62eeb7b1f24e3550
MD5 fc67b865c50da650ca477a19c4b2a7ab
BLAKE2b-256 f383ba02d254df37c7c16a69b5607854db91933e73f8a975c1cdf3fb8eed6b27

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 d6c234ea97fb450aef48355dbd86c64aedac8a48a7d83d3460583a945aac9eba
MD5 852e0ff5941ff45f26cba05f8a5ca79b
BLAKE2b-256 7ca2826f569fb5dba5853921d91b65f2856b78230eaddfa3554f1b78bd2b7162

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 dbad5a900617ebc6499072174f257506a3eb606387737df7a9ab970526ec43d3
MD5 d699b1ca64ff80ee2d5c0cb40bf2beac
BLAKE2b-256 cc2973ead39e175f5be4433315ee13195ff4ca27c5180479cc2107044b6900d7

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 99a9567af2f671188ca6a345f954fa1f8a690e0701da49b99365e88d09e73486
MD5 77bf7a10301082738fef8dd4208f6dba
BLAKE2b-256 5f63ce8b8291d38fdf6b49e132747ad08963ca3bdc95237a55a8835c7b27f6ff

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3ff7eab32bdb8c85601e6e2d69dd4af6af31cad2f6410c321fe3c00873e3b6ea
MD5 14181741704cb9bed112085c8c2c2f98
BLAKE2b-256 38c2a64630d107a06e84b2fc081ca6a33e68e7f96a4e66fc779f60bb876a1bcc

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9a80d9816de73ab12548bae0ef88c52cc9c31cd4efa7bbfa5e3a856c73907c6d
MD5 8cdad4300b2548096096f13aa169be97
BLAKE2b-256 03134218917529a1fa7f51e76607ad89ad802ee08f0e1b87ee8248ff3b3cf409

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fb58c3603bd04e80ec6faa8e4ffb4dd258477cb21d0f9ad1514a25892f966dfd
MD5 9d8c863f31ff006fd3f678b43976ac9d
BLAKE2b-256 ac55f933f6427624704d8b5b23e8d7e6539fc95b77136c4834fb5029c356845f

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4f0abd2a28db42897037de006822918c796c365b98e7c7b98d8ecb332bb221f8
MD5 dfb2fb37cc509e51a77a20941632c421
BLAKE2b-256 5f1702170e668386e7d27c9164dc9cf72cde13ae24c0570e2b064baec0c29bf5

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8ec8d9aad81696ad60a34ac2acc921c3b1d5ce62f74a487b42577fbd1c39760f
MD5 a352e60031f9af826f3a25753447da15
BLAKE2b-256 3a6942dbe5040b1c35eea4032c7e53b9e97ea644039d31c763fc0a032546b739

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6dd8b1761ded61b27fa24a120a510919fad540de164f2cba964954be0548e8d9
MD5 2351f92ee44a33b1423a0a27e567db51
BLAKE2b-256 7db6e96552dc75fc19553a7c87518a07a4c696ef2dc195e1f42b4b813df6e7b8

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 81fdcca26364c6fe602c91e67c3c14363ecf9cd0805e5212a86c053d43987bb9
MD5 f813792c35d2d9ac18b97eef01fcbca9
BLAKE2b-256 f85bfb544f1a2909324e7425d33c999cd150590d93527d5130c78708012801b1

See more details on using hashes here.

File details

Details for the file auvux_dsp-0.1.0.dev4-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for auvux_dsp-0.1.0.dev4-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e40ff7b51f9d97e9dcb13521a05e1b16281c224578c7718f8e79636523b04366
MD5 7407ab3929f4cbe02d5a2825bd2b71aa
BLAKE2b-256 6486f52aad9789846eef193e031de6efae1d1fcf1cd4a59df374beecb3184fcb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page