clarity.enhancer.gha.gha_interface module¶
- class clarity.enhancer.gha.gha_interface.GHAHearingAid(sample_rate=44100, ahr=20, audf=None, cfg_file='prerelease_combination4_smooth', noise_gate_levels=None, noise_gate_slope=0, cr_level=0, max_output_level=100, equiv_0db_spl=100, test_nbits=16)[source]¶
Bases:
object
- create_HA_inputs(infile_names: list[str], merged_filename: str) None [source]¶
Create input signal for baseline hearing aids.
The baseline hearing aid takes a 4-channel wav file as input. This is constructed from the left and right signals of the front (CH1) and rear (CH3) microphones that are available in the Clarity data.
- Args:
infile_names (list[str]): Names of file to read merged_file_name (str): Name of file to write
- Raises:
ValueError: If input channel names are inconsistent
- create_configured_cfgfile(input_file, output_file, formatted_sGt, cfg_template_file)[source]¶
Using Jinja2, generates cfg file for given configuration.
Creates template output file and configures with correct filenames, peak level out and DC gaintable.
- Parameters:
input_file (str) – file to process
output_file (str) – file in which to store processed file
formatted_sGt (ndarray) – gaintable formatted for input into cfg file
cfg_template_file – configuration file template
ahr (int) – amplification headroom
- Returns:
cfg filename
- Return type:
cfg_filename (str)
- process_files(infile_names: list[str], outfile_name: str, listener: Listener)[source]¶
Process a set of input signals and generate an output.
- Parameters:
infile_names (list[str]) – List of input wav files. One stereo wav file for each hearing device channel
outfile_name (str) – File in which to store output wav files
dry_run (bool) – perform dry run only