smst.models.hpr module¶
Functions that implement analysis and synthesis of sounds using the Harmonic plus Residual Model.
-
smst.models.hpr.
from_audio
(x, fs, w, N, H, t, minSineDur, nH, minf0, maxf0, f0et, harmDevSlope)¶ Analyzes a sound using the harmonic plus residual model.
Parameters: - x – input sound
- fs – sampling rate
- w – analysis window
- N – FFT size
- t – threshold in negative dB
- minSineDur – minimum duration of sinusoidal tracks
- nH – maximum number of harmonics
- minf0 – minimum fundamental frequency in sound
- maxf0 – maximum fundamental frequency in sound
- f0et – maximum error accepted in f0 detection algorithm
- harmDevSlope – allowed deviation of harmonic tracks, higher harmonics have higher allowed deviation
Returns: - hfreq, hmag, hphase: harmonic frequencies, magnitude and phases
- xr: residual signal
-
smst.models.hpr.
to_audio
(hfreq, hmag, hphase, xr, N, H, fs)¶ Synthesizes a sound using the sinusoidal plus residual model.
Parameters: - tfreq – sinusoidal frequencies
- tmag – sinusoidal amplitudes
- tphase – sinusoidal phases
- stocEnv – stochastic envelope
- N – synthesis FFT size
- H – hop size
- fs – sampling rate
Returns: y: output sound, yh: harmonic component