DSP Blockset | ![]() ![]() |
Write audio data to file in the Microsoft Wave (.wav
) format (32-bit Windows operating systems only).
Library
Platform-specific I/O / Windows (WIN32)
Description
The To Wave File block writes audio data to a Microsoft Wave (.wav
) file in the uncompressed PCM (pulse code modulation) format. For compatibility reasons, the sample rate of the discrete-time input signal should typically be one of the standard Windows audio device rates (8000, 11025, 22050, or 44100 Hz), although the block supports arbitrary rates.
The input to the block, u, can contain audio data from a mono or stereo signal. A mono signal is represented as either a sample-based scalar or frame-based length-M vector, while a stereo signal is represented as a sample-based length-2 vector or frame-based M-by-2 matrix. The amplitude of the input should be in the range ±1. Values outside this range are clipped to the nearest allowable value.
The Sample Width (bits) parameter specifies the number of bits used to represent the signal samples in the file. Two settings are available:
The higher sample width settings require more memory but yield better fidelity for double- and single-precision inputs.
The File name parameter can specify an absolute or relative path to the file. You do not need to specify the.wav
extension. To reduce the required number of file accesses, the block writes L consecutive samples to the file during each access, where L is specified by the Minimum number of samples for each write to file parameter (L M). For L <M, the block instead writes M consecutive samples during each access. Larger values of L result in fewer file accesses, which reduces run-time overhead.
Dialog Box
Supported Data Types
To learn how to convert data types in MATLAB and Simulink, see Supported Data Types and How to Convert to Them.
See Also
From Wave File |
DSP Blockset |
To Wave Device |
DSP Blockset |
To Workspace |
Simulink |
wavwrite |
MATLAB |
See Exporting and Playing WAV Files for related information. Also see Windows (WIN32) for a list of all the blocks in the Windows (WIN32) library.
![]() | To Wave Device | Transpose | ![]() |