readAiff

Synopsis

Reads in an AIFF file and outputs the data as a short array.

Parameters

The following lists all of the parameters found in the parameter block ReadAiffParams, which are accessed by the functional macro ReadAiff and the UI Macro ReadAiffUI.

Name Type Description UI Control

file_name string name of the AIFF file to be loaded UIfiledialog
Num_Channels int number of channels in AIFF file UItext
Sample_Size int size of each individual sample in bytes UItext
Num_Samples int number of individual samples in AIFF file UItext
Sample_Rate double number of samples per second UItext

Output Port

Name Type Description

out_data short[] output array containing the sampled waveform.

Description

The readAiff macro reads in an uncompressed AIFF file and outputs an array of short values representing the samples that make up the waveform. The amplitude of the samples is represented by a single short value, where 0 is silence, and 32767 and -32768 represent the extensions of the speaker toward and away from the listener. It also sets a number of parameters within the parameter block it references. These describe the format of the sample that it has loaded. This macro is not able to read compressed AIFF audio files and will give an error message if this is tried. The AIFF file to be read can also be chosen through the user interface.

Parameters

file_name

A member of the ReadAiffParams parameter block group, this string value is used to specify the name of the AIFF file that should be loaded. This is the only input parameter to the readAiff function, all the other parameters are set depending upon data in the AIFF file.

Num_Channels

A member of the ReadAiffParams parameter block group, this int value is used to output the number of channels that are present in the AIFF file. This parameter is set by the function and is not used for input.

Sample_Size

A member of the ReadAiffParams parameter block group, this int value is used to output the size of each individual sample in bytes. The readAiff module can only cope with sample sizes of 8 and 16 bytes. This parameter is set by the function and is not used for input.

Num_Samples

A member of the ReadAiffParams parameter block group, this int value is used to output the number of samples that are present in the AIFF file. This parameter is set by the function and is not used for input.

Sample_Rate

A member of the ReadAiffParams parameter block group, this double value is used to output the number of samples per second that were used to record the waveform. This parameter is set by the function and is not used for input.

Output Ports

out_data

The only output of the readAiff macro. This array contains the waveform represented as a series of short values. Each short values contains a single sample of audio data, where 0 is quiet, and 32767 and -32768 represent the extensions of the speaker toward and away from the listener. If the input audio has a sample size of 8 bits then each byte is expanded so that it fills the full range of values.

Utility Macros

The User Macro readAiff combines the Functional Macro ReadAiff with the UI Macro ReadAiffUI, via the use of the common parameter block ReadAiffParams, to provide a easily usable macro.

Example

An example application ReadAiffEg is provided, which displays AIFF files on screen using the AGGraph set of graphing components.

Files

iac_proj/rd_aiff/aiffmacs.v contains the readAiff User Macro, the ReadAiff Functional Macro, the ReadAiffUI UI Macro, and the example application ReadAiffEg V definitions.

Other Notes

The ReadAiffMacs library inherits its process. As this library contains no procedural code, the process is not important. The low-level ReadAiffData module, executes under the process specified in its library, not the process defined in the high-level library.

Authors

Paul G. Lever
Andrew Dodd

Contact

International AVS Centre
Manchester Visualization Centre
Manchester Computing
University of Manchester
Oxford Road
Manchester
United Kingdom
M13 9PL

See Also

ReadAiffParams, ReadAiffUI, ReadAiffEg, ReadAiff and ReadAiffData.