Exemple #1
0
def hpr_model_synth(hfreq, hmag, hphase, xr, N, H, fs):
    """
    Synthesis of a sound using the sinusoidal plus residual model
    tfreq, tmag, tphase: sinusoidal frequencies, amplitudes and phases; stocEnv: stochastic envelope
    N: synthesis FFT size; H: hop size, fs: sampling rate
    returns y: output sound, yh: harmonic component
    """

    yh = sineModel.sine_model_synth(hfreq, hmag, hphase, N, H, fs)  # synthesize sinusoids
    y = yh[:min(yh.size, xr.size)] + xr[:min(yh.size, xr.size)]  # sum sinusoids and residual components
    return y, yh
Exemple #2
0
def sps_models_synth(tfreq, tmag, tphase, stocEnv, N, H, fs):
    """
    Synthesis of a sound using the sinusoidal plus stochastic model
    tfreq, tmag, tphase: sinusoidal frequencies, amplitudes and phases; stocEnv: stochastic envelope
    N: synthesis FFT size; H: hop size, fs: sampling rate
    returns y: output sound, ys: sinusoidal component, yst: stochastic component
    """

    ys = sineModel.sine_model_synth(tfreq, tmag, tphase, N, H, fs)  # synthesize sinusoids
    yst = stochasticModel.stochastic_model_synth(stocEnv, H, H * 2)  # synthesize stochastic residual
    y = ys[: min(ys.size, yst.size)] + yst[: min(ys.size, yst.size)]  # sum sinusoids and stochastic components
    return y, ys, yst
Exemple #3
0
def hps_model_synth(hfreq, hmag, hphase, stocEnv, N, H, fs):
    """
    Synthesis of a sound using the harmonic plus stochastic model
    hfreq, hmag: harmonic frequencies and amplitudes; stocEnv: stochastic envelope
    Ns: synthesis FFT size; H: hop size, fs: sampling rate
    returns y: output sound, yh: harmonic component, yst: stochastic component
    """

    yh = sineModel.sine_model_synth(hfreq, hmag, hphase, N, H, fs)  # synthesize harmonics
    yst = stochasticModel.stochastic_model_synth(stocEnv, H, H * 2)  # synthesize stochastic residual
    y = yh[:min(yh.size, yst.size)] + yst[:min(yh.size, yst.size)]  # sum harmonic and stochastic components
    return y, yh, yst