get_output_as_nparray#

Stft.get_output_as_nparray()#

Get the STFT of the signal as a tuple of NumPy arrays.

Returns:
numpy.ndarray

Complex STFT of the signal, in the signal’s unit. The returned STFT is scaled such that the module of the spectrum at each time step is an RMS spectrum. The STFT is two-sided, which means the lower half of the frequencies, between 0 Hz and half of the signal’s sampling frequency, is mirrored in the upper half, up to the sampling frequency. Each row of the STFT corresponds to a specific frequency, and each column corresponds to a specific time.

For more information, see RMS spectrum.

numpy.ndarray

Frequencies in Hz corresponding to the rows of the STFT.

numpy.ndarray

Times in seconds corresponding to the columns of the STFT.

Return type:

tuple[ndarray]

Notes

Prior to Sound version 2027.1.0, RMS spectrum scaling is not applied in the returned STFT. As a consequence, the stored STFT values are not in the input signal’s unit if the used Sound version is not 2027.1.0 or higher. In such case, to scale the STFT values, you need to divide them by the sum of the values of the window function that is specified with attributes window_type and fft_size (the window size is equal to the FFT size in fft_size).