specux 0.0.0__tar.gz → 0.1.0.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- specux-0.1.0.dev1/LICENSE +21 -0
- specux-0.1.0.dev1/MANIFEST.in +12 -0
- specux-0.1.0.dev1/NOTICE +123 -0
- specux-0.1.0.dev1/PKG-INFO +220 -0
- specux-0.1.0.dev1/README.md +172 -0
- specux-0.1.0.dev1/pyproject.toml +163 -0
- specux-0.1.0.dev1/scripts/build.ps1 +43 -0
- specux-0.1.0.dev1/setup.cfg +4 -0
- specux-0.1.0.dev1/setup.py +359 -0
- specux-0.1.0.dev1/specux/__init__.py +82 -0
- specux-0.1.0.dev1/specux/audio/__init__.py +73 -0
- specux-0.1.0.dev1/specux/audio/_io.py +400 -0
- specux-0.1.0.dev1/specux/audio/_meta.py +124 -0
- specux-0.1.0.dev1/specux/audio/_signal.py +198 -0
- specux-0.1.0.dev1/specux/audio/_stream.py +204 -0
- specux-0.1.0.dev1/specux/audio/_types.py +67 -0
- specux-0.1.0.dev1/specux/core/__init__.py +1 -0
- specux-0.1.0.dev1/specux/core/api.py +799 -0
- specux-0.1.0.dev1/specux/core/backend.py +697 -0
- specux-0.1.0.dev1/specux/core/cache.py +75 -0
- specux-0.1.0.dev1/specux/core/config.py +83 -0
- specux-0.1.0.dev1/specux/core/dispatch.py +171 -0
- specux-0.1.0.dev1/specux/core/dtypes.py +8 -0
- specux-0.1.0.dev1/specux/core/fallback.py +115 -0
- specux-0.1.0.dev1/specux/core/fft.py +569 -0
- specux-0.1.0.dev1/specux/core/library.py +1216 -0
- specux-0.1.0.dev1/specux/core/plan.py +199 -0
- specux-0.1.0.dev1/specux/core/typing.py +17 -0
- specux-0.1.0.dev1/specux/core/version.py +6 -0
- specux-0.1.0.dev1/specux/dsp/__init__.py +1 -0
- specux-0.1.0.dev1/specux/dsp/cqt.py +365 -0
- specux-0.1.0.dev1/specux/dsp/cqt_filters.py +184 -0
- specux-0.1.0.dev1/specux/dsp/features.py +527 -0
- specux-0.1.0.dev1/specux/dsp/filters.py +122 -0
- specux-0.1.0.dev1/specux/dsp/transform.py +533 -0
- specux-0.1.0.dev1/specux/interop/__init__.py +1 -0
- specux-0.1.0.dev1/specux/interop/cuda.py +383 -0
- specux-0.1.0.dev1/specux/interop/cupy.py +201 -0
- specux-0.1.0.dev1/specux/interop/metal.py +96 -0
- specux-0.1.0.dev1/specux/interop/metal_transport.py +818 -0
- specux-0.1.0.dev1/specux/interop/torch.py +201 -0
- specux-0.1.0.dev1/specux/py.typed +0 -0
- specux-0.1.0.dev1/specux/transforms.py +250 -0
- specux-0.1.0.dev1/specux.egg-info/PKG-INFO +220 -0
- specux-0.1.0.dev1/specux.egg-info/SOURCES.txt +330 -0
- specux-0.1.0.dev1/specux.egg-info/dependency_links.txt +1 -0
- specux-0.1.0.dev1/specux.egg-info/requires.txt +23 -0
- specux-0.1.0.dev1/specux.egg-info/top_level.txt +1 -0
- specux-0.1.0.dev1/src/audio/av_common.h +30 -0
- specux-0.1.0.dev1/src/audio/buffer.h +24 -0
- specux-0.1.0.dev1/src/audio/decode/dr_decoder.cpp +574 -0
- specux-0.1.0.dev1/src/audio/decode/dr_decoder.h +51 -0
- specux-0.1.0.dev1/src/audio/decode/libav_decoder.cpp +454 -0
- specux-0.1.0.dev1/src/audio/decode/libav_decoder.h +33 -0
- specux-0.1.0.dev1/src/audio/decode/mp3_seek.cpp +334 -0
- specux-0.1.0.dev1/src/audio/decode/mp3_seek.h +71 -0
- specux-0.1.0.dev1/src/audio/encode/libav_encoder.cpp +256 -0
- specux-0.1.0.dev1/src/audio/encode/resampling_writer.h +75 -0
- specux-0.1.0.dev1/src/audio/encode/wav_encoder.cpp +143 -0
- specux-0.1.0.dev1/src/audio/encode/writer.h +63 -0
- specux-0.1.0.dev1/src/audio/error.h +15 -0
- specux-0.1.0.dev1/src/audio/level.h +81 -0
- specux-0.1.0.dev1/src/audio/loudness.h +197 -0
- specux-0.1.0.dev1/src/audio/probe.cpp +55 -0
- specux-0.1.0.dev1/src/audio/probe.h +25 -0
- specux-0.1.0.dev1/src/audio/resample_util.h +74 -0
- specux-0.1.0.dev1/src/audio/sample_fmt.h +23 -0
- specux-0.1.0.dev1/src/audio/simd.h +96 -0
- specux-0.1.0.dev1/src/audio/stream.cpp +107 -0
- specux-0.1.0.dev1/src/audio/stream.h +74 -0
- specux-0.1.0.dev1/src/audio/tags.cpp +215 -0
- specux-0.1.0.dev1/src/audio/tags.h +54 -0
- specux-0.1.0.dev1/src/bindings/bind_cepstra_cpu.cpp +100 -0
- specux-0.1.0.dev1/src/bindings/bind_common_cpu.h +77 -0
- specux-0.1.0.dev1/src/bindings/bind_conv_cpu.cpp +124 -0
- specux-0.1.0.dev1/src/bindings/bind_cqt_cpu.cpp +195 -0
- specux-0.1.0.dev1/src/bindings/bind_fft_cpu.cpp +85 -0
- specux-0.1.0.dev1/src/bindings/bind_istft_cpu.cpp +84 -0
- specux-0.1.0.dev1/src/bindings/bind_mel_cpu.cpp +138 -0
- specux-0.1.0.dev1/src/bindings/bind_stft_cpu.cpp +171 -0
- specux-0.1.0.dev1/src/bindings/torch_mps_shim.mm +47 -0
- specux-0.1.0.dev1/src/codegen/backend.h +271 -0
- specux-0.1.0.dev1/src/codegen/builder.h +194 -0
- specux-0.1.0.dev1/src/codegen/dialect.h +46 -0
- specux-0.1.0.dev1/src/codegen/epilogue.h +92 -0
- specux-0.1.0.dev1/src/codegen/fft/bluestein.h +331 -0
- specux-0.1.0.dev1/src/codegen/fft/cores.h +24 -0
- specux-0.1.0.dev1/src/codegen/fft/factor.h +558 -0
- specux-0.1.0.dev1/src/codegen/fft/pow2.h +273 -0
- specux-0.1.0.dev1/src/codegen/fft/rader.h +182 -0
- specux-0.1.0.dev1/src/codegen/fft/radix.h +172 -0
- specux-0.1.0.dev1/src/codegen/fft/real.h +252 -0
- specux-0.1.0.dev1/src/codegen/fft/regs.h +1057 -0
- specux-0.1.0.dev1/src/codegen/fft/shared.h +156 -0
- specux-0.1.0.dev1/src/codegen/fft/stft.h +156 -0
- specux-0.1.0.dev1/src/codegen/fft/stockham.h +213 -0
- specux-0.1.0.dev1/src/codegen/ops/adjoint.h +371 -0
- specux-0.1.0.dev1/src/codegen/ops/cepstra.h +184 -0
- specux-0.1.0.dev1/src/codegen/ops/conv.h +140 -0
- specux-0.1.0.dev1/src/codegen/ops/cqt.h +307 -0
- specux-0.1.0.dev1/src/codegen/ops/istft.h +202 -0
- specux-0.1.0.dev1/src/codegen/ops/mel.h +228 -0
- specux-0.1.0.dev1/src/codegen/ops/stft.h +73 -0
- specux-0.1.0.dev1/src/codegen/prologue.h +131 -0
- specux-0.1.0.dev1/src/codegen/spec.h +454 -0
- specux-0.1.0.dev1/src/codegen/window.h +37 -0
- specux-0.1.0.dev1/src/codegen.h +26 -0
- specux-0.1.0.dev1/src/core/fs.h +50 -0
- specux-0.1.0.dev1/src/core/half.h +42 -0
- specux-0.1.0.dev1/src/core/host_pool.cpp +113 -0
- specux-0.1.0.dev1/src/core/host_pool.h +43 -0
- specux-0.1.0.dev1/src/core/numpy_util.h +74 -0
- specux-0.1.0.dev1/src/core/threadpool.cpp +358 -0
- specux-0.1.0.dev1/src/core/threadpool.h +45 -0
- specux-0.1.0.dev1/src/cpu/db.h +124 -0
- specux-0.1.0.dev1/src/cpu/fft/bluestein.h +115 -0
- specux-0.1.0.dev1/src/cpu/fft/c2c.h +95 -0
- specux-0.1.0.dev1/src/cpu/fft/engine.h +24 -0
- specux-0.1.0.dev1/src/cpu/fft/pool.h +160 -0
- specux-0.1.0.dev1/src/cpu/fft/real.h +492 -0
- specux-0.1.0.dev1/src/cpu/fft/row_engine.h +747 -0
- specux-0.1.0.dev1/src/cpu/fft/tile_engine.h +1310 -0
- specux-0.1.0.dev1/src/cpu/fft/twiddle.h +60 -0
- specux-0.1.0.dev1/src/cpu/framing.h +85 -0
- specux-0.1.0.dev1/src/cpu/ops/adjoint.h +185 -0
- specux-0.1.0.dev1/src/cpu/ops/cepstra.h +124 -0
- specux-0.1.0.dev1/src/cpu/ops/conv.h +173 -0
- specux-0.1.0.dev1/src/cpu/ops/cqt.h +299 -0
- specux-0.1.0.dev1/src/cpu/ops/istft.h +115 -0
- specux-0.1.0.dev1/src/cpu/ops/mel.h +79 -0
- specux-0.1.0.dev1/src/cpu/ops/stft.h +76 -0
- specux-0.1.0.dev1/src/cpu/real_fft.h +145 -0
- specux-0.1.0.dev1/src/cpu/simd.h +438 -0
- specux-0.1.0.dev1/src/cpu/types.h +34 -0
- specux-0.1.0.dev1/src/cuda/adjoint.h +752 -0
- specux-0.1.0.dev1/src/cuda/compile.h +140 -0
- specux-0.1.0.dev1/src/cuda/context.h +77 -0
- specux-0.1.0.dev1/src/cuda/cuda_check.h +49 -0
- specux-0.1.0.dev1/src/cuda/cuda_toolkit.h +42 -0
- specux-0.1.0.dev1/src/cuda/device_pool.h +118 -0
- specux-0.1.0.dev1/src/cuda/fft_plan.h +61 -0
- specux-0.1.0.dev1/src/cuda/nvrtc_dl.h +95 -0
- specux-0.1.0.dev1/src/cuda/ops.h +528 -0
- specux-0.1.0.dev1/src/cuda/plan.h +273 -0
- specux-0.1.0.dev1/src/cuda/raw.h +2143 -0
- specux-0.1.0.dev1/src/cuda/tables.h +277 -0
- specux-0.1.0.dev1/src/dsp/dct.h +25 -0
- specux-0.1.0.dev1/src/dsp/frames.h +32 -0
- specux-0.1.0.dev1/src/dsp/mel_csr.h +65 -0
- specux-0.1.0.dev1/src/dsp/memo_key.h +78 -0
- specux-0.1.0.dev1/src/dsp/twiddles.h +125 -0
- specux-0.1.0.dev1/src/dsp/window.h +91 -0
- specux-0.1.0.dev1/src/metal/adjoint.h +442 -0
- specux-0.1.0.dev1/src/metal/buffers.h +49 -0
- specux-0.1.0.dev1/src/metal/chains.h +1007 -0
- specux-0.1.0.dev1/src/metal/compile.h +58 -0
- specux-0.1.0.dev1/src/metal/context.h +105 -0
- specux-0.1.0.dev1/src/metal/conv.h +343 -0
- specux-0.1.0.dev1/src/metal/device_pool.h +87 -0
- specux-0.1.0.dev1/src/metal/dlpack.h +48 -0
- specux-0.1.0.dev1/src/metal/factor.h +293 -0
- specux-0.1.0.dev1/src/metal/fft.h +203 -0
- specux-0.1.0.dev1/src/metal/ops.h +640 -0
- specux-0.1.0.dev1/src/metal/tables.h +138 -0
- specux-0.1.0.dev1/src/specux_audio.cpp +860 -0
- specux-0.1.0.dev1/src/specux_cpu.cpp +27 -0
- specux-0.1.0.dev1/src/specux_cuda.cpp +179 -0
- specux-0.1.0.dev1/src/specux_metal.mm +135 -0
- specux-0.1.0.dev1/src/third_party/dlpack-LICENSE +205 -0
- specux-0.1.0.dev1/src/third_party/dlpack.h +653 -0
- specux-0.1.0.dev1/src/third_party/dr_flac.h +12698 -0
- specux-0.1.0.dev1/src/third_party/dr_mp3.h +5412 -0
- specux-0.1.0.dev1/src/third_party/dr_wav.h +9131 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/Foundation.hpp +45 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSArray.hpp +115 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSAutoreleasePool.hpp +83 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSBundle.hpp +374 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSData.hpp +54 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSDate.hpp +40 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSDefines.hpp +41 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSDictionary.hpp +128 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSEnumerator.hpp +78 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSError.hpp +173 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSLock.hpp +105 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSNotification.hpp +67 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSNumber.hpp +501 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSObjCRuntime.hpp +43 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSObject.hpp +297 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSPrivate.hpp +488 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSProcessInfo.hpp +354 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSRange.hpp +83 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSString.hpp +245 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSTypes.hpp +51 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Foundation/NSURL.hpp +90 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/LICENSE.txt +202 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLAccelerationStructure.hpp +932 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLAccelerationStructureCommandEncoder.hpp +144 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLAccelerationStructureTypes.hpp +169 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLArgument.hpp +655 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLArgumentEncoder.hpp +250 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLBinaryArchive.hpp +138 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLBlitCommandEncoder.hpp +246 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLBlitPass.hpp +165 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLBuffer.hpp +101 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLCaptureManager.hpp +220 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLCaptureScope.hpp +92 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLCommandBuffer.hpp +465 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLCommandEncoder.hpp +101 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLCommandQueue.hpp +89 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLComputeCommandEncoder.hpp +337 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLComputePass.hpp +181 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLComputePipeline.hpp +357 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLCounters.hpp +258 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLDefines.hpp +41 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLDepthStencil.hpp +269 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLDevice.hpp +1254 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLDrawable.hpp +99 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLDynamicLibrary.hpp +82 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLEvent.hpp +163 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLFence.hpp +57 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLFunctionConstantValues.hpp +85 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLFunctionDescriptor.hpp +156 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLFunctionHandle.hpp +61 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLFunctionLog.hpp +114 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLFunctionStitching.hpp +305 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLHeaderBridge.hpp +2047 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLHeap.hpp +282 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLIndirectCommandBuffer.hpp +189 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLIndirectCommandEncoder.hpp +187 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLIntersectionFunctionTable.hpp +157 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLLibrary.hpp +621 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLLinkedFunctions.hpp +115 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLParallelRenderCommandEncoder.hpp +94 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLPipeline.hpp +109 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLPixelFormat.hpp +173 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLPrivate.hpp +135 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLRasterizationRate.hpp +386 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLRenderCommandEncoder.hpp +958 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLRenderPass.hpp +786 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLRenderPipeline.hpp +1212 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLResource.hpp +178 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLResourceStateCommandEncoder.hpp +94 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLResourceStatePass.hpp +165 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLSampler.hpp +310 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLStageInputOutputDescriptor.hpp +381 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLTexture.hpp +658 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLTypes.hpp +163 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLVertexDescriptor.hpp +344 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/MTLVisibleFunctionTable.hpp +96 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/Metal/Metal.hpp +80 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/QuartzCore/CADefines.hpp +41 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/QuartzCore/CAMetalDrawable.hpp +57 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/QuartzCore/CAPrivate.hpp +109 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/QuartzCore/QuartzCore.hpp +27 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/README.md +245 -0
- specux-0.1.0.dev1/src/third_party/metal-cpp/SingleHeader/MakeSingleHeader.py +271 -0
- specux-0.1.0.dev1/src/third_party/minimp3-LICENSE +11 -0
- specux-0.1.0.dev1/src/third_party/minimp3.h +1865 -0
- specux-0.1.0.dev1/src/third_party/minimp3_ex.h +1436 -0
- specux-0.1.0.dev1/src/third_party/soxr/LICENCE +23 -0
- specux-0.1.0.dev1/src/third_party/soxr/aliases.h +39 -0
- specux-0.1.0.dev1/src/third_party/soxr/ccrw2.h +75 -0
- specux-0.1.0.dev1/src/third_party/soxr/cr-core.c +314 -0
- specux-0.1.0.dev1/src/third_party/soxr/cr.c +588 -0
- specux-0.1.0.dev1/src/third_party/soxr/cr.h +178 -0
- specux-0.1.0.dev1/src/third_party/soxr/cr32.c +8 -0
- specux-0.1.0.dev1/src/third_party/soxr/cr32s.c +8 -0
- specux-0.1.0.dev1/src/third_party/soxr/data-io.c +223 -0
- specux-0.1.0.dev1/src/third_party/soxr/data-io.h +39 -0
- specux-0.1.0.dev1/src/third_party/soxr/dbesi0.c +149 -0
- specux-0.1.0.dev1/src/third_party/soxr/dev32s.h +54 -0
- specux-0.1.0.dev1/src/third_party/soxr/dev64s.h +42 -0
- specux-0.1.0.dev1/src/third_party/soxr/fft4g.c +1346 -0
- specux-0.1.0.dev1/src/third_party/soxr/fft4g.h +23 -0
- specux-0.1.0.dev1/src/third_party/soxr/fft4g32.c +37 -0
- specux-0.1.0.dev1/src/third_party/soxr/fft4g64.c +36 -0
- specux-0.1.0.dev1/src/third_party/soxr/fft4g_cache.h +92 -0
- specux-0.1.0.dev1/src/third_party/soxr/fifo.h +125 -0
- specux-0.1.0.dev1/src/third_party/soxr/filter.c +277 -0
- specux-0.1.0.dev1/src/third_party/soxr/filter.h +44 -0
- specux-0.1.0.dev1/src/third_party/soxr/half-coefs.h +75 -0
- specux-0.1.0.dev1/src/third_party/soxr/half-fir.h +61 -0
- specux-0.1.0.dev1/src/third_party/soxr/internal.h +84 -0
- specux-0.1.0.dev1/src/third_party/soxr/math-wrap.h +31 -0
- specux-0.1.0.dev1/src/third_party/soxr/pffft-avx.h +40 -0
- specux-0.1.0.dev1/src/third_party/soxr/pffft-wrap.c +110 -0
- specux-0.1.0.dev1/src/third_party/soxr/pffft.c +1948 -0
- specux-0.1.0.dev1/src/third_party/soxr/pffft.h +197 -0
- specux-0.1.0.dev1/src/third_party/soxr/pffft32s.c +34 -0
- specux-0.1.0.dev1/src/third_party/soxr/poly-fir.h +150 -0
- specux-0.1.0.dev1/src/third_party/soxr/poly-fir0.h +56 -0
- specux-0.1.0.dev1/src/third_party/soxr/rdft.h +31 -0
- specux-0.1.0.dev1/src/third_party/soxr/rdft_t.h +24 -0
- specux-0.1.0.dev1/src/third_party/soxr/rint-clip.h +160 -0
- specux-0.1.0.dev1/src/third_party/soxr/rint.h +102 -0
- specux-0.1.0.dev1/src/third_party/soxr/samplerate.h +1 -0
- specux-0.1.0.dev1/src/third_party/soxr/soxr-config.h +20 -0
- specux-0.1.0.dev1/src/third_party/soxr/soxr-lsr.h +78 -0
- specux-0.1.0.dev1/src/third_party/soxr/soxr.c +850 -0
- specux-0.1.0.dev1/src/third_party/soxr/soxr.h +344 -0
- specux-0.1.0.dev1/src/third_party/soxr/std-types.h +48 -0
- specux-0.1.0.dev1/src/third_party/soxr/util-simd.c +89 -0
- specux-0.1.0.dev1/src/third_party/soxr/util32s.c +8 -0
- specux-0.1.0.dev1/src/third_party/soxr/util32s.h +23 -0
- specux-0.1.0.dev1/src/third_party/soxr/util64s.h +23 -0
- specux-0.1.0.dev1/src/third_party/soxr/vr-coefs.h +94 -0
- specux-0.1.0.dev1/src/third_party/soxr/vr32.c +651 -0
- specux-0.1.0.dev1/tests/test_audio_io.py +960 -0
- specux-0.1.0.dev1/tests/test_autograd.py +253 -0
- specux-0.1.0.dev1/tests/test_classes.py +98 -0
- specux-0.1.0.dev1/tests/test_config.py +51 -0
- specux-0.1.0.dev1/tests/test_cqt.py +334 -0
- specux-0.1.0.dev1/tests/test_deterministic.py +60 -0
- specux-0.1.0.dev1/tests/test_dispatch.py +104 -0
- specux-0.1.0.dev1/tests/test_features.py +107 -0
- specux-0.1.0.dev1/tests/test_fft.py +260 -0
- specux-0.1.0.dev1/tests/test_fft_plan.py +82 -0
- specux-0.1.0.dev1/tests/test_istft.py +70 -0
- specux-0.1.0.dev1/tests/test_layouts.py +133 -0
- specux-0.1.0.dev1/tests/test_leaks.py +84 -0
- specux-0.1.0.dev1/tests/test_mel.py +79 -0
- specux-0.1.0.dev1/tests/test_modules.py +36 -0
- specux-0.1.0.dev1/tests/test_native_routes.py +553 -0
- specux-0.1.0.dev1/tests/test_plans.py +70 -0
- specux-0.1.0.dev1/tests/test_stft.py +180 -0
- specux-0.1.0.dev1/tests/test_torch_autocast.py +95 -0
- specux-0.1.0.dev1/tests/test_torch_compile.py +329 -0
- specux-0.1.0.dev1/tests/test_transport_cuda.py +87 -0
- specux-0.1.0.dev1/tests/test_transport_cuda_pointer.py +63 -0
- specux-0.1.0.dev1/tests/test_transport_cupy.py +92 -0
- specux-0.1.0.dev1/tests/test_transport_metal.py +437 -0
- specux-0.1.0.dev1/tests/test_validation.py +120 -0
- specux-0.0.0/PKG-INFO +0 -20
- specux-0.0.0/README.md +0 -6
- specux-0.0.0/pyproject.toml +0 -24
- specux-0.0.0/src/specux/__init__.py +0 -6
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Peter Kiers
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# The sdist must carry everything a source build compiles against: setuptools
|
|
2
|
+
# auto-includes ext_modules sources but not headers, platform-conditional
|
|
3
|
+
# sources, or the vendored metal-cpp.
|
|
4
|
+
recursive-include src *.h *.hpp *.c *.cpp *.mm
|
|
5
|
+
recursive-include src/third_party/metal-cpp *
|
|
6
|
+
# vendored license texts (extensionless / non-source), so the sdist carries
|
|
7
|
+
# every third-party notice (soxr LGPL LICENCE, DLPack + minimp3 dedications)
|
|
8
|
+
recursive-include src/third_party *LICENSE *LICENCE *COPYING
|
|
9
|
+
include NOTICE
|
|
10
|
+
include scripts/build.ps1
|
|
11
|
+
prune build
|
|
12
|
+
prune dist
|
specux-0.1.0.dev1/NOTICE
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
specux third-party notices
|
|
2
|
+
===========================
|
|
3
|
+
|
|
4
|
+
specux itself is licensed under the MIT License (see LICENSE). All GPU kernels
|
|
5
|
+
are generated by its own C++ codegen (src/codegen.h) and compiled at runtime;
|
|
6
|
+
no third-party FFT library is linked into them.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
=======================================================================
|
|
10
|
+
Vendored source
|
|
11
|
+
=======================================================================
|
|
12
|
+
|
|
13
|
+
DLPack (Apache-2.0)
|
|
14
|
+
https://github.com/dmlc/dlpack
|
|
15
|
+
src/third_party/dlpack.h, the tensor-exchange header used by the Metal
|
|
16
|
+
resident paths. Full license text in src/third_party/dlpack-LICENSE.
|
|
17
|
+
|
|
18
|
+
metal-cpp (Apache-2.0, Apple)
|
|
19
|
+
src/third_party/metal-cpp, C++ bindings for the Metal API, used by the
|
|
20
|
+
specux._metal extension on macOS. License in metal-cpp/LICENSE.txt.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
=======================================================================
|
|
24
|
+
Build / runtime dependencies (not vendored)
|
|
25
|
+
=======================================================================
|
|
26
|
+
|
|
27
|
+
pybind11 (BSD-3)
|
|
28
|
+
Extension bindings, build-time.
|
|
29
|
+
|
|
30
|
+
NVIDIA CUDA / NVRTC (NVIDIA SLA)
|
|
31
|
+
Loaded at runtime by specux._cuda from a toolkit install or the nvidia-*
|
|
32
|
+
pip wheels.
|
|
33
|
+
|
|
34
|
+
PyTorch (BSD-3)
|
|
35
|
+
Optional; enables the resident-tensor and autograd paths.
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
=======================================================================
|
|
39
|
+
Audio module: vendored (compiled into specux._audio)
|
|
40
|
+
=======================================================================
|
|
41
|
+
|
|
42
|
+
soxr (dofuuz fork)
|
|
43
|
+
src/third_party/soxr/
|
|
44
|
+
Sample-rate conversion (all quality= resampling). Fork of the SoX
|
|
45
|
+
Resampler Library with PFFFT and NEON/SIMD paths.
|
|
46
|
+
License: LGPL-2.1-or-later (see src/third_party/soxr/LICENCE).
|
|
47
|
+
Upstream: https://github.com/dofuuz/soxr
|
|
48
|
+
(fork of https://sourceforge.net/projects/soxr/).
|
|
49
|
+
|
|
50
|
+
LGPL compliance: soxr is built as its own shared library
|
|
51
|
+
(libspecux_soxr.dylib/.so, shipped next to the extension and resolved via
|
|
52
|
+
@loader_path / $ORIGIN), so users can replace or relink it as LGPL-2.1
|
|
53
|
+
section 6 requires. SPECUX_SOXR_STATIC=1 compiles it into the extension
|
|
54
|
+
instead, a dev-only convenience; wheels must not be built that way. This
|
|
55
|
+
does not affect the MIT licensing of specux's own code.
|
|
56
|
+
|
|
57
|
+
The soxr tree includes PFFFT (Julien Pommier; BSD-like FFTPACK license),
|
|
58
|
+
compiled as part of the fork. It also includes the Ooura FFT and Bessel
|
|
59
|
+
routines (soxr/fft4g64.c, fft4g32.c, dbesi0.c; Copyright Takuya Ooura
|
|
60
|
+
1996-2001), which carry a permissive "use freely" notice in their file
|
|
61
|
+
headers.
|
|
62
|
+
|
|
63
|
+
dr_wav
|
|
64
|
+
src/third_party/dr_wav.h
|
|
65
|
+
WAV/PCM decode and encode by David Reid. Public domain (Unlicense) or
|
|
66
|
+
MIT-0, at your choice. Upstream: https://github.com/mackron/dr_libs
|
|
67
|
+
|
|
68
|
+
dr_mp3
|
|
69
|
+
src/third_party/dr_mp3.h
|
|
70
|
+
MP3 decoder by David Reid, built on the minimp3 engine by lieff. Public
|
|
71
|
+
domain (Unlicense) or MIT-0, at your choice.
|
|
72
|
+
Upstream: https://github.com/mackron/dr_libs
|
|
73
|
+
|
|
74
|
+
dr_flac
|
|
75
|
+
src/third_party/dr_flac.h
|
|
76
|
+
FLAC decoder by David Reid. Public domain (Unlicense) or MIT-0, at your
|
|
77
|
+
choice. Upstream: https://github.com/mackron/dr_libs
|
|
78
|
+
|
|
79
|
+
minimp3 / minimp3_ex
|
|
80
|
+
src/third_party/minimp3.h, minimp3_ex.h
|
|
81
|
+
MP3 decoder with sample-accurate seeking (used for windowed MP3 reads),
|
|
82
|
+
by lieff. CC0-1.0 (public domain; see src/third_party/minimp3-LICENSE).
|
|
83
|
+
Upstream: https://github.com/lieff/minimp3
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
=======================================================================
|
|
87
|
+
Audio module: dynamically linked (bundled as shared libraries in wheels)
|
|
88
|
+
=======================================================================
|
|
89
|
+
|
|
90
|
+
TagLib (libtag)
|
|
91
|
+
Metadata read and write (tags, write_tags, cover, write_cover): ID3v1/v2,
|
|
92
|
+
Vorbis comments, MP4 atoms, and APE, parsed uniformly across formats.
|
|
93
|
+
Dual-licensed LGPL-2.1 / MPL-1.1. Where specux links TagLib statically
|
|
94
|
+
(the Windows dev build from scripts/get_taglib.ps1, unmodified sources,
|
|
95
|
+
zlib disabled), the MPL-1.1 license is elected: MPL is file-scoped and
|
|
96
|
+
permits static combination, requiring only that the covered files remain
|
|
97
|
+
available under MPL, which upstream provides. A dynamically linked build
|
|
98
|
+
satisfies either license. Optional at build time: without TagLib the tag
|
|
99
|
+
functions raise and everything else works. Upstream: https://taglib.org
|
|
100
|
+
|
|
101
|
+
FFmpeg (libavformat, libavcodec, libavutil, libswresample)
|
|
102
|
+
Used for FLAC/OGG/MP4-AAC and other container decode, all compressed
|
|
103
|
+
encoding (save to flac/mp3/ogg/m4a), and sample-format conversion inside
|
|
104
|
+
those paths (libswresample converts codec sample formats to float; it does
|
|
105
|
+
not do rate conversion, that is soxr, above).
|
|
106
|
+
LGPL-2.1-or-later when built without GPL/nonfree components
|
|
107
|
+
(--disable-gpl --disable-nonfree, which is how release wheels must be
|
|
108
|
+
built). FFmpeg is linked dynamically; the shared libraries are bundled in
|
|
109
|
+
the wheel (delocate/auditwheel) and remain replaceable, satisfying the
|
|
110
|
+
LGPL. License and source: https://ffmpeg.org and
|
|
111
|
+
https://github.com/FFmpeg/FFmpeg.
|
|
112
|
+
|
|
113
|
+
The minimal FFmpeg (scripts/get_ffmpeg.sh on macOS, the BtbN lgpl-shared
|
|
114
|
+
build on Windows) enables no GPL or nonfree encoders. The external codec
|
|
115
|
+
libraries it links:
|
|
116
|
+
libmp3lame LGPL-2.1-or-later MP3 encode https://lame.sourceforge.io
|
|
117
|
+
libvorbis BSD-3-Clause Ogg Vorbis https://xiph.org/vorbis
|
|
118
|
+
libogg BSD-3-Clause Ogg container https://xiph.org/ogg
|
|
119
|
+
libopus BSD-3-Clause Opus https://opus-codec.org
|
|
120
|
+
libmp3lame (LGPL) is built as its own shared library and linked
|
|
121
|
+
dynamically, so it stays replaceable for the same section-6 reason as
|
|
122
|
+
FFmpeg itself; the BSD codecs fold in statically and carry attribution
|
|
123
|
+
only.
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: specux
|
|
3
|
+
Version: 0.1.0.dev1
|
|
4
|
+
Summary: Differentiable audio DSP for Python: fast, fused kernels on GPU and CPU
|
|
5
|
+
Author-email: Peter Kiers <pkiers.1983@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://specux.com
|
|
8
|
+
Project-URL: Documentation, https://specux.com
|
|
9
|
+
Project-URL: Repository, https://github.com/auvux/specux
|
|
10
|
+
Project-URL: Issues, https://github.com/auvux/specux/issues
|
|
11
|
+
Keywords: stft,istft,spectrogram,mel,fft,dsp,audio,cuda,metal
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: C++
|
|
20
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
21
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
22
|
+
Classifier: Operating System :: MacOS
|
|
23
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering
|
|
25
|
+
Classifier: Typing :: Typed
|
|
26
|
+
Requires-Python: >=3.10
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
License-File: NOTICE
|
|
30
|
+
Requires-Dist: numpy>=1.22
|
|
31
|
+
Provides-Extra: torch
|
|
32
|
+
Requires-Dist: torch; extra == "torch"
|
|
33
|
+
Provides-Extra: cuda
|
|
34
|
+
Requires-Dist: nvidia-cuda-nvrtc-cu12; extra == "cuda"
|
|
35
|
+
Requires-Dist: nvidia-cuda-runtime-cu12; extra == "cuda"
|
|
36
|
+
Provides-Extra: cuda12
|
|
37
|
+
Requires-Dist: nvidia-cuda-nvrtc-cu12; extra == "cuda12"
|
|
38
|
+
Requires-Dist: nvidia-cuda-runtime-cu12; extra == "cuda12"
|
|
39
|
+
Provides-Extra: cuda13
|
|
40
|
+
Requires-Dist: nvidia-cuda-nvrtc<14,>=13; extra == "cuda13"
|
|
41
|
+
Requires-Dist: nvidia-cuda-runtime<14,>=13; extra == "cuda13"
|
|
42
|
+
Provides-Extra: test
|
|
43
|
+
Requires-Dist: pytest; extra == "test"
|
|
44
|
+
Requires-Dist: torch; extra == "test"
|
|
45
|
+
Provides-Extra: wheeltest
|
|
46
|
+
Requires-Dist: pytest; extra == "wheeltest"
|
|
47
|
+
Dynamic: license-file
|
|
48
|
+
|
|
49
|
+
# specux
|
|
50
|
+
|
|
51
|
+
[](LICENSE)
|
|
52
|
+
|
|
53
|
+
Differentiable audio DSP for Python: fast, fused kernels on GPU and CPU.
|
|
54
|
+
|
|
55
|
+
Spectral transforms, an FFT family, and audio I/O, on numpy, torch, and cupy
|
|
56
|
+
arrays alike.
|
|
57
|
+
|
|
58
|
+
Documentation: <https://specux.com>
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
import specux
|
|
62
|
+
|
|
63
|
+
y, sr = specux.audio.load("song.flac", sr=16000, mono=True)
|
|
64
|
+
M = specux.melspectrogram(y, sr=sr, n_fft=1024, n_mels=80)
|
|
65
|
+
|
|
66
|
+
import torch
|
|
67
|
+
x = torch.randn(8, 32768, device="cuda", requires_grad=True)
|
|
68
|
+
S = specux.stft(x, n_fft=1024, output="power") # stays on the GPU
|
|
69
|
+
S.sum().backward() # native adjoint kernels
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Arrays go in and come out in their own library: numpy in, numpy out; torch in,
|
|
73
|
+
torch out (resident on its device, differentiable); cupy in, cupy out. The GPU
|
|
74
|
+
kernels are generated in C++ and compiled at runtime (NVRTC for CUDA, MSL for
|
|
75
|
+
Metal), so one build covers every size, precision, and output mode; the CPU
|
|
76
|
+
backend carries the same transforms and adjoints, so training works without
|
|
77
|
+
a GPU.
|
|
78
|
+
|
|
79
|
+
## What's in the box
|
|
80
|
+
|
|
81
|
+
- **Spectral transforms**: `stft` / `istft`, `melspectrogram`, `mfcc`, `lfcc`,
|
|
82
|
+
`cqt` / `vqt` / `chroma`, with output modes `complex` / `magnitude` /
|
|
83
|
+
`power` / `db` and configured class twins (`specux.STFT`, `specux.MFCC`,
|
|
84
|
+
...). `specux.transforms` adds torch `nn.Module` wrappers with
|
|
85
|
+
torchaudio-shaped defaults.
|
|
86
|
+
- **FFT family**: `fft` / `ifft` / `rfft` / `irfft` at any length (powers of
|
|
87
|
+
two, smooth sizes, primes) and precision (float32, float64, and float16
|
|
88
|
+
storage with float32 compute), plus reusable plans (`fft_plan`,
|
|
89
|
+
`stft_plan` with optional autotuning).
|
|
90
|
+
- **Audio I/O** (`specux.audio`): decode and encode WAV/FLAC/MP3/OGG/MP4,
|
|
91
|
+
frame-accurate `offset`/`duration`, batch `load_many`/`save_many`,
|
|
92
|
+
streaming readers and writers for multi-hour files, resampling, loudness /
|
|
93
|
+
true-peak / loudness-range metering, and tags/cover metadata.
|
|
94
|
+
- **torch integration**: every entry point is a `torch.library` custom op, so
|
|
95
|
+
`torch.compile(fullgraph=True)` traces without graph breaks and
|
|
96
|
+
`torch.autocast` computes in float32. torch stays optional: without it,
|
|
97
|
+
numpy arrays run on the CPU engine or the torch-free CUDA runtime.
|
|
98
|
+
- **Runtime options**: `specux.deterministic(True)` switches overlap-adds to
|
|
99
|
+
bitwise-reproducible kernels (and follows
|
|
100
|
+
`torch.use_deterministic_algorithms`); `specux.benchmark(True)` autotunes
|
|
101
|
+
new configurations once and caches the result on disk.
|
|
102
|
+
|
|
103
|
+
## Install
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pip install specux # CPU everywhere; CUDA/Metal where the wheel includes them
|
|
107
|
+
pip install specux[cuda12] # + NVRTC and CUDA headers from NVIDIA's pip wheels
|
|
108
|
+
pip install specux[cuda13] # the same for CUDA 13
|
|
109
|
+
pip install specux[torch] # torch bundles its own CUDA, nothing extra needed
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Or from source, in the environment you plan to use it in:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
pip install -e .
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The build is torch-free (no libtorch anywhere), so one build serves numpy,
|
|
119
|
+
cupy, and whichever torch is installed at runtime. Python >= 3.10,
|
|
120
|
+
numpy >= 1.22; torch optional (>= 2.4 for autograd and `torch.compile`,
|
|
121
|
+
>= 2.7 for resident Metal).
|
|
122
|
+
|
|
123
|
+
- **CUDA**: builds when a toolkit is found (`SPECUX_CUDA_HOME` overrides);
|
|
124
|
+
running needs an NVIDIA driver plus NVRTC from a toolkit, torch, or the
|
|
125
|
+
`nvidia-*` pip wheels. Skipped with a notice otherwise.
|
|
126
|
+
- **CPU**: always builds. `SPECUX_CPU_ONLY=1` forces a CPU-only build.
|
|
127
|
+
- **macOS**: builds the CPU and Metal extensions out of the box (metal-cpp is
|
|
128
|
+
vendored).
|
|
129
|
+
- **Audio I/O**: needs FFmpeg dev libraries; on Windows,
|
|
130
|
+
`scripts/get_ffmpeg.ps1` fetches a self-contained LGPL build and
|
|
131
|
+
`scripts/get_taglib.ps1` adds tag/cover support. Without FFmpeg the audio
|
|
132
|
+
module is skipped and everything else works.
|
|
133
|
+
- **Windows**: `./scripts/build.ps1` imports the MSVC environment and builds
|
|
134
|
+
in place.
|
|
135
|
+
|
|
136
|
+
## Usage
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
import numpy as np
|
|
140
|
+
import specux
|
|
141
|
+
|
|
142
|
+
x = np.random.randn(8, 32768).astype(np.float32)
|
|
143
|
+
|
|
144
|
+
# functional, any array library
|
|
145
|
+
S = specux.stft(x, n_fft=1024, hop_length=256, output="power")
|
|
146
|
+
y = specux.istft(specux.stft(x, 1024), 1024, length=x.shape[-1])
|
|
147
|
+
C = specux.mfcc(x, sr=16000, n_mfcc=20)
|
|
148
|
+
|
|
149
|
+
# configured twins: construct once, call with (..., time)
|
|
150
|
+
t = specux.MelSpectrogram(sr=44100, n_fft=1024, n_mels=80)
|
|
151
|
+
M = t(x)
|
|
152
|
+
|
|
153
|
+
# pick a backend explicitly (default follows the input)
|
|
154
|
+
S = specux.stft(x, n_fft=1024, backend="cpu")
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
import torch
|
|
159
|
+
|
|
160
|
+
xt = torch.randn(8, 32768, device="cuda")
|
|
161
|
+
|
|
162
|
+
# torch.compile and autocast
|
|
163
|
+
f = torch.compile(lambda v: specux.stft(v, 1024, output="power"), fullgraph=True)
|
|
164
|
+
with torch.autocast("cuda", torch.float16):
|
|
165
|
+
S = specux.stft(xt, 1024) # computes in float32
|
|
166
|
+
|
|
167
|
+
# reusable plan; tuning knobs live only here
|
|
168
|
+
plan = specux.stft_plan(n_fft=1024, hop_length=256, output="power", device="cuda")
|
|
169
|
+
plan = specux.autotune(xt, plan) # optional, cached on disk
|
|
170
|
+
S = plan(xt)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
# audio: read, meter, transform, write
|
|
175
|
+
y, sr = specux.audio.load("take.wav", sr=16000, mono=True)
|
|
176
|
+
lufs = specux.audio.loudness(y, sr)
|
|
177
|
+
y = specux.audio.normalize(y, mode="lufs", target_db=-14.0, sr=sr)
|
|
178
|
+
specux.audio.save("out.flac", y, sr)
|
|
179
|
+
|
|
180
|
+
for block in specux.audio.blocks("4hours.flac", 30 * sr, sr=sr, mono=True):
|
|
181
|
+
M = specux.melspectrogram(block, sr=sr) # constant memory
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Design
|
|
185
|
+
|
|
186
|
+
A transform is one fused kernel. The C++ codegen (`src/codegen/`) assembles
|
|
187
|
+
each kernel from three parts:
|
|
188
|
+
|
|
189
|
+
- a **prologue** that frames, reflect-pads, and windows the signal,
|
|
190
|
+
- an FFT **core** picked by size and precision,
|
|
191
|
+
- an **epilogue** that finishes the op in the same pass: the Hermitian
|
|
192
|
+
recombine, then the output mode (`complex` / `magnitude` / `power` / `db`),
|
|
193
|
+
a filterbank reduce for mel, a wavelet-basis reduce for the CQT family, or
|
|
194
|
+
the spectrum product for convolution.
|
|
195
|
+
|
|
196
|
+
The spectrum never round-trips through memory between those stages: a dB mel
|
|
197
|
+
spectrogram is one kernel, and features like MFCC or chroma are short chains
|
|
198
|
+
of them. Every backward pass is the analytic adjoint of the same chain,
|
|
199
|
+
generated the same way. Op, direction, and mode select the prologue and
|
|
200
|
+
epilogue, precision is a type parameter, and size is a plan, so adding a
|
|
201
|
+
size or mode never adds a hand-written kernel. Lengths past a GPU block's
|
|
202
|
+
shared memory decompose into a two-kernel four-step pipeline, and large
|
|
203
|
+
prime factors take a chirp-z (Bluestein) route through the same machinery.
|
|
204
|
+
|
|
205
|
+
The same sources emit the CUDA and Metal dialects, and the CPU engine
|
|
206
|
+
(`src/cpu/`) implements the same transforms and adjoints. `src/README.md`
|
|
207
|
+
describes the native layout and layering rules.
|
|
208
|
+
|
|
209
|
+
Tests cover correctness, autograd, `torch.compile`, autocast, and audio;
|
|
210
|
+
every numerical tolerance lives in `tests/_tol.py` with its derivation.
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
python -m pytest tests # correctness, autograd, compile, autocast, audio
|
|
214
|
+
python bench/bench_matrix.py # timing matrix on your own hardware
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## License
|
|
218
|
+
|
|
219
|
+
MIT. Vendored third-party components and their licenses are listed in
|
|
220
|
+
[NOTICE](NOTICE).
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# specux
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
|
|
5
|
+
Differentiable audio DSP for Python: fast, fused kernels on GPU and CPU.
|
|
6
|
+
|
|
7
|
+
Spectral transforms, an FFT family, and audio I/O, on numpy, torch, and cupy
|
|
8
|
+
arrays alike.
|
|
9
|
+
|
|
10
|
+
Documentation: <https://specux.com>
|
|
11
|
+
|
|
12
|
+
```python
|
|
13
|
+
import specux
|
|
14
|
+
|
|
15
|
+
y, sr = specux.audio.load("song.flac", sr=16000, mono=True)
|
|
16
|
+
M = specux.melspectrogram(y, sr=sr, n_fft=1024, n_mels=80)
|
|
17
|
+
|
|
18
|
+
import torch
|
|
19
|
+
x = torch.randn(8, 32768, device="cuda", requires_grad=True)
|
|
20
|
+
S = specux.stft(x, n_fft=1024, output="power") # stays on the GPU
|
|
21
|
+
S.sum().backward() # native adjoint kernels
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Arrays go in and come out in their own library: numpy in, numpy out; torch in,
|
|
25
|
+
torch out (resident on its device, differentiable); cupy in, cupy out. The GPU
|
|
26
|
+
kernels are generated in C++ and compiled at runtime (NVRTC for CUDA, MSL for
|
|
27
|
+
Metal), so one build covers every size, precision, and output mode; the CPU
|
|
28
|
+
backend carries the same transforms and adjoints, so training works without
|
|
29
|
+
a GPU.
|
|
30
|
+
|
|
31
|
+
## What's in the box
|
|
32
|
+
|
|
33
|
+
- **Spectral transforms**: `stft` / `istft`, `melspectrogram`, `mfcc`, `lfcc`,
|
|
34
|
+
`cqt` / `vqt` / `chroma`, with output modes `complex` / `magnitude` /
|
|
35
|
+
`power` / `db` and configured class twins (`specux.STFT`, `specux.MFCC`,
|
|
36
|
+
...). `specux.transforms` adds torch `nn.Module` wrappers with
|
|
37
|
+
torchaudio-shaped defaults.
|
|
38
|
+
- **FFT family**: `fft` / `ifft` / `rfft` / `irfft` at any length (powers of
|
|
39
|
+
two, smooth sizes, primes) and precision (float32, float64, and float16
|
|
40
|
+
storage with float32 compute), plus reusable plans (`fft_plan`,
|
|
41
|
+
`stft_plan` with optional autotuning).
|
|
42
|
+
- **Audio I/O** (`specux.audio`): decode and encode WAV/FLAC/MP3/OGG/MP4,
|
|
43
|
+
frame-accurate `offset`/`duration`, batch `load_many`/`save_many`,
|
|
44
|
+
streaming readers and writers for multi-hour files, resampling, loudness /
|
|
45
|
+
true-peak / loudness-range metering, and tags/cover metadata.
|
|
46
|
+
- **torch integration**: every entry point is a `torch.library` custom op, so
|
|
47
|
+
`torch.compile(fullgraph=True)` traces without graph breaks and
|
|
48
|
+
`torch.autocast` computes in float32. torch stays optional: without it,
|
|
49
|
+
numpy arrays run on the CPU engine or the torch-free CUDA runtime.
|
|
50
|
+
- **Runtime options**: `specux.deterministic(True)` switches overlap-adds to
|
|
51
|
+
bitwise-reproducible kernels (and follows
|
|
52
|
+
`torch.use_deterministic_algorithms`); `specux.benchmark(True)` autotunes
|
|
53
|
+
new configurations once and caches the result on disk.
|
|
54
|
+
|
|
55
|
+
## Install
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install specux # CPU everywhere; CUDA/Metal where the wheel includes them
|
|
59
|
+
pip install specux[cuda12] # + NVRTC and CUDA headers from NVIDIA's pip wheels
|
|
60
|
+
pip install specux[cuda13] # the same for CUDA 13
|
|
61
|
+
pip install specux[torch] # torch bundles its own CUDA, nothing extra needed
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Or from source, in the environment you plan to use it in:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install -e .
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The build is torch-free (no libtorch anywhere), so one build serves numpy,
|
|
71
|
+
cupy, and whichever torch is installed at runtime. Python >= 3.10,
|
|
72
|
+
numpy >= 1.22; torch optional (>= 2.4 for autograd and `torch.compile`,
|
|
73
|
+
>= 2.7 for resident Metal).
|
|
74
|
+
|
|
75
|
+
- **CUDA**: builds when a toolkit is found (`SPECUX_CUDA_HOME` overrides);
|
|
76
|
+
running needs an NVIDIA driver plus NVRTC from a toolkit, torch, or the
|
|
77
|
+
`nvidia-*` pip wheels. Skipped with a notice otherwise.
|
|
78
|
+
- **CPU**: always builds. `SPECUX_CPU_ONLY=1` forces a CPU-only build.
|
|
79
|
+
- **macOS**: builds the CPU and Metal extensions out of the box (metal-cpp is
|
|
80
|
+
vendored).
|
|
81
|
+
- **Audio I/O**: needs FFmpeg dev libraries; on Windows,
|
|
82
|
+
`scripts/get_ffmpeg.ps1` fetches a self-contained LGPL build and
|
|
83
|
+
`scripts/get_taglib.ps1` adds tag/cover support. Without FFmpeg the audio
|
|
84
|
+
module is skipped and everything else works.
|
|
85
|
+
- **Windows**: `./scripts/build.ps1` imports the MSVC environment and builds
|
|
86
|
+
in place.
|
|
87
|
+
|
|
88
|
+
## Usage
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
import numpy as np
|
|
92
|
+
import specux
|
|
93
|
+
|
|
94
|
+
x = np.random.randn(8, 32768).astype(np.float32)
|
|
95
|
+
|
|
96
|
+
# functional, any array library
|
|
97
|
+
S = specux.stft(x, n_fft=1024, hop_length=256, output="power")
|
|
98
|
+
y = specux.istft(specux.stft(x, 1024), 1024, length=x.shape[-1])
|
|
99
|
+
C = specux.mfcc(x, sr=16000, n_mfcc=20)
|
|
100
|
+
|
|
101
|
+
# configured twins: construct once, call with (..., time)
|
|
102
|
+
t = specux.MelSpectrogram(sr=44100, n_fft=1024, n_mels=80)
|
|
103
|
+
M = t(x)
|
|
104
|
+
|
|
105
|
+
# pick a backend explicitly (default follows the input)
|
|
106
|
+
S = specux.stft(x, n_fft=1024, backend="cpu")
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
import torch
|
|
111
|
+
|
|
112
|
+
xt = torch.randn(8, 32768, device="cuda")
|
|
113
|
+
|
|
114
|
+
# torch.compile and autocast
|
|
115
|
+
f = torch.compile(lambda v: specux.stft(v, 1024, output="power"), fullgraph=True)
|
|
116
|
+
with torch.autocast("cuda", torch.float16):
|
|
117
|
+
S = specux.stft(xt, 1024) # computes in float32
|
|
118
|
+
|
|
119
|
+
# reusable plan; tuning knobs live only here
|
|
120
|
+
plan = specux.stft_plan(n_fft=1024, hop_length=256, output="power", device="cuda")
|
|
121
|
+
plan = specux.autotune(xt, plan) # optional, cached on disk
|
|
122
|
+
S = plan(xt)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
# audio: read, meter, transform, write
|
|
127
|
+
y, sr = specux.audio.load("take.wav", sr=16000, mono=True)
|
|
128
|
+
lufs = specux.audio.loudness(y, sr)
|
|
129
|
+
y = specux.audio.normalize(y, mode="lufs", target_db=-14.0, sr=sr)
|
|
130
|
+
specux.audio.save("out.flac", y, sr)
|
|
131
|
+
|
|
132
|
+
for block in specux.audio.blocks("4hours.flac", 30 * sr, sr=sr, mono=True):
|
|
133
|
+
M = specux.melspectrogram(block, sr=sr) # constant memory
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Design
|
|
137
|
+
|
|
138
|
+
A transform is one fused kernel. The C++ codegen (`src/codegen/`) assembles
|
|
139
|
+
each kernel from three parts:
|
|
140
|
+
|
|
141
|
+
- a **prologue** that frames, reflect-pads, and windows the signal,
|
|
142
|
+
- an FFT **core** picked by size and precision,
|
|
143
|
+
- an **epilogue** that finishes the op in the same pass: the Hermitian
|
|
144
|
+
recombine, then the output mode (`complex` / `magnitude` / `power` / `db`),
|
|
145
|
+
a filterbank reduce for mel, a wavelet-basis reduce for the CQT family, or
|
|
146
|
+
the spectrum product for convolution.
|
|
147
|
+
|
|
148
|
+
The spectrum never round-trips through memory between those stages: a dB mel
|
|
149
|
+
spectrogram is one kernel, and features like MFCC or chroma are short chains
|
|
150
|
+
of them. Every backward pass is the analytic adjoint of the same chain,
|
|
151
|
+
generated the same way. Op, direction, and mode select the prologue and
|
|
152
|
+
epilogue, precision is a type parameter, and size is a plan, so adding a
|
|
153
|
+
size or mode never adds a hand-written kernel. Lengths past a GPU block's
|
|
154
|
+
shared memory decompose into a two-kernel four-step pipeline, and large
|
|
155
|
+
prime factors take a chirp-z (Bluestein) route through the same machinery.
|
|
156
|
+
|
|
157
|
+
The same sources emit the CUDA and Metal dialects, and the CPU engine
|
|
158
|
+
(`src/cpu/`) implements the same transforms and adjoints. `src/README.md`
|
|
159
|
+
describes the native layout and layering rules.
|
|
160
|
+
|
|
161
|
+
Tests cover correctness, autograd, `torch.compile`, autocast, and audio;
|
|
162
|
+
every numerical tolerance lives in `tests/_tol.py` with its derivation.
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
python -m pytest tests # correctness, autograd, compile, autocast, audio
|
|
166
|
+
python bench/bench_matrix.py # timing matrix on your own hardware
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## License
|
|
170
|
+
|
|
171
|
+
MIT. Vendored third-party components and their licenses are listed in
|
|
172
|
+
[NOTICE](NOTICE).
|