🎻 String Physics — Vibrating String & Harmonics 🇺🇦 Українська
f₀ (Hz)
fₙ (Hz)
1
Mode
0.0
Amp (px)

⚙️ String Parameters

🎵 Harmonics

🎛 Controls

Click & drag on string to pluck

Wave equation:
∂²y/∂t² = (T/μ)·∂²y/∂x²

Wave speed:
c = √(T/μ)

Harmonics:
fₙ = n·c / (2L)   n=1,2,3…

Normal mode:
y(x,t) = A·sin(nπx/L)·cos(2πfₙt)

About the Vibrating String Simulation

This simulation models a flexible string fixed at both ends, the classic one-dimensional wave system behind every plucked or bowed instrument. It solves the wave equation, ∂²y/∂t² = (T/μ)·∂²y/∂x², numerically using a finite-difference scheme: 300 discrete nodes are advanced in time with an explicit leapfrog update governed by the Courant–Friedrichs–Lewy stability condition. The string moves at wave speed c = √(T/μ), producing standing waves whose nodes and antinodes you can watch directly.

The sliders set tension T (50–1000 N), linear density μ (0.0002–0.005 kg/m) and a damping factor that bleeds energy away each step. The harmonic buttons load pure normal modes n=1 to n=10, while Pluck, Reset, the live trail, node markers and the harmonic spectrum reveal the physics. Understanding why fundamental and overtone frequencies follow fₙ = n·c/(2L) explains the pitch and timbre of guitars, violins, pianos and harps.

Frequently Asked Questions

What does this string physics simulation show?

It shows a taut string pinned at both ends vibrating in real time. You can pluck it, drag it into shape, or excite a single pure harmonic, and watch the resulting standing wave with its stationary nodes and oscillating antinodes. Live statistics report the fundamental frequency, the selected mode frequency, the mode number and the peak amplitude.

How does the simulation actually compute the motion?

It discretises the string into 300 nodes and solves the 1D wave equation with an explicit finite-difference (leapfrog) scheme. Each node's next position depends on its current and previous values plus the curvature of its neighbours, scaled by the Courant number r = c·dt/dx. A safety factor of 0.4 keeps the timestep within the CFL stability limit so the solution never blows up.

What do the tension, density and damping sliders do?

Tension T and linear density μ set the wave speed c = √(T/μ), which in turn fixes every frequency: tightening the string raises pitch, a heavier string lowers it. The damping slider (0.990–0.9999) multiplies each node every step, so values below 1 make the vibration decay gradually, just as a real plucked note fades to silence.

What is the difference between a node and an antinode?

A node is a point on the string that stays still, where the wave amplitude is always zero; the fixed endpoints are permanent nodes. An antinode is a point of maximum displacement, halfway between adjacent nodes. The mode number n equals the number of antinodes, so the nth harmonic has n+1 nodes including the two ends.

Why are the harmonic frequencies whole-number multiples of the fundamental?

A string fixed at both ends can only support standing waves whose half-wavelengths fit exactly into its length L. That boundary condition forces the allowed wavelengths to be 2L/n, giving frequencies fₙ = n·c/(2L) for n = 1, 2, 3 and so on. Because they are exact integer multiples, these overtones are harmonic and the ear perceives them as a single pitched note.

How is the fundamental frequency calculated here?

The fundamental is f₀ = c/(2L) with the string length normalised to L = 1 m, so f₀ = √(T/μ)/2. With the default T = 400 N and μ = 0.001 kg/m the wave speed is about 632 m/s and the fundamental is roughly 316 Hz. The mode statistic simply multiplies this by the selected harmonic number n.

Is this simulation physically accurate?

The underlying wave equation and the relationship c = √(T/μ) are exact for an ideal flexible string, and the finite-difference solver reproduces them faithfully within numerical limits. It is a 2D visualisation that ignores string stiffness, air resistance details and the slight inharmonicity of real strings, so it is an idealised but quantitatively sound teaching model rather than an instrument-grade emulator.

What does the harmonic spectrum view display?

The spectrum panel estimates how much of each harmonic is present in the current string shape by projecting the displacement onto the sine modes sin(nπx/L). Each bar's height reflects the amplitude of that harmonic, and the active mode is highlighted. A plucked string shows several bars at once, illustrating that real notes are a blend of overtones.

Why does where I pluck change the sound?

The shape you impose on the string sets the starting mix of harmonics. Plucking near the centre favours the fundamental and odd modes, while plucking near an end excites more high overtones, giving a brighter, twangier tone. This is exactly why guitarists pick close to the bridge for a sharper sound, an effect you can explore by dragging at different points.

What real-world things does this model explain?

It explains the physics of all string instruments: guitars, violins, cellos, pianos and harps all produce pitch through standing waves set by tension, length and mass per unit length. The same mathematics governs telephone and power lines swaying, vocal cord vibration, and any taut medium, and it is the gateway to understanding resonance, timbre and Fourier analysis of sound.