Wavread Function

Embed Size (px)

Citation preview

  • 7/26/2019 Wavread Function

    1/2

    ead :: Functions (MATLAB) jar:file:///C:/Program%20Files/MATLAB/R2011a/help/techdoc/h

    9/29/2014

    wavreadRead WAVE (.wav) sound file

    Alternatives

    As an alternative to wavread, use the Import Wizard. To activate the Import Wizard, select File> Import Data.

    Syntax

    y= wavread(filename)[y, Fs] = wavread(filename)

    [y, Fs, nbits] = wavread(filename)

    [y, Fs, nbits, opts] = wavread(filename)

    [...] = wavread(filename, N)

    [...] = wavread(filename, [N1N2])

    [...] = wavread(..., fmt)

    siz= wavread(filename,'size')

    Description

    y= wavread(filename)loads a WAVE file specified by the string filename, returning the sampled data in y. Iffilenamedoes not include an extension, wavreadappends .wav.

    [y, Fs] = wavread(filename)returns the sample rate (Fs) in Hertz used to encode the data in the file.

    [y, Fs, nbits] = wavread(filename)returns the number of bits per sample (nbits).

    [y, Fs, nbits, opts] = wavread(filename)returns a structure optsof additional information contained in theWAV file. The content of this structure differs from file to file. Typical structure fields include opts.fmt(audio formatinformation) and opts.info(text that describes the title, author, etc.).

    [...] = wavread(filename, N)returns only the first Nsamples from each channel in the file.

    [...] = wavread(filename, [N1N2])returns only samples N1through N2from each channel in the f ile.

    [...] = wavread(..., fmt)specifies the data format of yused to represent samples read from the file. fmtcan beeither of the following values, or a partial match (case-insensitive):

    'double' Double-precision normalized samples (default).

    'native' Samples in the native data type found in the file.

    siz= wavread(filename,'size')returns the size of the audio data contained in filenameinstead of the actualaudio data, returning the vector siz= [sampleschannels].

    Output Scaling

    The range of values in ydepends on the data format fmtspecified. Some examples of output scaling based on typicalbit-widths found in a WAV file are given below for both 'double'and 'native'formats.

    Native Formats

    Number of Bits MATLAB Data Type Data Range

    8 uint8(unsigned integer) 0

  • 7/26/2019 Wavread Function

    2/2

    ead :: Functions (MATLAB) jar:file:///C:/Program%20Files/MATLAB/R2011a/help/techdoc/h

    9/29/2014

    Double Formats

    Number of Bits MATLAB Data Type Data Range

    N