clarity.evaluator.haaqi package

Submodules

Module contents

clarity.evaluator.haaqi.compute_haaqi(processed_signal: ndarray, reference_signal: ndarray, processed_sample_rate: float, reference_sample_rate: float, audiogram: Audiogram, equalisation: int = 1, level1: float = 65.0) float[source]

Compute HAAQI metric

Parameters:
  • processed_signal (np.ndarray) – Output signal with noise, distortion, HA gain, and/or processing.

  • reference_signal (np.ndarray) – Input reference speech signal with no noise or distortion. If a hearing loss is specified, NAL-R equalization is optional

  • processed_sample_rate (float) – Sampling rate in Hz for processed signal.

  • reference_sample_rate (float) – Sampling rate in Hz for reference signal.

  • audiogram (Audiogram) – Audiogram object.

  • equalisation (int) – hearing loss equalization mode for reference signal: 1 = no EQ has been provided, the function will add NAL-R 2 = NAL-R EQ has already been added to the reference signal Defaults to 1.

  • level1 (float) – Optional input specifying level in dB SPL that corresponds to a signal RMS = 1. Default is 65 dB SPL.

clarity.evaluator.haaqi.haaqi_v1(reference: ndarray, reference_freq: float, processed: ndarray, processed_freq: float, audiogram: Audiogram, equalisation: int, level1: float = 65.0, silence_threshold: float = 2.5, add_noise: float = 0.0, segment_covariance: int = 16) tuple[float, float, float, list[float]][source]

Compute the HAAQI music quality index using the auditory model followed by computing the envelope cepstral correlation and Basilar Membrane vibration average short-time coherence signals.

The reference signal presentation level for NH listeners is assumed to be 65 dB SPL. The same model is used for both normal and impaired hearing.

Parameters:
  • reference (ndarray) – Input reference speech signal with no noise or distortion. If a hearing loss is specified, NAL-R equalization is optional

  • reference_freq (int) – Sampling rate in Hz for reference signal.

  • processed (np.ndarray) – Output signal with noise, distortion, HA gain, and/or processing.

  • processed_freq (int) – Sampling rate in Hz for processed signal.

  • hearing_loss (np.ndarray) – (1,6) vector of hearing loss at the 6 audiometric frequencies [250, 500, 1000, 2000, 4000, 6000] Hz.

  • equalisation (int) – hearing loss equalization mode for reference signal: 1 = no EQ has been provided, the function will add NAL-R 2 = NAL-R EQ has already been added to the reference signal

  • level1 (int) – Optional input specifying level in dB SPL that corresponds to a signal RMS = 1. Default is 65 dB SPL if argument not provided. Default: 65

  • silence_threshold (float) – Silence threshold sum across bands, dB above auditory threshold. Default : 2.5

  • add_noise (float) – Additive noise dB SL to condition cross-covariances. Defaults to 0.0

  • segment_covariance (int) – Segment size for the covariance calculation. Defaults to 16

Returns:

Quality is the polynomial sum of the nonlinear and linear terms nonlinear : Nonlinear quality component = .245(BMsync5) + .755(CepHigh)^3 linear : Linear quality component = std of spectrum and norm spectrum raw : Vector of raw values = [cephigh, bmsync5, dloud, dnorm]

Return type:

combined

James M. Kates, 5 August 2013 (HASQI_v2). Version for HAAQI_v1, 19 Feb 2015.

Translated from MATLAB to Python by Gerardo Roa Dabike, September 2022.