Harmonic Analysis: Using the Least Squares Method to Analyze Sound Waves
CSEF · 2002 Mathematics & Software
Overview
Objectives/Goals My goal was to use a sum of sine functions to accurately estimate sound waves from various musical instruments. Methods/Materials I used a Minidisc digital recording device, microphone, computer (with Audioview 32 sound analysis software, Maple computer program, and Matlab computer program), and musical instruments (piano, acoustic guitar, tuning fork, and recorder). I used the Minidisc to record the sounds from various musical instruments. After downloading the sounds onto my computer as WAV files, I used Audioview to extract just a few hundredths of a second of each sound to analyze. Then I rewrote the WAV files as TXT files using Matlab. These TXT files would contain the data amplitude values Maple could read and analyze. I wrote procedures in Maple using a combination of the least squares method and a loop function to estimate the phase and amplitude of a simple sine function that best fits the data. My hypothesis was that the different frequencies would be integer multiples of a given fundamental frequency. My final equation is a sum of sine functions with different frequencies, amplitudes, and phases. I used the values from these theory equations to produce amplitude values for a TXT file. I converted this TXT file into a WAV file and played back the theory sound. Results Using 10 to 20 frequencies, I was able to approximate the data for single tones from a musical instrument quite well (the average root mean squared error was about 1/10th the size of the amplitude of the original wave). For more complex sounds, however, I require a more sophisticated method, as the RMSE of my approximation of a complex sound (such as a human voice LAH) is quite high. Conclusions/Discussion Using a combination of loop and least squares methods, sums of sines can approximate tones for musical instruments fairly accurately. However it takes a large amount of computer time (20-30 minutes for one tone) and does not work accurately for sounds from the human voice.
Summary statement
I analyzed sound and tried to approximate it using a sum of simple sine functions.
Help received
Dad introduced concept and corrected my programming syntax. Mom helped put board together.
Competition history
- CSEF 2002
Resources
Related projects
CSEF · 2006
The Science of Music
CSEF · 2006
Looking at Sound
CSEF · 2016
Are You in Tune? A Program to Make You a Better Musician
CSEF · 2003
Music to My Ears: A Fourier Analysis of Sounds Produced by Acoustic and Digital Pianos
CSEF · 2002
Mathemusicians: How to Play Music Notes with Mathematical Equations
CSEF · 2019
Characterizing Musical Instruments Using Waveform Analysis
CSEF · 2009
Discovering the Color Spectrum of Sound
CSEF · 2010
Synthesis of Piano Notes
Closest projects by meaning, across every fair and year in the corpus.
Browse more like this
Source: California Science & Engineering Fair public projects