Worcester Polytechnic Institute

Wave File Analysis

Home

Google

Online Materials

Contact Us

Site Map

 

What is a Wave File?

 

Given this wave file, right click on it and go to save target as.  Save the file to the desktop so that the following wavread command is valid.  We can import the wave file into the Matlab workspace using wavread.  Type help wavread into the command window to find out more.  Italicized blue fonts are Matlab commands that are meant to be executed as you proceed through this tutorial.

 

          [force,fs]=wavread('c:/windows/desktop/force.wav');

 

This line will set force as n points of the wave and fs to the sampling frequency of the wave.  Now enter fs into the command window.  This shows the sampling frequency of 22,050 Hz.  How many points are in the wave file?  Enter length(force).  This displays that 93,648 points are contained in the wave file.  To listen to the wave file enter sound(force,fs).  The sampling frequency must be displayed for proper playback.  Try changing fs to 8,000 Hz or 40,000 Hz, what happens? 

 

Topics:

·        Now that we have heard the wave why don’t we look at it? To plot force.wav we need to clear (clc) our workspace and set t to a new array, or simply create an M-File.

·        Previously we noted that the FFT of a wave file was possible. Now let’s do that. Plot the FFT of the wave file.

 

Based on the above information you should be able to analyze any wave file. 

 

[WPI]***