WAV Sound Files
READWAV("file")—Returns the audio data contained in the WAV file file and places it into a matrix. Each column represents a separate channel of data. Each row corresponds to a sample in time.
WRITEWAV("file", s, b, M)—Writes the data contained in the array M to a WAV file using the sample rate s and bit resolution b.
GETWAVINFO(“file”)—Returns a vector containing, in order, the format information of a WAV file:
The number of channels
The sample rate
The bit resolution (or the number of bits per sample)
The average number of bytes per second that an audio player device would have to process to play the audio in real time.
Arguments
file is a string corresponding to the pulse code modulated (PCM) Microsoft WAV filename or path and filename.
s is an integer sample rate.
b is an integer bit resolution. 1 ≤ b ≤16.
M is a matrix of real numbers, where each column corresponds to a different channel, and each row to a sample in time.
Additional Information
If the specified bit resolution b is 1-8, the data is written to file as unsigned byte data.
The limits on values in the vector of amplitudes M range from 0 to 255 (28).
If b is 9-16, word data (two bytes) is written to file. The limits on word data are −32768 to +32767 (215).
Was this helpful?