Skip to content

Support stft and inverse stft ops. #1362

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nsthorat opened this issue Mar 12, 2019 · 17 comments
Closed

Support stft and inverse stft ops. #1362

nsthorat opened this issue Mar 12, 2019 · 17 comments

Comments

@nsthorat
Copy link
Contributor

See:

https://www.tensorflow.org/api_docs/python/tf/signal/stft
https://www.tensorflow.org/api_docs/python/tf/signal/inverse_stft

@Lewuathe
Copy link
Contributor

Lewuathe commented Apr 9, 2019

I tried to implement this and found we first need to implement window functions like hann or hamming. I'll work on them first.

https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/signal/hann_window
https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/signal/hamming_window

@Gurpreetsingh9465
Copy link
Contributor

Gurpreetsingh9465 commented Apr 18, 2019

@Lewuathe can we work together in this module and add support to more ops as mentioned in tf.signals similar PR tensorflow/tensorflow#27075

@Lewuathe
Copy link
Contributor

Thanks! I think you can add necessary ops in tf.signal. Some other ops like fft are still in spectral_ops.ts, though.

@Gurpreetsingh9465
Copy link
Contributor

Gurpreetsingh9465 commented Apr 18, 2019

thanks! 😃
I would like to implement.

  1. fftfreq
  2. rfftfreq
  3. fftshift(required tf.roll)
  4. ifftshift(required tf.roll)

reference np.fft

@nsthorat
Copy link
Contributor Author

@Gurpreetsingh9465 since those don't exist in TensorFlow we probably won't implement them in TensorFlow.js for now.

@Gurpreetsingh9465
Copy link
Contributor

@nsthorat can i work on dct and idct

@nsthorat
Copy link
Contributor Author

Great! Just curious if you have a concrete use case for those ops?

@Gurpreetsingh9465
Copy link
Contributor

I am not sure about that but i think discrete cosine transform converts one function into sum of cosine functions of different amplitude which can be used to compress mp3 or image files.

@nsthorat
Copy link
Contributor Author

For now let's try to keep it to the ops we have a concrete use case (one that someone wants to build), otherwise we bloat the bundle size without a real need for the op :)

@Gurpreetsingh9465
Copy link
Contributor

Ok @nsthorat 😃

nsthorat pushed a commit to tensorflow/tfjs-core that referenced this issue Apr 23, 2019
FEATURE
Add [Hann window op](https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/signal/hann_window) and [hamming window op](https://www.tensorflow.org/api_docs/python/tf/signal/hamming_window) since this window function is necessary to implement stft and isftf as well as hamming window. 

See: tensorflow/tfjs#1362
nsthorat pushed a commit to tensorflow/tfjs-core that referenced this issue May 4, 2019
FEATURE

Add frame op as provided in [TensorFlow core](https://www.tensorflow.org/api_docs/python/tf/signal/frame). It's also needed to implement stft, istft ops to make slices of the sample.

See: tensorflow/tfjs#1362
nsthorat pushed a commit to tensorflow/tfjs-core that referenced this issue Aug 12, 2019
FEATURE

Add tf.signal.stft op. 

One TODO is passing fft length parameter because rfft does not support fft length parameter. We can pass fft length parameter after rfft supports it.

See: tensorflow/tfjs#1362
@ClaraJacintho
Copy link

ClaraJacintho commented Jan 13, 2020

Hey, any updates on the inverse STFT? Is anyone working on it? I am working on a project that needs it, and I would be willing to help implement it if necessary!

@rthadur rthadur added P2 type:feature New feature or request labels Jan 13, 2020
@rthadur
Copy link
Contributor

rthadur commented Jan 13, 2020

@ClaraJacintho no one is working on it at this point , feel free to submit a PR. Thank you
cc @dsmilkov

@gaikwadrahul8
Copy link
Contributor

Hi, @ClaraJacintho

Apologize for the delayed response and I see we have implemented tf.signal.stft and it seems like we haven't implemented tf.signal.inverse_stft so still you're looking to implement tf.signal.inverse_stft feature please ? Thank you!

@google-ml-butler
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you.

@google-ml-butler
Copy link

Closing as stale. Please @mention us if this needs more attention.

@gaikwadrahul8 gaikwadrahul8 self-assigned this May 17, 2023
@StiliyanKushev
Copy link

Bump. People are still looking for an official implementation of tf.signal.inverse_stft.

@matbee-eth
Copy link

Would be nice, I've tried to do it myself but it doesnt quite work :)

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

No branches or pull requests

9 participants