Project 5 · Acoustics and music
The missing notes of a closed pipe
Tap a pipe and it plays a note. Predict that note, then find what the textbook gets wrong.
- Math
- Algebra II, trigonometry
- You need
- A phone and about $10 of PVC pipe
- Tools
- Phone, PVC pipe, Python or a spreadsheet
- Solver
- Wave, 1D
The question
A pipe closed at one end should play only odd harmonics. How closely does a real pipe follow the model, and what is the size of the 'end correction' the ideal model leaves out as the pipe gets wider?
Objectives
Twelve weeks, in the four stages every TopEdu project follows. Your mentor reviews each checkpoint before you move on.
Weeks 1 to 3
Learn to trust the model
Run 05_pipe_resonance.py until its CHECK line says PASS, and explain every line of it to your mentor. Then reproduce a known answer: Pipe modes are fₙ = (2n − 1)c / 4L, with no even harmonics.
Checkpoint: you reproduce a known answer and report how close you got.
Weeks 4 and 5
Ask your own question
Narrow the question above to one sentence that could turn out to be wrong, and write your prediction before you run anything. The first experiments below are a place to start.
Checkpoint: a one-page plan with your question and prediction.
Weeks 6 to 9
Run it, then measure the world
Simulate a pulse in the pipe, extract its frequencies, and compare them with recordings of PVC pipes of several lengths and diameters. Then step away from the screen: tap or blow across PVC pipes and record them with a free phone spectrum app.
Checkpoint: one chart comparing your model with reality.
Weeks 10 to 12
Explain the gap, and share it
Work out why your model and your measurements disagree, test at least one explanation, and write it up yourself. Say which numbers came from the starter and which from the lab. Keep the honest limit in view: the model has a perfect open end. The gap between the model and your recording is the discovery, not a failure.
Checkpoint: a final paper, your code and a ten-minute talk.
The data
What the lab lets you change, how the project was checked before we listed it, and what the starter prints on a laptop.
Settings in the online lab
| Setting | Range | Starts at |
|---|---|---|
| Pipe length | 0.2 to 2 m | 0.6 |
| Speed of sound | 320 to 360 m/s | 343 |
Checked on the research solver
| Solver (Wave, 1D) | mode 1: 142.90 Hz; mode 2: 428.43 Hz |
|---|---|
| Known answer | 142.92 Hz; 428.75 Hz |
| Error | 0.07% (limit 1.00%): passed |
| A first finding | the second mode sits at 2.998 times the first: 3, with no even harmonic |
What the starter prints
From the run that built this page. Timings depend on your computer; the CHECK line must say PASS.
note 1: simulated 142.92 Hz, formula 142.92 Hz, error 0.000% note 2: simulated 428.75 Hz, formula 428.75 Hz, error 0.001% ratio of note 2 to note 1: 3.000 (the ideal pipe says 3: no even harmonic) CHECK first two notes against (2n - 1) c / 4L -> PASS (limit 1%)

The starter code
One Python file that needs only numpy and matplotlib. Run python3 05_pipe_resonance.py --show to see the plots. How to set up.
The model
Sound in a pipe closed at one end and open at the other obeys the wave equation. The closed end reflects pressure as it is; the open end (ideally) forces pressure to zero. So the pipe only fits odd quarter-waves, and its notes are f_n = (2n - 1) c / 4L: 1, 3, 5, ... times the lowest note, with no even harmonics.
What it does
- Stage 1: run this file. It starts a pressure pulse in a 0.6 m pipe, listens at the closed end, finds the notes with a Fourier transform, and checks the first two against the formula. The CHECK line should say PASS.
- Stage 2: record real PVC pipes, find their notes with the same code, and measure what the ideal model leaves out.
Your first experiments
From the YOUR TURN list at the bottom of the file. Write your prediction in your log before you run each one.
- Predict, then record: a 0.6 m PVC pipe closed at one end (a palm or a cap). Is its lowest note above or below the formula? Run: python 05_pipe_resonance.py my_pipe.wav
- End correction: a real open end acts as if the pipe were longer, by about delta. From each recording, delta = c / (4 f_1) - L. Measure it for pipes of three or more widths. How does delta depend on the radius? (Textbooks quote about 0.6 times the radius. Do your pipes agree?)
- Look for even harmonics in your recordings. If any appear, what could make them?
- The speed of sound changes with temperature: c is about 331 + 0.6 T(C) m/s. Note the room temperature.
Download 05_pipe_resonance.pyAll ten (.zip)Instructions (PDF)
The real world
Tap or blow across PVC pipes and record them with a free phone spectrum app.
The honest limit
The model has a perfect open end. The gap between the model and your recording is the discovery, not a failure.
Want to work on this one?
Members run it on the research solver in the lab and choose a mentor to guide them.