To Wave File - Write audio data to file in Microsoft Wave (.wav) format

Library

Signal Processing Sinks

dspsnks4

Description

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

Dialog Box

File name

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.

Sample width (bits)

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:

The 8-, 16-, and 24-bit modes output integer data, while the 32-bit mode outputs single-precision floating-point data.

Minimum number of samples for each write to file

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.

Supported Data Types

PortSupported Data Types

Input

  • Double-precision floating point

  • Single-precision floating point

  • Signed fixed point with a word length of 16 and a fraction length of 15

  • 16-bit signed integers

  • 8-bit unsigned integers

See Also

From Wave FileSignal Processing Blockset
To Audio DeviceSignal Processing Blockset
To WorkspaceSimulink
wavwriteMATLAB

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS