clarity.evaluator.hasqi package¶
Submodules¶
clarity.evaluator.hasqi.hasqi module¶
- clarity.evaluator.hasqi.hasqi.hasqi_v2(reference: ndarray, reference_sample_rate: float, processed: ndarray, processed_sample_rate: float, audiogram: Audiogram, equalisation: int = 1, 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]¶
Function to compute the HASQI version 2 quality index using the auditory model followed by computing the envelope cepstral correlation and BM 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 (np.ndarray) – Clear input reference speech signal with no noise or distortion. If a hearing loss is specified, NAL-R equalization is optional
reference_sample_Rate (int) – Sampling rate in Hz for reference signal.
processed (np.ndarray) – Output signal with noise, distortion, HA gain, and/or processing.
processed_sample_rate (int) – Sampling rate in Hz for processed signal.
hearing_loss (np.ndarray) – vector of hearing loss at the 6 audiometric frequencies [250, 500, 1000, 2000, 4000, 6000] Hz.
equalisation (int) – Mode to use when equalising the 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 – Optional input specifying level in dB SPL that corresponds to a signal RMS = 1. Default is 65 dB SPL if argument not provided.
silence_threshold (float) – Silence threshold sum across bands, dB above audio threshold. Default: 2.5
add_noise (float) – Additive noise in dB SL to conditional cross-covariance. Default is 0.0
segment_covariance (int) – Segment size for the covariance calculation. Default is 16
- Returns:
- tuple(Combined, Nonlin, Linear, raw)
Combined: Quality estimate is the product of the nonlinear and linear terms Nonlin: Nonlinear quality component = (cepstral corr)^2 x seg BM coherence Linear: Linear quality component = std of spectrum and spectrum slope raw: Vector of raw values = [CepCorr, BMsync5, Dloud, Dslope]
James M. Kates, 5 August 2013. Translated from MATLAB to Python by Gerardo Roa Dabike, October 2022.
- clarity.evaluator.hasqi.hasqi.hasqi_v2_better_ear(reference_left: ndarray, reference_right: ndarray, processed_left: ndarray, processed_right: ndarray, sample_rate: float, listener: Listener, level: float = 100.0) float [source]¶
Better ear HASQI.
Calculates HASQI for left and right ear and selects the better result.
- Parameters:
reference_left (np.ndarray) – left channel of reference signal
reference_right (np.ndarray) – right channel of reference signal
reference_left – left channel of processed signal
reference_right – right channel of processed signal
sample_rate – sampling rate for both signal
audiogram_l – left ear audiogram
audiogram_r – right ear audiogram
level – level in dB SPL corresponding to RMS=1
audiogram_freq – selected frequencies to use for audiogram
- Returns:
beHASQI score
- Return type:
float
Gerardo Roa Dabike, November 2022
Module contents¶
- clarity.evaluator.hasqi.hasqi_v2(reference: ndarray, reference_sample_rate: float, processed: ndarray, processed_sample_rate: float, audiogram: Audiogram, equalisation: int = 1, 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]¶
Function to compute the HASQI version 2 quality index using the auditory model followed by computing the envelope cepstral correlation and BM 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 (np.ndarray) – Clear input reference speech signal with no noise or distortion. If a hearing loss is specified, NAL-R equalization is optional
reference_sample_Rate (int) – Sampling rate in Hz for reference signal.
processed (np.ndarray) – Output signal with noise, distortion, HA gain, and/or processing.
processed_sample_rate (int) – Sampling rate in Hz for processed signal.
hearing_loss (np.ndarray) – vector of hearing loss at the 6 audiometric frequencies [250, 500, 1000, 2000, 4000, 6000] Hz.
equalisation (int) – Mode to use when equalising the 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 – Optional input specifying level in dB SPL that corresponds to a signal RMS = 1. Default is 65 dB SPL if argument not provided.
silence_threshold (float) – Silence threshold sum across bands, dB above audio threshold. Default: 2.5
add_noise (float) – Additive noise in dB SL to conditional cross-covariance. Default is 0.0
segment_covariance (int) – Segment size for the covariance calculation. Default is 16
- Returns:
- tuple(Combined, Nonlin, Linear, raw)
Combined: Quality estimate is the product of the nonlinear and linear terms Nonlin: Nonlinear quality component = (cepstral corr)^2 x seg BM coherence Linear: Linear quality component = std of spectrum and spectrum slope raw: Vector of raw values = [CepCorr, BMsync5, Dloud, Dslope]
James M. Kates, 5 August 2013. Translated from MATLAB to Python by Gerardo Roa Dabike, October 2022.
- clarity.evaluator.hasqi.hasqi_v2_better_ear(reference_left: ndarray, reference_right: ndarray, processed_left: ndarray, processed_right: ndarray, sample_rate: float, listener: Listener, level: float = 100.0) float [source]¶
Better ear HASQI.
Calculates HASQI for left and right ear and selects the better result.
- Parameters:
reference_left (np.ndarray) – left channel of reference signal
reference_right (np.ndarray) – right channel of reference signal
reference_left – left channel of processed signal
reference_right – right channel of processed signal
sample_rate – sampling rate for both signal
audiogram_l – left ear audiogram
audiogram_r – right ear audiogram
level – level in dB SPL corresponding to RMS=1
audiogram_freq – selected frequencies to use for audiogram
- Returns:
beHASQI score
- Return type:
float
Gerardo Roa Dabike, November 2022