| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
wavwrite(y,filename)
wavwrite(y,Fs,filename)
wavwrite(y,Fs,N,filename)
wavwrite(y,filename) writes the data stored in the variable y to a WAVE file called filename. The filename input is a string enclosed in single quotes. The data has a sample rate of 8000 Hz and is assumed to be 16-bit. Each column of the data represents a separate channel. Therefore, stereo data should be specified as a matrix with two columns.
wavwrite(y,Fs,filename) writes the data stored in the variable y to a WAVE file called filename. The data has a sample rate of Fs Hz and is assumed to be 16-bit.
wavwrite(y,Fs,N,filename) writes the data stored in the variable y to a WAVE file called filename. The data has a sample rate of Fs Hz and is N-bit, where N is 8, 16, 24, or 32.
The range of values in y depends on the number of bits specified by N and the data type of y. The following tables list the valid input ranges based on the value of N and the data type of y.
If y contains integer data:
| N Bits | y Data Type | y Data Range | Output Format |
|---|---|---|---|
| 8 | uint8 | 0 <= y <= 255 | uint8 |
| 16 | int16 | –32768 <= y <= +32767 | int16 |
| 24 | int32 | –2^23 <= y <= 2^23 – 1 | int32 |
If y contains floating-point data:
| N Bits | y Data Type | y Data Range | Output Format |
|---|---|---|---|
| 8 | single or double | –1.0 <= y < +1.0 | uint8 |
| 16 | single or double | –1.0 <= y < +1.0 | int16 |
| 24 | single or double | –1.0 <= y < +1.0 | int32 |
| 32 | single or double | –1.0 <= y <= +1.0 | single |
For floating point data where N < 32, amplitude values are clipped to the range –1.0 <= y < +1.0.
Note 8-, 16-, and 24-bit files are type 1 integer pulse code modulation (PCM). 32-bit files are written as type 3 normalized floating point. |
auwrite, wavfinfo, wavplay, wavread, wavrecord
![]() | wavrecord | web | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |