smst.models.stft module¶
Functions that implement analysis and synthesis of sounds using the Short-Time Fourier Transform.
For example usage check the stftModel_function module.
-
smst.models.stft.
filter
(x, fs, w, N, H, filter)¶ Applies a spectral filter to a sound by using the STFT.
Parameters: - x – input sound
- w – analysis window
- N – FFT size
- H – hop size
- filter – magnitude response of filter with frequency-magnitude pairs (in dB)
Returns: y - output sound
-
smst.models.stft.
from_audio
(x, w, N, H)¶ Analyzes an input signal using the short-time Fourier transform into a spectrogram.
Parameters: - x – input signal
- w – analysis window
- N – FFT size
- H – hop size
Returns: mag_spectrogram, phase_spectrogram - magnitude and phase spectrograms
-
smst.models.stft.
iterate_analysis_frames
(x, H, hM1, hM2)¶ Iterate over frames of input signal for analysis.
Parameters: - x – input signal
- H – hop size
- hM1 – half analysis window size by rounding
- hM2 – half analysis window size by floor
Returns: generator over frames of input signal
-
smst.models.stft.
morph
(x1, x2, fs, w1, N1, w2, N2, H1, smoothf, balancef)¶ Morphs two sounds using the STFT.
Parameters: - x2 (x1,) – input sounds
- fs – sampling rate
- w2 (w1,) – analysis windows
- N2 (N1,) – FFT sizes
- H1 – hop size
- smoothf – smooth factor of sound 2, bigger than 0 to max of 1, where 1 is no smoothing,
- balancef – balance between the 2 sounds, from 0 to 1, where 0 is sound 1 and 1 is sound 2
Returns: y: output sound
-
smst.models.stft.
pad_signal
(x, hM2)¶
-
smst.models.stft.
to_audio
(mY, pY, M, H)¶ Synthesizes an output signal from a spectrogram using the inverse short-time Fourier transform.
Parameters: - mY – magnitude spectrogram
- pY – phase spectrogram
- M – window size
- H – hop-size
Returns: y - output signal