pyroomacoustics.metrics module

pyroomacoustics.metrics.itakura_saito(x1, x2, sigma2_n, stft_L=128, stft_hop=128)
pyroomacoustics.metrics.median(x, alpha=None, axis=-1, keepdims=False)

Computes 95% confidence interval for the median.

Parameters
  • x (array_like) – the data array

  • alpha (float, optional) – the confidence level of the interval, confidence intervals are only computed when this argument is provided

  • axis (int, optional) – the axis of the data on which to operate, by default the last axis

Returns

This function returns (m, [le, ue]) and the confidence interval is [m-le, m+ue].

Return type

tuple (float, [float, float])

pyroomacoustics.metrics.mse(x1, x2)

A short hand to compute the mean-squared error of two signals.

\[\begin{split}MSE = \\frac{1}{n}\sum_{i=0}^{n-1} (x_i - y_i)^2\end{split}\]
Parameters
  • x1 – (ndarray)

  • x2 – (ndarray)

Returns

(float) The mean of the squared differences of x1 and x2.

pyroomacoustics.metrics.pesq(ref_file, deg_files, Fs=8000, swap=False, wb=False, bin='./bin/pesq')

pesq_vals = pesq(ref_file, deg_files, sample_rate=None, bin=’./bin/pesq’): Computes the perceptual evaluation of speech quality (PESQ) metric of a degraded file with respect to a reference file. Uses the utility obtained from ITU P.862 http://www.itu.int/rec/T-REC-P.862-200511-I!Amd2/en

Parameters
  • ref_file – The filename of the reference file.

  • deg_files – A list of degraded sound files names.

  • sample_rate – Sample rates of the sound files [8kHz or 16kHz, default 8kHz].

  • swap – Swap byte orders (whatever that does is not clear to me) [default: False].

  • wb – Use wideband algorithm [default: False].

  • bin – Location of pesq executable [default: ./bin/pesq].

Returns

(ndarray size 2xN) ndarray containing Raw MOS and MOS LQO in rows 0 and 1, respectively, and has one column per degraded file name in deg_files.

pyroomacoustics.metrics.snr(ref, deg)
pyroomacoustics.metrics.sweeping_echo_measure(rir, fs, t_min=0, t_max=0.5, fb=400)

Measure of sweeping echo in RIR obtained from image-source method. A higher value indicates less sweeping echoes

For details see : De Sena et al. “On the modeling of rectangular geometries in room acoustic simulations”, IEEE TASLP, 2015

Parameters
  • rir (RIR signal from ISM (mono).) –

  • fs (sampling frequency.) –

  • t_min (TYPE, optional) – Minimum time window. The default is 0.

  • t_max (TYPE, optional) – Maximum time window. The default is 0.5.

  • fb (TYPE, optional) – Mask bandwidth. The default is 400.

Return type

sweeping spectrum flatness (ssf)