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

:param : :type : returns: A tuple (m, [le, ue]). The confidence interval is [m-le, m+ue].

pyroomacoustics.metrics.mse(x1, x2)

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

\[MSE = \frac{1}{n}\sum_{i=0}^{n-1} (x_i - y_i)^2\]
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)