Stft#

class ansys.sound.core.spectrogram_processing.Stft(signal=None, fft_size=2048, window_type='HANN', window_overlap=0.5)#

Computes the short-time Fourier transform (STFT) of a signal.

Class instantiation takes the following parameters.

Parameters:
signalField | FieldsContainer, default: None

Mono signal to compute the STFT on as a DPF field or fields container.

fft_sizeint, default: 2048

Size (as an integer) of the FFT to compute the STFT. Use a power of 2 for better performance.

window_typestr, default: ‘HANN’

Window type used for the FFT computation. Options are 'BARTLETT', 'BLACKMAN', 'BLACKMANHARRIS',``’HAMMING’, ``'HANN', 'KAISER', and 'RECTANGULAR'.

window_overlapfloat, default: 0.5

Overlap value between two successive FFT computations. Values can range from 0 to 1. For example, 0 means no overlap, and 0.5 means 50% overlap.

Methods

Stft.convert_fields_container_to_np_array(fc)

Convert a DPF fields container to a NumPy array.

Stft.get_output()

Get the STFT of the signal as a DPF fields container.

Stft.get_output_as_nparray()

Get the STFT of the signal as a NumPy array.

Stft.get_stft_magnitude_as_nparray()

Get the amplitude of the STFT as a NumPy array.

Stft.get_stft_phase_as_nparray()

Get the phase of the STFT as a NumPy array.

Stft.plot()

Plot signals.

Stft.process()

Compute the STFT.

Attributes

Stft.fft_size

Number of FFT points.

Stft.signal

Input signal as a DPF field.

Stft.window_overlap

Window overlap in %.

Stft.window_type

Window type.