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

fread_audio (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

Syntax

Y = fread_audio(file)

SIZE = fread_audio(file, 'size')

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

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

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

Legacy Name: auread

Description

Reads audio data from a .au file.

Details

Examples

Inputs

Name Description
file Specifies the filename of the .au file you want to read. You can specify an absolute path or a path relative to the current working directory. If you do not include a file extension, LabVIEW adds a .au extension to the filename. 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 LabVIEW uses to encode the data in file. NBITS is an integer.

Details

If you use this function in a stand-alone application or shared library and file is a relative path, LabVIEW searches for the file in the path where you installed the application or shared library. (Real-Time Module) If you deploy this function to an RT target and file is a relative path, LabVIEW searches for the file in the path returned by the Default Data Directory VI.

The following table lists the support characteristics of this function.

Supported in the LabVIEW Run-Time Engine Yes
Supported on RT targets Yes
Suitable for bounded execution times on RT No (affects entire script)

Examples

Make sure the audio file chirp.au exists in the C:\ directory.

z = fread_audio('C:\chirp');
wavplay(z)
plot(z)

Related Topics

cd
pwd
wavplay
wavread
wavwrite


 

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