Overview: Biophysical Foundations of Hearing Loss & Hearing Aid Fitting
Human acoustic perception relies on the complex biomechanical conversion of acoustic air pressure variations into neuroelectrical nerve impulses inside the cochlea. Sound waves enter the external auditory meatus, vibrate the tympanic membrane, and move the ossicular chain (malleus, incus, stapes) to exert fluid pressure against the oval window of the inner ear. Inside the cochlea, the fluid wave propagates along the basilar membrane, inducing tonotopic bending of stereocilia atop sensory hair cells inside the Organ of Corti. High frequencies ($8,000 \text{ Hz} - 20,000 \text{ Hz}$) resonate at the stiff basal turn of the cochlea, whereas low frequencies ($20 \text{ Hz} - 500 \text{ Hz}$) travel to the flexible apical apex.
Sensorineural hearing loss (SNHL) predominantly stems from irreversible damage or loss of outer hair cells (OHCs) and inner hair cells (IHCs) caused by acoustic trauma, ototoxic drugs, presbycusis (age-related degeneration), or genetic predispositions. Outer hair cells function as active electromechanical amplifiers that sharpen mechanical frequency tuning and amplify soft acoustic signals through electromotility powered by prestin proteins. When OHCs degrade, soft sounds fall below perception thresholds, dynamic range narrows dramatically, and recruitment occurs—a paradoxical phenomenon where soft sounds remain completely unheard, yet moderately loud sounds rapidly trigger sensory discomfort.
To quantify hearing impairment, clinical audiometry plots a patient's pure-tone hearing threshold level ($HL$) measured in decibels relative to normal young adult audiometric zero ($\text{dB HL}$). Acoustic intensity in sound pressure level ($\text{dB SPL}$) is transformed into decibels hearing level ($\text{dB HL}$) across standardized octave band frequencies ($125, 250, 500, 1000, 2000, 4000, 8000 \text{ Hz}$):
$$L_p = 20 \log_{10}\left(\frac{p_{rms}}{p_0}\right) \quad [\text{dB SPL}]$$
where $p_0 = 20\ \mu\text{Pa}$ represents the human hearing threshold at $1,000 \text{ Hz}$. Modern digital hearing aid processors act as high-speed multi-band digital signal processors (DSP) that apply dynamic range compression and target gain curves designed to restore speech intelligibility while protecting the residual auditory system from acoustic overload.
Technical Details: Web Audio DSP Pipeline & Canvas Render Engine
The digital processing core of this simulator leverages the high-performance Web Audio API hardware-accelerated pipeline. Acoustic signals pass through a cascading chain of 9 second-order BiquadFilterNodes operating in peaking EQ mode ($Q = 1.414$). Each filter implements the bi-quadratic z-domain transfer function:
$$H(z) = \frac{b_0 + b_1 z^{-1} + b_2 z^{-2}}{a_0 + a_1 z^{-1} + a_2 z^{-2}}$$
Center frequencies ($f_c$) are aligned to octave and half-octave audiometric channels ($50, 125, 250, 500, 1000, 2000, 4000, 8000, 14000 \text{ Hz}$). Gain coefficients for each stage are updated in real time during user interaction. The signal stream flows from the input source into a dual AnalyserNode structure ($FFT = 2048$ bins), permitting parallel spectral comparison between the raw acoustic input and post-processed amplified output.
The canvas visualizer runs an asynchronous $60 \text{ FPS}$ rendering loop driven by requestAnimationFrame. Pixel density is normalized across retina and high-DPI displays by measuring window.devicePixelRatio ($DPR$) and scaling internal canvas buffer dimensions while keeping CSS layout bounds fixed. Mathematical protection wrappers guarantee zero execution crashes by detecting non-finite or $NaN$ coordinate transformations:
$$\text{if } (\text{isNaN}(x) \text{ || } !\text{isFinite}(x)) \implies x = 0$$
To safeguard listener hearing, the final output node passes through a non-linear DynamicsCompressorNode featuring adjustable threshold knee parameters, rapid attack ($0.003 \text{ s}$), and soft release ($0.25 \text{ s}$).