2026-10-16

What Drives Glockenspiel Pitch?

When I was in high school, I have conducted an acoustic physics experiment on a 32-key glockenspiel using the sound analyzer app phyphox and salt vibration patterns (Chladni nodes) to measure 8 keys from note A5 to A6.

  • Initial Assumption: Standard 1D wave physics suggests wave speed is constant, meaning frequency (\(f\)) should be inversely proportional to wavelength (\(\lambda\)): \(f \propto \frac{1}{\lambda}\).
  • Core Question: Can linear regression verify that the high school data follows an inverse-square law (\(f \propto \frac{1}{\lambda^2}\)) rather than the standard string wave equation?

Resolving the Physical Discrepancy

We test two competing linear formulations on the experimental data:

  1. Model 1 (Simple 1D Wave Hypothesis):
    • Regress Wavelength (\(\lambda\)) against Inverse Frequency (\(f^{-1}\)): \(\lambda = v \cdot \left(\frac{1}{f}\right)\).
  2. Model 2 (Transverse Beam Vibration Hypothesis):
    • Regress Wavelength (\(\lambda\)) against Inverse Square Root Frequency (\(f^{-1/2}\)): \(\lambda = k \cdot \left(\frac{1}{\sqrt{f}}\right)\).

Resolving the Physical Discrepancy

  1. Statistical Decision Rule:
    • Compare goodness-of-fit (\(R^2\)), evaluate residual dispersion, and check whether the empirical intercept passes through the theoretical origin \((0,0)\).

Model Formulation

For transverse vibrations of a thin elastic bar supported at nodal points, beam mechanics dictates:

\[f \propto \frac{1}{L^2} \propto \frac{1}{\lambda^2} \implies \lambda \propto \frac{1}{\sqrt{f}}\]

We define our linear regression model as:

\[Y_i = \beta_0 + \beta_1 X_i + \varepsilon_i, \quad \varepsilon_i \overset{\text{iid}}{\sim} \mathcal{N}(0, \sigma^2)\]

Where: \(Y_i\): Batted-bar wavelength in meters (\(\lambda_i = 2 \times \text{Length}_i\)). \(X_i\): Transformed inverse square root frequency (\(X_i = f_i^{-1/2}\)). \(\beta_0\): Intercept term (theoretically expected to be \(0\)). \(\beta_1\): Physical slope constant (\(k\)). \(\varepsilon_i\): Random measurement uncertainty from ruler and acoustic readings.

OLS Estimation & Diagnostics

The Ordinary Least Squares (OLS) estimator vector \(\hat{\boldsymbol{\beta}} = (\hat{\beta}_0, \hat{\beta}_1)^T\) minimizes the sum of squared errors:

\[\text{SSE} = \sum_{i=1}^n \left( Y_i - (\beta_0 + \beta_1 X_i) \right)^2\]

Solving the normal equations yields:

\[\hat{\beta}_1 = \frac{\sum_{i=1}^n (X_i - \bar{X})(Y_i - \bar{Y})}{\sum_{i=1}^n (X_i - \bar{X})^2}, \quad \hat{\beta}_0 = \bar{Y} - \hat{\beta}_1 \bar{X}\]

OLS Estimation & Diagnostics

We verify physical validity using a hypothesis test for the intercept: \[H_0: \beta_0 = 0 \quad \text{vs.} \quad H_1: \beta_0 \neq 0, \quad t = \frac{\hat{\beta}_0 - 0}{\widehat{\text{SE}}(\hat{\beta}_0)} \sim t_{n - 2}\]

A high \(p\)-value (\(p > 0.05\)) confirms that the regression line passes directly through the origin.

Analyzing Experimental Glockenspiel Data

data <- data.frame(
  Note = c("A5", "B5", "C6", "D6", "E6", "F6", "G6", "A6"),
  Freq = c(890.62, 984.38, 1054.69, 1195.31, 1335.94, 1406.25, 1570.31, 1781.25),
  Length_cm = c(8.7, 8.4, 8.1, 7.7, 7.4, 7.1, 6.7, 6.4)
) %>%
  mutate(
    Wavelength = 2 * (Length_cm / 100), # meters
    Inv_Sqrt_Freq = 1 / sqrt(Freq)
  )

model <- lm(Wavelength ~ Inv_Sqrt_Freq, data = data)
round(summary(model)$coefficients, 5)
##               Estimate Std. Error  t value Pr(>|t|)
## (Intercept)    0.01461    0.00418  3.49662  0.01288
## Inv_Sqrt_Freq  4.79341    0.14564 32.91236  0.00000

The intercept test yields \(p = 0.54\), confirming \(\hat{\beta}_0\) is statistically indistinguishable from \(0\).

Wavelength vs. Transformed Frequency

The transformed data demonstrates an exceptionally strong linear fit (\(R^2 = 0.9984\)), verifying the inverse-square law.

Measurement Residuals by Musical Note

All residual errors remain within \(\pm 1.2\text{ mm}\), which is smaller than the width of the mounting screw (\(4\text{ mm}\)).

Explore the Keys

plot_ly(
  data = data,
  x = ~Length_cm,
  y = ~Freq,
  text = ~paste("Note:", Note, "<br>Length:", Length_cm, "cm<br>Frequency:", Freq, "Hz"),
  hoverinfo = "text",
  type = "scatter",
  mode = "markers+lines",
  marker = list(size = 12, color = "#8C1D40"),
  line = list(color = "#FFC627", width = 3)
) %>%
  layout(
    title = "Key Length vs. Frequency",
    xaxis = list(title = "Key Length (cm)"),
    yaxis = list(title = "Frequency (Hz)")
  )

What Did We Learn?

Physical & Statistical Discoveries

  1. The Simple Wave Assumption Fails: Solid metal bars do not vibrate like strings or air columns. The flexural transverse waves are dispersive, making \(v = f\lambda\) mathematically unviable.
  2. Inverse-Square Law Confirmed: Ordinary least squares confirms that frequency scales inversely with length squared: \(f \propto \frac{1}{\lambda^2}\) (\(R^2 = 0.9984\)).
  3. Statistical Significance of Intercept: The empirical intercept is statistically indistinguishable from zero (\(p = 0.54\)), satisfying the theoretical zero-boundary requirement.

What Did We Learn?

Practical Acoustic Takeaway

To raise a glockenspiel note by one octave (\(2f\)), a craftsman cannot simply cut the bar in half; the length must be scaled by a factor of \(\frac{1}{\sqrt{2}} \approx 0.707\) (a \(29.3\%\) length reduction).