evaluate

Evaluate the enhanced signals using the HAAQI metric.

recipes.cad_icassp_2024.baseline.evaluate.apply_gains(stems: dict, sample_rate: float, gains: dict) dict[source]

Apply gain to the signal by using LUFS.

Parameters:
  • stems (dict) – Dictionary of stems.

  • sample_rate (float) – Sample rate of the signal.

  • gains (dict) – Dictionary of gains.

Returns:

Dictionary of stems with applied gains.

Return type:

dict

recipes.cad_icassp_2024.baseline.evaluate.apply_ha(enhancer: NALR, compressor: Compressor | None, signal: ndarray, audiogram: Audiogram, apply_compressor: bool = False) ndarray[source]

Apply NAL-R prescription hearing aid to a signal.

Parameters:
  • enhancer (NALR) – A NALR object that enhances the signal.

  • compressor (Compressor | None) – A Compressor object that compresses the signal.

  • signal (ndarray) – An ndarray representing the audio signal.

  • audiogram (Audiogram) – An Audiogram object representing the listener’s audiogram.

  • apply_compressor (bool) – Whether to apply the compressor.

Returns:

An ndarray representing the processed signal.

recipes.cad_icassp_2024.baseline.evaluate.level_normalisation(signal: ndarray, reference_signal: ndarray, sample_rate: float) ndarray[source]

Normalise the signal to the LUFS level of the reference signal.

Parameters:
  • signal (ndarray) – Signal to normalise.

  • reference_signal (ndarray) – Reference signal.

  • sample_rate (float) – Sample rate of the signal.

Returns:

Normalised signal.

Return type:

ndarray

recipes.cad_icassp_2024.baseline.evaluate.load_reference_stems(music_dir: str | Path) tuple[dict[str, ndarray], ndarray][source]

Load the reference stems for a given scene.

Parameters:
  • scene (dict) – The scene to load the stems for.

  • music_dir (str | Path) – The path to the music directory.

Returns:

A dictionary of reference stems. original_mixture (ndarray): The original mixture.

Return type:

reference_stems (dict)

recipes.cad_icassp_2024.baseline.evaluate.make_scene_listener_list(scenes_listeners: dict, small_test: bool = False) list[source]

Make the list of scene-listener pairing to process

Parameters:
  • scenes_listeners (dict) – Dictionary of scenes and listeners.

  • small_test (bool) – Whether to use a small test set.

Returns:

List of scene-listener pairings.

Return type:

list

recipes.cad_icassp_2024.baseline.evaluate.remix_stems(stems: dict, reference_signal, sample_rate: float) ndarray[source]

Remix the stems into a stereo signal.

The remixing is done by summing the stems. Then, the signal is normalised to the LUFS level of the reference signal.

Parameters:
  • stems (dict) – Dictionary of stems.

  • reference_signal (ndarray) – Reference signal.

  • sample_rate (float) – Sample rate of the signal.

Returns:

Stereo signal.

Return type:

ndarray

recipes.cad_icassp_2024.baseline.evaluate.run_calculate_aq(config: DictConfig) None[source]

Evaluate the enhanced signals using the HAAQI metric.

recipes.cad_icassp_2024.baseline.evaluate.set_song_seed(song: str) None[source]

Set a seed that is unique for the given song