def spr_model_anal(x, fs, w, N, H, t, minSineDur, maxnSines, freqDevOffset, freqDevSlope): """ Analysis of a sound using the sinusoidal plus residual model x: input sound, fs: sampling rate, w: analysis window; N: FFT size, t: threshold in negative dB, minSineDur: minimum duration of sinusoidal tracks maxnSines: maximum number of parallel sinusoids freqDevOffset: frequency deviation allowed in the sinusoids from frame to frame at frequency 0 freqDevSlope: slope of the frequency deviation, higher frequencies have bigger deviation returns hfreq, hmag, hphase: harmonic frequencies, magnitude and phases; xr: residual signal """ # perform sinusoidal analysis tfreq, tmag, tphase = sineModel.sine_model_anal(x, fs, w, N, H, t, maxnSines, minSineDur, freqDevOffset, freqDevSlope) Ns = 512 xr = utilFunctions.sineSubtraction(x, Ns, H, tfreq, tmag, tphase, fs) # subtract sinusoids from original sound return tfreq, tmag, tphase, xr
def sps_model_anal(x, fs, w, N, H, t, minSineDur, maxnSines, freqDevOffset, freqDevSlope, stocf): """ Analysis of a sound using the sinusoidal plus stochastic model x: input sound, fs: sampling rate, w: analysis window; N: FFT size, t: threshold in negative dB, minSineDur: minimum duration of sinusoidal tracks maxnSines: maximum number of parallel sinusoids freqDevOffset: frequency deviation allowed in the sinusoids from frame to frame at frequency 0 freqDevSlope: slope of the frequency deviation, higher frequencies have bigger deviation stocf: decimation factor used for the stochastic approximation returns hfreq, hmag, hphase: harmonic frequencies, magnitude and phases; stocEnv: stochastic residual """ # perform sinusoidal analysis tfreq, tmag, tphase = sineModel.sine_model_anal( x, fs, w, N, H, t, maxnSines, minSineDur, freqDevOffset, freqDevSlope ) Ns = 512 xr = utilFunctions.sineSubtraction(x, Ns, H, tfreq, tmag, tphase, fs) # subtract sinusoids from original sound stocEnv = stochasticModel.stochastic_model_anal(xr, H, H * 2, stocf) # compute stochastic model of residual return tfreq, tmag, tphase, stocEnv