Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

wavread (MathScript RT Module Function)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info
Download Help (Windows Only)

Owning Class: audio

Requires: MathScript RT Module (Windows)

Syntax

Y = wavread(file)

SIZE = wavread(file, 'size')

[Y, fs, NBITS] = wavread(file)

[Y, fs, NBITS] = wavread(file, n)

[Y, fs, NBITS] = wavread(file, [n1 n2])

Description

Reads a Microsoft .wav file.

Details

Examples

Inputs

Name Description
file Specifies the filename of the .wav file you want to read. You can use an absolute path or a path relative to the current working directory. LabVIEW adds a .wav extension to the filename if you do not provide the extension. file is a string.
'size' Directs LabVIEW to return the size of the audio data in file.
n Directs LabVIEW to return only the first n samples from each channel in file.
n1 Specifies the first sample in the range of samples that LabVIEW returns from each channel in file.
n2 Specifies the last sample in the range of samples that LabVIEW returns from each channel in file.

Outputs

Name Description
Y Returns the sampled data with amplitude values in the range [-1, 1]. Each column of Y represents one channel. Y is a real matrix.
SIZE Returns the size of the audio data in file. The first element in SIZE is the number of samples in file. The second element in SIZE is the number of channels in file. SIZE is a two-element vector of integers.
fs Returns the sampling rate in Hz. fs is a real number.
NBITS Returns the number of bits per sample used to encode the data in file. NBITS is an integer.

Details

The file path that you specify can be relative to the working directory. Changes you make to the working directory using the cd function apply only to the current instance of the LabVIEW MathScript Window or the MathScript Node from which you call the function. Changes to the working directory for one MathScript Node do not apply to any other MathScript Nodes. LabVIEW resets the working directory to the default when you close the LabVIEW MathScript Window or when the MathScript Node stops executing. Use the MathScript: Search Paths page of the LabVIEW MathScript Properties dialog box to change the default working directory for the LabVIEW MathScript Window. Use the MathScript page of the Options dialog box to change the default working directory for MathScript Nodes in the main application instance.

The following table lists the support characteristics of this function.

Supported in the LabVIEW Run-Time Engine Yes
Supported on RT targets No

Examples

t = 0:0.01:10*pi;
z = sin(50*t.^2);
wavplay(z')
wavwrite(z, 'C:\chirp');
clear z;
pause(2);
z = wavread('C:\chirp');
wavplay(z)
plot(t, z)

Related Topics

cd
pwd
wavplay
wavwrite


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit