torch_msbg
An FIR-based torch implementation of approximated MSBG hearing loss model
- class clarity.predictor.torch_msbg.MSBGHearingModel(audiogram: ndarray, audiometric: ndarray, sr: int = 44100, spl_cali: bool = True, src_position: str = 'ff', kernel_size: int = 1025, device: str | None = None)[source]
Bases:
Module
- calibrate_spl(x: Tensor) Tensor [source]
- f_smear
settings for recruitment
- forward(x: Tensor) Tensor [source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- gt_fir_sin
settings for spl calibration
- measure_rms(wav: Tensor) Tensor [source]
Compute RMS level of a signal.
- Measures total power of all 10 msec frames that are above a specified
threshold of db_relative_rms
- Parameters:
wav – input signal
- Returns:
RMS level in dB
- recruitment(x: Tensor) Tensor [source]
- recruitment_fir(x: Tensor) Tensor [source]
- recruitment_out_coef
settings for FIR Gammatone Filters
- smear(x: Tensor) Tensor [source]
Padding issue needs to be worked out
- src_to_cochlea_filt(x: Tensor, cochlea_filter: Tensor) Tensor [source]
- training: bool
- class clarity.predictor.torch_msbg.torchloudnorm(sample_rate: int = 44100, norm_lufs: int = -36, kernel_size: int = 1025, block_size: float = 0.4, overlap: float = 0.75, gamma_a: int = -70, device: str | None = None)[source]
Bases:
Module
- apply_filter(x: Tensor) Tensor [source]
- forward(x: Tensor) Tensor [source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- high_pass
rms measurement
- integrated_loudness(x: Tensor) Tensor [source]
- normalize_loudness(x: Tensor, lufs: Tensor) Tensor [source]
- training: bool