Sound File Read VI

Owning Palette: Sound Files VIs

Requires: Base Development System

Reads data from a .wav file into an array of waveforms. You must manually select the polymorphic instance you want to use.

(Windows) You must have DirectX 8.0 or later to use this VI. (Linux) You must have the Open Sound System (OSS) driver to use this VI.

Note  This VI retrieves only uncompressed wave files. LabVIEW uses large amounts of memory when reading an entire wave file at once. Instead, read wave files in chunks.

Example

Use the pull-down menu to select an instance of this VI.

 Add to the block diagram  Find on the palette

Sound File Read (DBL)

number of samples/ch specifies the number of samples per channel to read from the file. -1 specifies all samples.
sound file refnum is the reference to the sound file. You generate sound file refnum with the Sound File Open VI.
position mode, together with position offset, specifies where the read operation begins. Absolute starts the operation at the beginning of the file plus position offset, so the offset is relative to the beginning of the file. Relative starts the operation at the current location of the file mark plus position offset. The default is Relative.
position offset specifies how far from the location specified by position mode to start reading. You express position offset in units of samples. The default is 0.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
sound file refnum out is the reference to the sound file originally passed in the sound file refnum parameter.
data reads any sound data from the file. For multi-channel sound data, data is an array of waveforms where each element of the array is a single channel.
t0 is the start time for the first sample read. LabVIEW calculates the initial start time using the benchmark time of 12:00 a.m., Friday, January 1, 1904, Universal Time [01-01-1904 00:00:00]. Subsequent reads are offset by

BM + (samples * dt)

where BM is the benchmark, samples is the number of samples already acquired, and dt is the sampling interval.
dt is the sampling interval of the wave file data.
Y is the sound data. If the array data type is a floating-point numeric, Y ranges from -1.0 to 1.0.

The specified data type determines the range of values for the sound data.
offset indicates the new location of the file mark relative to the beginning of the file, in units of samples. The default is 0.
error out contains error information. This output provides standard error out functionality.
end of file? returns TRUE when the VI reaches the end of the file.

Sound File Read (SGL)

number of samples/ch specifies the number of samples per channel to read from the file. -1 specifies all samples.
sound file refnum is the reference to the sound file. You generate sound file refnum with the Sound File Open VI.
position mode, together with position offset, specifies where the read operation begins. Absolute starts the operation at the beginning of the file plus position offset, so the offset is relative to the beginning of the file. Relative starts the operation at the current location of the file mark plus position offset. The default is Relative.
position offset specifies how far from the location specified by position mode to start reading. You express position offset in units of samples. The default is 0.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
sound file refnum out is the reference to the sound file originally passed in the sound file refnum parameter.
data reads any sound data from the file. For multi-channel sound data, data is an array of waveforms where each element of the array is a single channel.
t0 is the start time for the first sample read. LabVIEW calculates the initial start time using the benchmark time of 12:00 a.m., Friday, January 1, 1904, Universal Time [01-01-1904 00:00:00]. Subsequent reads are offset by

BM + (samples * dt)

where BM is the benchmark, samples is the number of samples already acquired, and dt is the sampling interval.
dt is the sampling interval of the wave file data.
Y is the sound data.
offset indicates the new location of the file mark relative to the beginning of the file, in units of samples. The default is 0.
error out contains error information. This output provides standard error out functionality.
end of file? returns TRUE when the VI reaches the end of the file.

Sound File Read (U8)

number of samples/ch specifies the number of samples per channel to read from the file. -1 specifies all samples.
sound file refnum is the reference to the sound file. You generate sound file refnum with the Sound File Open VI.
position mode, together with position offset, specifies where the read operation begins. Absolute starts the operation at the beginning of the file plus position offset, so the offset is relative to the beginning of the file. Relative starts the operation at the current location of the file mark plus position offset. The default is Relative.
position offset specifies how far from the location specified by position mode to start reading. You express position offset in units of samples. The default is 0.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
sound file refnum out is the reference to the sound file originally passed in the sound file refnum parameter.
data reads any sound data from the file. For multi-channel sound data, data is an array of waveforms where each element of the array is a single channel.
t0 is the start time for the first sample read. LabVIEW calculates the initial start time using the benchmark time of 12:00 a.m., Friday, January 1, 1904, Universal Time [01-01-1904 00:00:00]. Subsequent reads are offset by

BM + (samples * dt)

where BM is the benchmark, samples is the number of samples already acquired, and dt is the sampling interval.
dt is the sampling interval of the wave file data.
Y is the sound data. If the array data type is an 8-bit unsigned integer, Y ranges from 0 to 255.

The specified data type determines the range of values for the sound data.
offset indicates the new location of the file mark relative to the beginning of the file, in units of samples. The default is 0.
error out contains error information. This output provides standard error out functionality.
end of file? returns TRUE when the VI reaches the end of the file.

Sound File Read (I16)

number of samples/ch specifies the number of samples per channel to read from the file. -1 specifies all samples.
sound file refnum is the reference to the sound file. You generate sound file refnum with the Sound File Open VI.
position mode, together with position offset, specifies where the read operation begins. Absolute starts the operation at the beginning of the file plus position offset, so the offset is relative to the beginning of the file. Relative starts the operation at the current location of the file mark plus position offset. The default is Relative.
position offset specifies how far from the location specified by position mode to start reading. You express position offset in units of samples. The default is 0.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
sound file refnum out is the reference to the sound file originally passed in the sound file refnum parameter.
data reads any sound data from the file. For multi-channel sound data, data is an array of waveforms where each element of the array is a single channel.
t0 is the start time for the first sample read. LabVIEW calculates the initial start time using the benchmark time of 12:00 a.m., Friday, January 1, 1904, Universal Time [01-01-1904 00:00:00]. Subsequent reads are offset by

BM + (samples * dt)

where BM is the benchmark, samples is the number of samples already acquired, and dt is the sampling interval.
dt is the sampling interval of the wave file data.
Y is the sound data. If the array data type is a 16-bit signed integer, Y ranges from -32768 to 32767.

The specified data type determines the range of values for the sound data.
offset indicates the new location of the file mark relative to the beginning of the file, in units of samples. The default is 0.
error out contains error information. This output provides standard error out functionality.
end of file? returns TRUE when the VI reaches the end of the file.

Sound File Read (I32)

number of samples/ch specifies the number of samples per channel to read from the file. -1 specifies all samples.
sound file refnum is the reference to the sound file. You generate sound file refnum with the Sound File Open VI.
position mode, together with position offset, specifies where the read operation begins. Absolute starts the operation at the beginning of the file plus position offset, so the offset is relative to the beginning of the file. Relative starts the operation at the current location of the file mark plus position offset. The default is Relative.
position offset specifies how far from the location specified by position mode to start reading. You express position offset in units of samples. The default is 0.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
sound file refnum out is the reference to the sound file originally passed in the sound file refnum parameter.
data reads any sound data from the file. For multi-channel sound data, data is an array of waveforms where each element of the array is a single channel.
t0 is the start time for the first sample read. LabVIEW calculates the initial start time using the benchmark time of 12:00 a.m., Friday, January 1, 1904, Universal Time [01-01-1904 00:00:00]. Subsequent reads are offset by

BM + (samples * dt)

where BM is the benchmark, samples is the number of samples already acquired, and dt is the sampling interval.
dt is the sampling interval of the wave file data.
Y is the sound data. If the array data type is a 32-bit signed integer, Y ranges from -2147483648 to 2147483647.

The specified data type determines the range of values for the sound data.
offset indicates the new location of the file mark relative to the beginning of the file, in units of samples. The default is 0.
error out contains error information. This output provides standard error out functionality.
end of file? returns TRUE when the VI reaches the end of the file.

Example

Refer to the Sound File to Sound Output VI in the labview\examples\Graphics and Sound\Sound directory for an example of using the Sound File Read VI.

 Open example  Find related examples