- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
函数spicy.signal.spectrogram
:https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.spectrogram.html
和spicy.signal.stft
:https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.stft.html
似乎做了一件很相似的事情。
这两个函数有什么区别?
最佳答案
Tl;dr:如果我用 SciPy 文档给出的输出编写它:Sxx = Zxx ** 2
解释:频谱图和短时傅里叶变换是两个不同的对象,但它们却非常接近。
The short-time Fourier transform (STFT), is a Fourier-related transform used to determine the sinusoidal frequency and phase content of local sections of a signal as it changes over time. In practice, the procedure for computing STFTs is to divide a longer time signal into shorter segments of equal length and then compute the Fourier transform separately on each shorter segment. This reveals the Fourier spectrum on each shorter segment. One then usually plots the changing spectra as a function of time. Wikipedia
另一方面,
A spectrogram is a visual representation of the spectrum of frequencies of a signal as it varies with time. Wikipedia
频谱图基本上会在小窗口中截断您的信号,并显示一系列颜色来表示这个或那个特定频率的强度。与 STFT 完全一样。事实上,它正在使用 STFT。
现在,对于差异,根据定义,频谱图是信号 s(t)
的短时傅立叶变换 (STFT) 的平方幅度:
频谱图(t, w) = |STFT(t, w)|^2
scipy.signal.stft
页面底部显示的示例显示:
>>> plt.pcolormesh(t, f, np.abs(Zxx), vmin=0, vmax=amp)
它正在运行,您可以看到色标。但它是线性的,因为 abs
操作。
实际上,要获得真正的频谱图,应该这样写:
>>> plt.pcolormesh(t, f, Zxx ** 2, vmin=0, vmax=amp)
关于python - scipy.signal.spectrogram 和 scipy.signal.stft 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55683936/
以下是否相同? 读取音频文件,然后将其裁剪为特定的帧长,并在摘录中执行短时傅立叶变换 代码:stft(cropAudio(readAudio(wav))) 读取音频文件,然后对整个音频文件执行短时傅立
我使用scipy.signal.stft来获取音频的stft。没问题,我正在得到结果。但我不明白的是,当使用采样率为fs=44100 Hz的169600个样本的音频来计算stft时,我得到 3 个返回
作为一个简单的实验,我想计算 stft音频文件: sample_rate, samples = wav.read(file) f, t, Zxx = stft(samples, sample_rate
所以这里的想法是:您可以使用短时傅里叶变换 (stft) 从音频文件生成频谱图。然后有些人生成了一种称为“二进制掩码”的东西,以从反向 stft 生成不同的音频(即,去除背景噪声等)。 以下是我的理解
我目前正在使用 matplotlib 计算频谱图。我指定 NFFT=512,但生成的图像高度为 257。然后,我尝试执行 STFT(短时傅里叶变换),它给出了 512 维向量(如预期)。如果我绘制 S
我正在使用 this检测音高的算法 this音频文件。正如您所听到的,这是在吉他上弹奏的 E2 音符,背景中有一点噪音。 我使用 STFT 生成了这个频谱图: 我正在像这样使用上面链接的算法: y,
我正在尝试实现 FFT,我对代码等没问题,但事情的一般顺序让我感到困惑。 我认为这是正确的事情顺序吗? 输入 -> 重叠输入 -> 窗口化 -> FFT -> 相位计算/重叠补偿 -> 输出 我得到的
我通过相关了解了 DFT 的工作原理,并将其用作理解 FFT 结果的基础。如果我有一个以 44.1kHz 采样的离散信号,那么这意味着如果我要获取 1 秒的数据,我将有 44,100 个样本。为了对其
我想对我的数据执行短时傅里叶变换,并为每个段指定特定的样本长度。我想使用信号子模块中的 SciPy 函数 stft。但是,当我通过以下方式创建长度 10e5 的音频数组时: fs = 10e3 # S
我最近接手了一个项目,我需要对传入的麦克风数据执行实时滑动 FFT 分析。我选择执行此操作的环境是 OpenGL 和 Cinder,并使用 C++。 这是我第一次接触音频编程,我有点困惑。 这就是我试
使用时librosa.stft()要计算频谱图,如何取回相关的频率值?我对生成图像不感兴趣,如 librosa.display.specshow ,而是我想要掌握这些值。 y, sr = libros
这是我运行的一段代码: import tensorflow as tf sess = tf.InteractiveSession() filename = 'song.mp3' # 30 second
根据文档,有一个 scipy.signal.stft 但是当尝试访问该函数时,我从标题中收到错误。该函数记录在 here . 此外,scip.signal.istft 也不存在。有什么建议吗? 最佳答
所以,我想知道如何实现 STFT在 Julia 中,可能使用汉明窗。我在互联网上找不到任何东西。 最好的方法是什么?我宁愿不使用 Python 库,但如果可能的话,我宁愿使用纯原生的 Julia。也许
函数 spicy.signal.spectrogram:https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.spectr
我正在尝试从声音文件(.wav)中获取特征; 我尝试过 stft 来获取 2D 特征(x 是时间,y 是频率) 我尝试过 pywt,但得到的是一维数组。如果我输入一个 1D (1000,) wav 数
我正在将 Python 代码转换为 MATLAB。 Python 代码,使用以下命令: stft_ch = librosa.core.stft(audio_input[:, ch_cnt], n_ff
更新:我在 librosa 中重新实现了这个来进行比较,结果确实与 tensorflow 的结果有很大不同。 Librosa 给出了我期望的结果(但不是 tensorflow)。 我已将其发布为 is
我正在尝试在没有 gpu 的基于 arm 的设备上为 ASR 运行我的 PyTorch 模型。据我所知,arm 不支持 ATen 使用的 MKL。自然地,当我尝试进行推理时会收到以下错误: Runti
我是一名优秀的程序员,十分优秀!