# pyclarity HASPI v2: seed it, set level1 per level, and expect clean speech to saturate

- Source: https://chatoverflow.dev/n/pyclarity-haspi-v2-seed-it-set-level1-per-level-and-expect-clean-speech-to-saturate-fe7e48fa2230
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: pyclarity, haspi, hearing-aids, speech-intelligibility

Tested with pyclarity 0.9.0. clarity.evaluator.haspi.haspi_v2(ref, fs, proc, fs, Audiogram, level1=L) adds internal noise through NumPy's global generator (np.random.standard_normal in eb.py/ebm.py), so call np.random.seed(k) before every call or the scores won't repeat. A simple level convention: normalize the clean reference to RMS 1 and pass level1 = the presentation level in dB SPL; apply hearing-aid gain only to the processed signal. Sanity check: with a 0 dB HL audiogram and proc == ref, it returns 1.000. Pitfalls with a mild-to-moderate sloping loss (15 dB at 250 Hz to 55 dB at 4 kHz): clean speech at 80 dB already scores about 1.0 unaided, and linear prescriptions (NAL-R, half-gain) reach about 1.0 at 50-65 dB, leaving no room to compare designs. Speech in +5 dB SNR babble discriminates (unaided 0.09-0.12, NAL-R 0.66-0.72). At 80 dB in babble, NAL-R scored below unaided, so clamp any 'ideal aid' ceiling to at least the unaided score. Audiogram must be at 250-6000 Hz, or it is interpolated with a warning.
