Acoustic Overview & Free-Reed Physics
The harmonica is a free-reed aerophone instrument whose acoustic vibration is governed by complex fluid-structure interactions between directed air streams and flexible metallic reeds riveted onto slotted brass plates. Unlike woodwind instruments (such as clarinets or saxophones) where a reed beats against a curved mouthpiece lay, or brass instruments where human lips form a pressure-controlled gate, the harmonica's free reed moves entirely unconstrained through an acoustic aperture slightly larger than the reed itself.
Inside each chamber ("comb hole") of a 10-hole diatonic harmonica, two distinct reeds are mounted in opposing mechanical polarities. The Blow Reed is riveted to the inside of the top plate, flexing outward into the chamber when positive mouth pressure ($P_{\text{mouth}} > P_{\text{ambient}}$) is exerted during exhaling. Conversely, the Draw Reed is riveted to the outside of the bottom plate, flexing inward into the chamber under negative air pressure differentials ($P_{\text{mouth}} < P_{\text{ambient}}$) generated during inhalation.
The primary mechanical fundamental frequency $f_0$ of a free reed is derived from Euler-Bernoulli beam theory with cantilever boundary conditions:
$$f_0 = \frac{\beta_n^2}{2\pi L^2} \sqrt{\frac{E I}{\rho A}}$$
where $\beta_n \approx 1.875$ represents the fundamental spatial mode eigenvalue, $L$ is the unanchored reed length, $E$ is the Young's modulus of the brass alloy, $I = \frac{w h^3}{12}$ is the second moment of area (given width $w$ and thickness $h$), $\rho$ is the material density, and $A = w h$ is the cross-sectional area. Because shorter and thicker reeds possess higher stiffness-to-mass ratios, holes 1 through 10 taper sequentially from long, flexible low-pitch reeds ($C_4 \approx 261.63\text{ Hz}$) to ultra-short, high-pitch reeds ($C_7 \approx 2093.00\text{ Hz}$).
How to Use the Interactive Laboratory
This web application allows real-time interactive exploration, microphone acoustic breath tracking, and audio synthesis of a 10-hole Richter diatonic harmonica. Follow the intuitive workflow below to operate the simulation across mouse, touch, keyboard, or microphone controls:
- Microphone Acoustic Breath Controller (NEW): Click the
🎙️ MIC: OFF button in the top action header to grant audio input access. When active, blowing or exhaling directly into your device microphone calculates incoming Root Mean Square (RMS) air turbulence energy in real-time. When RMS surpasses the adjustable Noise Gate Threshold, your physical breath directly modulates $P_{\text{breath}}$, controlling sound intensity, visual airflow particle velocity, and reed flex deflection hands-free!
- Mouse & Multi-Touch Playback: Click or tap directly onto the canvas area. Tapping the upper half of any comb hole activates positive blow air pressure (visualized in blue air particles and top reed flex). Tapping the lower half activates negative draw air pressure (visualized in red/orange particles and bottom reed flex). Dragging across the canvas enables seamless legato glissandos.
- Keyboard Shortcut Bindings: Press number keys
1 through 9 and 0 (mapping to Hole 10) to trigger blow notes for the corresponding hole. To trigger draw notes, hold the Spacebar while pressing any number key 1-0.
- Top Action Hierarchy:
Start Demo: Initiates an automated acoustic demonstration sequence playing a classical diatonic melody scale across holes 3 through 7. Any user input (click, touch, keypress, slider adjustment, or mic input) instantly aborts the demo and restores your prior configuration.
Reset Baseline: Instantly resets all tuning keys, breath pressure coefficients, filter frequencies, microphone settings, and active notes back to original baseline factory defaults.
Sound ON/OFF: Unmutes or suspends the internal Web Audio synthesizer engine.
🎙️ MIC ON/OFF: Enables or suspends device microphone audio stream capture and RMS breath tracking.
Technical Details & Mathematical Architecture
The visualizer engine is built completely framework-free in vanilla JavaScript, rendering at 60 FPS via native requestAnimationFrame. High-DPI screen pixelation is prevented by dynamically measuring window.devicePixelRatio ($DPR$) and multiplying the backing store buffer resolution ($W_{\text{canvas}} \times DPR$) while maintaining rigid CSS layout dimensions.
When microphone audio input is enabled via navigator.mediaDevices.getUserMedia(), incoming PCM buffer frames pass through a Biquad Bandpass Filter centered at $150\text{ Hz}$ to isolate low-frequency breath turbulence from high-frequency ambient room noise or speaker feedback. The Root Mean Square (RMS) energy is computed across $N = 512$ time-domain sample frames:
$$\text{RMS} = \sqrt{\frac{1}{N} \sum_{i=0}^{N-1} x_i^2}$$
When $\text{RMS} > \text{Gate}_{\text{threshold}}$, dynamic breath pressure is scaled linearly according to:
$$P_{\text{breath}} = \min\left(2.0, \max\left(0.2, 0.2 + 15 \cdot (\text{RMS} - \text{Gate}_{\text{threshold}})\right)\right)$$
Sound synthesis is driven by the Web Audio API without pre-recorded audio samples. When a hole and direction are engaged, a dual-oscillator topology is constructed combining a harmonic sawtooth wave ($\text{Saw}(t)$) and a fundamental sine wave ($\text{Sine}(t)$):
$$S(t) = A(t) \cdot \Big[ \alpha \cdot \text{Saw}(2\pi f_0 t) + (1-\alpha) \cdot \sin(2\pi f_0 t) \Big]$$
where $\alpha$ is the user-configured wave mix parameter ($0 \le \alpha \le 1$). The signal passes through a second-order Low-Pass Biquad Filter with 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}}$$
configured with cutoff frequency $f_c$ and resonance quality factor $Q = 1.2$ to mirror the natural acoustic dampening of nickel-plated cover plates. Linear ramp gain envelopes ($\tau_{\text{attack}} = 0.03\text{s}$, $\tau_{\text{release}} = 0.05\text{s}$) eliminate digital transient clicks during rapid key tapping, fulfilling low-latency targets ($< 200\text{ms}$ Interaction to Next Paint).
Future Directions & Advanced Mechanics
Prospective physical upgrades to this laboratory workspace aim to model advanced performance techniques that push free-reed mechanics into non-linear acoustic regimes:
- Autocorrelation Vocal Pitch Tracking: Implementing a real-time YIN pitch extraction algorithm on the incoming microphone stream so humming or whistling into the device microphone automatically selects target harmonica holes based on fundamental voice frequency ($f_0$).
- Dual-Reed Acoustic Pitch Bending: Modeling tongue position and vocal tract volume changes that shift acoustic cavity resonance below the natural pitch of the blow or draw reed. When the vocal tract resonance matches the pitch gap between the two reeds in a single chamber, both reeds interlock in complex coupled vibration, allowing the pitch to smoothly bend down by up to three semitones.
- Overblowing & Overdrawing Aerodynamics: Simulating critical air pressure thresholds where the primary closing reed is completely choked by opposing airflow, forcing the opposite opening reed to speak in reverse at a pitch higher than its natural unbent frequency.
- Custom Microtonal & Altered Tunings: Introducing one-click switching to Country Tuning, Paddy Richter, Natural Minor, Harmonic Minor, and 12-Tone Equal Temperament vs. Just Intonation acoustic comparisons.
Related Interactive Laboratories