Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

specify fmin and fmax for Spectrogram #3732

Open
bilzard opened this issue Jan 20, 2024 · 2 comments
Open

specify fmin and fmax for Spectrogram #3732

bilzard opened this issue Jan 20, 2024 · 2 comments

Comments

@bilzard
Copy link

bilzard commented Jan 20, 2024

馃殌 The feature

specify fmin and fmax for Spectrogram like MelSpectrogram.

Motivation, pitch

We can specify fmin and fmax for MelSpectrogram, but we cannot for Spectrogram.
If we don't want to use frequencies out of specified frequency bands, it will spend extra memory and computation costs.
Also, by this feature, we can make it consistent specifications for Spectrogram and MelSpectrogram transforms.

Alternatives

I don't know the current workaround for fulfilling:

  1. specify fmin and fmax
  2. extract linear filter banks

Additional context

No response

@bilzard
Copy link
Author

bilzard commented Jan 20, 2024

I have misunderstanding on current implementation of MelSpectrogram.
It is just combination of Spectrogram and MelScale transforms[1].
So, current implementation of MelSpectrogram's computational cost is just the same as Spectrogram.

Nevertheless, I still interested in if there are possibility for directly specifying fmin and fmax in Spectrogram transform.
In my understanding, it is technically possible and it will reduce computation and memory cost in cases I mentioned above.

@bilzard
Copy link
Author

bilzard commented Jan 20, 2024

I found a workaround for fmin=0 Hz.

We can simply down-sample the original sequence until it come to limit for the Nyquist frequency that corresponds with the new sampling rate.
E.g., If we only want 0-20 Hz frequency band, and the original sampling frequency is 200 Hz, we can down sample original sequence for 40 Hz (1/5) and pass it to STFT.

I still be issue for fmin>0 Hz, but in my case (fmin=0 Hz), the issue is solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant