stft#

ivy.stft(signals, frame_length, frame_step, /, *, fft_length=None, window_fn=None, pad_end=False, name=None, out=None)[source]#

ivy.Container static method variant of ivy.stft.

This method simply wraps the function, and so the docstring for ivy.stft also applies to this method with minimal changes.

Parameters:
  • signals (Union[Array, NativeArray]) – Input Arrays.

  • frame_length (int) – An integer scalar Tensor. The window length in samples.

  • frame_step (int) – An integer scalar Tensor. The number of samples to step.

  • fft_length (Optional[int], default: None) – An integer scalar Tensor. The size of the FFT to apply. If not provided, uses the smallest power of 2 enclosing frame_length.

  • optional – An integer scalar Tensor. The size of the FFT to apply. If not provided, uses the smallest power of 2 enclosing frame_length.

  • window_fn (Optional[Callable], default: None) – A callable that takes a window length and a dtype keyword argument and returns a [window_length] Tensor of samples in the provided datatype. If set to None, no windowing is used.

  • optional – A callable that takes a window length and a dtype keyword argument and returns a [window_length] Tensor of samples in the provided datatype. If set to None, no windowing is used.

  • pad_end (bool, default: False) – Whether to pad the end of signals with zeros when the provided frame length and step produces a frame that lies partially past its end.

  • optional – Whether to pad the end of signals with zeros when the provided frame length and step produces a frame that lies partially past its end.

  • name (Optional[str], default: None) – An optional name for the operation.

  • optional – An optional name for the operation.

  • out (Optional[Array], default: None) – Optional output array for writing the result.

  • optional – Optional output array for writing the result.

Return type:

Array

Returns:

ret – A […, frames, fft_unique_bins] Tensor of complex64/complex128 STFT values where fft_unique_bins is fft_length // 2 + 1 (the unique components of the FFT).

Array.stft(self, frame_length, frame_step, /, *, fft_length=None, window_fn=None, pad_end=False, name=None, out=None)[source]#

Compute the Short-time Fourier Transform of signals.

Parameters:
  • self (Array) – Input Arrays.

  • frame_length (int) – An integer scalar Tensor. The window length in samples.

  • frame_step (int) – An integer scalar Tensor. The number of samples to step.

  • fft_length (Optional[int], default: None) – An integer scalar Tensor. The size of the FFT to apply. If not provided, uses the smallest power of 2 enclosing frame_length.

  • window_fn (Optional[Callable], default: None) – A callable that takes a window length and a dtype keyword argument and returns a [window_length] Tensor of samples in the provided datatype. If set to None, no windowing is used.

  • pad_end (Optional[bool], default: False) – Whether to pad the end of signals with zeros when the provided frame length and step produces a frame that lies partially past its end.

  • name (Optional[str], default: None) – An optional name for the operation.

  • out (Optional[Array], default: None) – Optional output array for writing the result.

Return type:

Array

Returns:

ret – A […, frames, fft_unique_bins] Tensor of complex64/complex128 STFT values where fft_unique_bins is fft_length // 2 + 1 (the unique components of the FFT).

Container.stft(self, frame_length, frame_step, /, *, fft_length=None, window_fn=None, pad_end=False, name=None, out=None)[source]#

Compute the Short-time Fourier Transform of signals.

Parameters:
  • self (Union[Array, NativeArray, Container]) – Input Arrays.

  • frame_length (Union[int, Container]) – An integer scalar Tensor. The window length in samples.

  • frame_step (Union[int, Container]) – An integer scalar Tensor. The number of samples to step.

  • fft_length (Optional[Union[int, Container]], default: None) – An integer scalar Tensor. The size of the FFT to apply. If not provided, uses the smallest power of 2 enclosing frame_length.

  • window_fn (Optional[Union[Callable, Container]], default: None) – A callable that takes a window length and a dtype keyword argument and returns a [window_length] Tensor of samples in the provided datatype. If set to None, no windowing is used.

  • pad_end (Optional[Union[bool, Container]], default: False) – Whether to pad the end of signals with zeros when the provided frame length and step produces a frame that lies partially past its end.

  • name (Optional[Union[str, Container]], default: None) – An optional name for the operation.

  • out (Optional[Union[Array, Container]], default: None) – Optional output array for writing the result.

Return type:

Container

Returns:

ret – A […, frames, fft_unique_bins] Tensor of complex64/complex128 STFT values where fft_unique_bins is fft_length // 2 + 1 (the unique components of the FFT).