修复音频特征提取工具nnAudio的兼容性问题,提升稳定性与可靠性。
nnAudio 2: Overcoming Dynamic Compilation Barriers and Transform Inconsistencies
- 移除动态状态修改和模块构建,解决STFT/iSTFT的TorchScript编译失败
- 限定逆STFT仅在均匀频带下可靠运行,避免隐性重建质量下降
- 适配现代PyTorch与SciPy,确保CFP和VQT功能正确性,适合音频研究与部署
nnAudio是一个开源的深度学习音频特征提取工具箱,但在当前环境中受限于TorchScript不兼容、逆变换边界情况及依赖漂移问题。本文针对现代PyTorch与科学计算Python环境进行针对性重构:通过移除脚本化代码路径中的动态状态修改和模块构建,解决STFT与iSTFT的TorchScript编译失败;通过限制可靠逆STFT仅在均匀频带设置(freq_scale=`no')下有效,并对不支持的频率尺度抛出明确运行时错误,防止无声的重建质量下降;恢复CFP对现代SciPy的兼容性,并确保当gamma = 0时VQT退化为CQT。回归测试覆盖新的STFT/iSTFT行为,更新后的代码库在现代Python环境下通过完整测试套件。这些改进为可微分音频分析的研究与部署提供了更稳健的基础。
原文摘要 · Abstract (English)
nnAudio is an open-source audio feature extraction toolbox for deep learning, but its use in current environments is hindered by TorchScript incompatibilities, inverse-transform edge cases, and dependency drift. We present a targeted modernization for modern PyTorch and scientific Python. We resolve TorchScript compilation failures in STFT and iSTFT by removing dynamic state mutation and module construction from scripted code paths and tightening argument handling in inverse-related helpers. We clarify inverse-STFT behavior by restricting reliable inversion to the uniform-bin setting (freq_scale=`no') and raising explicit runtime errors for unsupported frequency scales, preventing silently degraded reconstructions. We restore CFP compatibility with modern SciPy and ensure VQT reduces to CQT when gamma = 0. Regression tests cover the new STFT/iSTFT behaviors, and the updated codebase passes the full repository test suite in a modern Python environment. These improvements provide a more robust foundation for differentiable audio analysis in research and deployment.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。