Python 中的可逆 STFT 和 ISTFT [英] Invertible STFT and ISTFT in Python
问题描述
是否有任何具有相应逆的短时傅立叶变换的通用形式转换内置到 SciPy 或 NumPy 或其他什么?
matplotlib 中有 pyplot specgram
函数,它调用 ax.specgram()
,它调用 mlab.specgram()
,它调用_spectral_helper()
:
#检查 y 是否为 x 以便我们可以使用相同的函数来#实现psd()、csd()、spectrogram()的核心,不做#额外的计算.我们返回未平均的 Pxy、频率和 t.
但是
<块引用>这是一个辅助函数,实现了204 #psd、csd 和频谱图.它是不意味着在 mlab 之外使用
不过,我不确定这是否可以用于执行 STFT 和 ISTFT.还有什么别的,或者我应该翻译像这些MATLAB函数?
我知道如何编写自己的临时实现;我只是在寻找功能齐全的东西,它可以处理不同的窗口函数(但具有合理的默认值),并且与 COLA 窗口完全可逆(istft(stft(x))==x
),经多人测试,无一错,处理末端和零填充,真实输入的快速RFFT实现等.
我有点晚了,但意识到 scipy 已经内置了 istft 函数自 0.19.0 起
Is there any general-purpose form of short-time Fourier transform with corresponding inverse transform built into SciPy or NumPy or whatever?
There's the pyplot specgram
function in matplotlib, which calls ax.specgram()
, which calls mlab.specgram()
, which calls _spectral_helper()
:
#The checks for if y is x are so that we can use the same function to #implement the core of psd(), csd(), and spectrogram() without doing #extra calculations. We return the unaveraged Pxy, freqs, and t.
but
This is a helper function that implements the commonality between the 204 #psd, csd, and spectrogram. It is NOT meant to be used outside of mlab
I'm not sure if this can be used to do an STFT and ISTFT, though. Is there anything else, or should I translate something like these MATLAB functions?
I know how to write my own ad-hoc implementation; I'm just looking for something full-featured, which can handle different windowing functions (but has a sane default), is fully invertible with COLA windows (istft(stft(x))==x
), tested by multiple people, no off-by-one errors, handles the ends and zero padding well, fast RFFT implementation for real input, etc.
I'm a little late to this, but realised scipy has inbuilt istft function as of 0.19.0
这篇关于Python 中的可逆 STFT 和 ISTFT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!