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.
翻译:nnAudio是一个面向深度学习的开源音频特征提取工具箱,但在当前环境下其应用受到TorchScript不兼容、逆变换边界条件以及依赖库版本漂移等问题的制约。我们针对现代PyTorch和科学Python环境提出了一套针对性现代化方案。通过从脚本化代码路径中移除动态状态变异与模块构造,并收紧逆变换相关辅助函数的参数处理,解决了STFT和iSTFT中的TorchScript编译失败问题。通过将可靠逆变换限制在均匀频点设置(freq_scale=`no')并针对不支持的频点尺度显式抛出运行时错误,消除静默退化的重构结果,明确了逆STFT的行为边界。恢复了与现代SciPy的CFP兼容性,并确保当gamma=0时VQT退化为CQT。回归测试覆盖了新的STFT/iSTFT行为,更新后的代码库在现代Python环境下通过完整仓库测试套件。这些改进为可微分音频分析的研究与部署提供了更稳健的基础。