| Signal Processing Blockset™ | ![]() |
Signal Processing Sinks
dspsnks4
The To Wave File block streams audio data to a Microsoft Wave (.wav) file in the uncompressed pulse code modulation (PCM) 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 with one or more channels. A signal with C channels is represented as a sample-based length-C vector or a frame-based M-by-C matrix. The amplitude of the input should be in the range ±1. Values outside this range are clipped to the nearest allowable value.
wavwrite(u,Fs,bits,'filename') % Equivalent MATLAB code

Specify the path and name of the file to write. Paths can be relative or absolute. You do not need to specify the.wav extension.
Specify the number of bits used to represent the signal samples in the file. The higher sample width settings require more memory but yield better fidelity for double- and single-precision inputs:
8 — Allocates 8 bits to each sample, allowing a resolution of 256 levels
16 — Allocates 16 bits to each sample, allowing a resolution of 65536 levels
24 — Allocates 24 bits to each sample, allowing a resolution of 16777216 levels
32 — Allocates 32 bits to each sample, allowing a resolution of 232 levels ranging from -1 to 1
The 8-, 16-, and 24-bit modes output integer data, while the 32-bit mode outputs single-precision floating-point data.
Specify the number of consecutive samples, L,
to write with each file access. To reduce the required number of file
accesses, the block writes L consecutive samples
to the file during each access for
. For
,
the block instead writes M consecutive samples
during each access. Larger values of L result in
fewer file accesses, which reduces run-time overhead.
| Port | Supported Data Types |
|---|---|
Input |
|
| From Wave File | Signal Processing Blockset |
| To Audio Device | Signal Processing Blockset |
| To Workspace | Simulink |
| wavwrite | MATLAB |
![]() | To Wave Device (Obsolete) | Transpose | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |