Recent work needs, to the WAV file stored in the Audio information analysis processing. So it took some time to collect the methods of processing WAV files in various mathematical softwares. Matlab
Matlab is the most convenient. Even without writing any code can read WAV file (I use the MATLAB 7.1). Double-click the WAV file in the current path window to automatically read the contents of the file.
Figure 1 Current Path window
Double-clicking will automatically eject the Data Import Wizard. Data is a waveform file (each column corresponds to a channel), the FS deposit is the sampling rate. These two variable names can be modified according to their own needs.
Figure 2 Data Import Wizard
The corresponding function is Wavread (). There are several calling formats below.
y = wavread (' filename ')
This is the simplest form of the WAV file to read the waveform data into Y, the amplitude of the waveform range in [-1, 1].
[Y,fs,bits] = wavread (' filename ')
Fs is the sample rate, unit Hz, BITS is the number of bits of data.
[...] = Wavread (' filename ', N)
Read only the first N number of positions.
[...] = Wavread (' filename ', [N1 N2])
Read only data between N1 and N2.
Siz = wavread (' filename ', ' size ')
Reads the WAV file how many data points, Siz is a 1 row two column vector. Siz = [samples channels]
Wavfinfo () is used to obtain information about WAV files.
[m d] = wavfinfo (filename)
M returns the string ' Sound (WAV) file ' When filename is a WAV file, otherwise an empty string is returned.
D returns a new string containing WAV, such as the result given here: ' Sound (WAV) file containing:41532 samples in 1 channel (s) ', if filename is not a WAV file, return string ' not a WA VE file '.
The Wavwrite function can generate a WAV file with three basic invocation formats.
Wavwrite (y, ' filename ')
Writes the data in Y to the WAV file, where each column of y corresponds to a channel. The data in Y is required in [-1, 1]. Those that are beyond this range are truncated. The sample rate defaults to 8000Hz. 16-bit format.
Wavwrite (y,fs, ' filename ')
Fs is used to set the sampling rate.
Wavwrite (y,fs,n, ' filename ')
N specifies the number of digits for the data, which can be 8, 16, 24, and 32. When N. When =32, WAV files are stored according to the PCM code. When n=32, data is stored in floating-point format. It does not require the data range to be between 1 and 1.