Skip to content

rohitbams/Harmonium-Physical-Model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Harmonium Physics Engine

A physics-based audio synthesis plugin that simulates the acoustic behavior of a harmonium using numerical modeling of aeroacoustic principles.

Overview

This project implements a real-time digital harmonium synthesizer as a VST3 and standalone application using the JUCE framework. The synthesis engine is based on physical modeling of reed oscillation, air flow dynamics, and pressure propagation within the instrument's acoustic chambers.

Architecture

Core Components

PhysicsEngine (Source/PhysicsEngine.h)

  • Implements the fundamental coupled differential equations equations governing reed oscillation and air flow
  • Models pressure dynamics across three chambers: bellows (p0), reed chamber (p1), and narrow jet (p2)

HarmoniumState (Source/HarmoniumState.h)

  • Contains dynamic state variables: pressures, flow rates, reed displacement and velocity

Voice (Source/Voice.h)

  • Manages polyphonic voice allocation and stealing and supports three reed configurations

Bellows (Source/Bellows.h)

  • Simulates bellows pumping mechanism through MIDI modulation wheel input
  • Models air mass accumulation and consumption

Harmonium (Source/Harmonium.h)

  • Main orchestration class managing six concurrent voices, integrates bellows simulation with voice processing

Convolution (Source/Convolution.h)

  • Implements FFT-based convolution for acoustic space simulation
  • Supports loading custom impulse response files

Plugin Interface

HarmoniumPhysicsEngineAudioProcessor (Source/PluginProcessor.h, Source/PluginProcessor.cpp)

  • JUCE AudioProcessor implementation for DAW integration
  • Handles MIDI note-on/off events and continuous controller messages
  • Per-sample processing loop calling the physics simulation

PluginEditor (Source/PluginEditor.h)

  • Graphical user interface for real-time parameter control

Physical Model

The synthesis model is based on the following coupled equations derived from Puranik and Scavone (2023) [1]:

Reed Chamber Pressure (Equation 1)

V₁/c₀² × d(p₁-p_atm)/dt = ρ₀(u₀ - u)

Where bellows flow (u₀) minus total volume flow (u) determines pressure rate of change.

Inertial Pressure Drop (Equation 2)

p₁ = p₂ + ρ₀L₂/S₂ × du/dt

Relates reed chamber pressure to jet pressure via inertial effects.

Bernoulli's Principle (Equation 3)

p₂ = p_atm + ½ρ₀vⱼ²

Determines jet velocity from pressure differential.

Reed Equation of Motion

d²ζ/dt² = μp₂ - ω₀²ζ - (ω₀/Q)(dζ/dt)

Driven oscillator with pressure forcing, spring restoring force, and damping.

Total Volume Flow (Equation 5)

u = Sr·(dζ/dt) + αSu·vj

Combines reed pumping action with jet flow through aperture.

Pressure-Dependent Damping

An adaptive quality factor mechanism artificially extends decay time when air pressure is present, simulating sustained excitation.

Spectral Shaping

Harmonic content is generated by applying amplitude-frequency weighting to the fundamental flow signal, calibrated to match spectral analysis of recorded harmonium tones.

Implementation Details

  • Sample Rate: Configurable (default 44.1 kHz)
  • Integration Method: Forward Euler with time step dt = 1/sampleRate
  • Voice Count: 6 polyphonic voices with voice stealing
  • Numerical Stability: Clamping applied to state variables to prevent divergence
  • Physical Parameters: Reed dimensions, air density, sound speed, chamber volumes

Build Requirements

  • JUCE 7.x or later
  • C++17 compatible compiler
  • Xcode (macOS), Visual Studio (Windows), or Makefile (Linux)

Building

  1. Open Harmonium.jucer in Projucer
  2. Configure JUCE module paths
  3. Export to your IDE (Xcode, Visual Studio, etc.)
  4. Build the generated project

Alternatively, use the pre-generated Xcode project:

cd Builds/MacOSX
open Harmonium.xcodeproj

Usage

As Plugin

  1. Load Harmonium in your DAW as a VST3 instrument
  2. Route MIDI input to the track
  3. Use MIDI Modulation Wheel (CC1) to pump the bellows
  4. Play notes on your MIDI keyboard

Parameters

  • Air Capacity: Maximum air mass in bellows chamber
  • Reed Chamber Capacity: Maximum air mass in reed chamber
  • Narrow Jet Capacity: Maximum air mass in jet region
  • Air Consumption: Rate at which oscillating reeds consume air
  • Master Gain: Output amplitude scaling
  • Reed Mode: Single, Double, or Triple reed configuration
  • Amplitude Scaling: Spectral content intensity

MIDI Control

  • Note On/Off: Trigger reed oscillation at corresponding frequency
  • Modulation Wheel (CC1): Bellows pumping (higher movement speed increases air mass faster)

Project Structure

Harmonium/
├── Source/
│   ├── Bellows.h              - Bellows air management
│   ├── Convolution.h          - Impulse response convolution
│   ├── Harmonium.h            - Main synthesis coordinator
│   ├── HarmoniumState.h       - State and configuration structures
│   ├── PhysicsEngine.h        - Core physics equations
│   ├── PluginEditor.h         - GUI implementation
│   ├── PluginProcessor.cpp    - Audio/MIDI processing
│   ├── PluginProcessor.h      - Processor interface
│   └── Voice.h                - Polyphonic voice management
├── Builds/
│   └── MacOSX/                - Xcode project files
├── JuceLibraryCode/           - Auto-generated JUCE wrappers
├── Harmonium.jucer            - JUCE project configuration
└── README.md                  - This file

Research Context

This plugin serves as a prototyping platform for investigating physics-based synthesis techniques applied to free-reed instruments. The model parameters are derived from literature on aeroacoustic musical instruments and empirical spectral analysis of harmonium recordings.

Known Limitations

  • Euler integration may exhibit numerical artifacts at very low frequencies
  • Reed collision dynamics not fully modeled (soft clamping used)
  • Spectral profile is static (frequency-dependent parameters not yet implemented)
  • No modeling of reed manufacturing variations beyond detuning
  • Convolution is not optimised for sample-based processing
  • Lacking timbral diversity of different styles of Harmonium (Delhi, Kolkata)

Future Work

  • Block-based processing instead of sample-based processing
  • Implementation of higher-order integration schemes (RK4)
  • Frequency-dependent chamber characteristics
  • Reed-to-reed coupling effects
  • More sophisticated bellows mechanics (pressure-volume relationship)
  • Real-time visualisation of state space trajectories

License

Academic research project - contact for usage permissions.

Author

Developed by me as part of dissertation research at the University of St Andrews.

References

[1] Puranik, N. V., & Scavone, G. P. (2023). Physical modelling synthesis of a harmonium. Proceedings of Meetings on Acoustics, 49(1), 035015. https://doi.org/10.1121/2.0001679

About

A physics-based audio synthesis plugin that simulates the acoustic behaviour of an Indian harmonium using numerical modelling of aeroacoustic principles.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages