Skip to content

Instantly share code, notes, and snippets.

@bmcfee
Created April 19, 2018 13:32
Show Gist options
  • Save bmcfee/746e572232be36f3bd462749fb1796da to your computer and use it in GitHub Desktop.
Save bmcfee/746e572232be36f3bd462749fb1796da to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vvasily
Copy link

vvasily commented Jun 11, 2021

scipy.signal.stft uses scale factor for the result https://github.com/scipy/scipy/blob/43b76937c0aadf23b4e0fcc04f546fa5d61b543b/scipy/signal/spectral.py#L1805
To get the same values you need to divide D2 in following way:
hamm_win = scipy.signal.get_window('hamming', 2048)
scale = np.sqrt(1.0 / hamm_win.sum()**2)
D2 = D2 / scale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment