Main Content

Audio Device Reader

Record from sound card

  • Audio Device Reader block

Libraries:
Audio Toolbox / Sources

描述

TheAudio Device Readerblock reads audio samples using your computer's audio device. TheAudio Device Readerblock specifies the driver, the device and its attributes, and the data type and size output from yourAudio Device Readerblock.

Ports

Output

expand all

The output of theAudio Device Readerblock is determined by the block’s parameters. If the block output is a matrix, the columns correspond to independent channels.

Data Types:single|double|int16|int32|uint8

This port outputs the number of samples overrun while acquiring a frame of data (one output matrix).

Dependencies

To enable this port, select theOutput number of samples overrunparameter.

Data Types:uint32

Parameters

expand all

Main Tab
  • ASIO drivers do not come pre-installed on Windows machines. To use theASIOdriver option, install an ASIO driver outside of MATLAB®.

    Note

    IfDriveris set toASIO, open the ASIO UI outside of MATLAB to set the sound card buffer size to the value specified by theSamples per frameparameter. See the documentation of your ASIO driver for more information.

  • WASAPI drivers are supported for exclusive-mode only.

ASIO and WASAPI drivers do not provide sample rate conversion. For ASIO and WASAPI drivers, setSample rate (Hz)to a sample rate supported by your audio device.

This parameter applies only on Windows machines. Linux machines always use the ALSA driver. Mac machines always use the CoreAudio driver.

The device list is populated with devices available on your computer.

This button opens a dialog box that lists your selected audio driver, the full name of your audio device, and the maximum input channels for your configuration. For example:

The possible range ofSample rate (Hz)depends on your audio hardware.

The number of input channels is also the number of channels (matrix columns) output by theAudio Device Readerblock.

Dependencies

指定输入通道音频设备acquires, on theAdvancedtab, select theUse default channel mappingparameter.

Samples per frameis also the device buffer size, and the frame size (number of matrix rows) output by theAudio Device Readerblock.

Advanced Tab

Data type used by device to acquire audio data, specified as a character vector or string.

When you select this parameter, the block uses the default mapping between the sound card’s input channels and the matrix columns output by this block. When you clear this parameter, you specify the mapping inDevice input channels.

Nondefault map of device channels and matrix output by theAudio Device Readerblock, specified as a scalar or vector. For example:

IfDevice input channelsis specified as1:3, then:

  • Channel 1 maps to the first column of the output matrix.

  • Channel 2 maps to the second column of the output matrix.

  • Channel 3 maps to the third column of the output matrix.

IfDevice input channelsis specified as[3,1,2], then:

  • Channel 3 maps to the first column of the output matrix.

  • Channel 1 maps to the second column of the output matrix.

  • Channel 2 maps to the third column of the output matrix.

Dependencies

To specify a nondefault mapping, clear theUse default mapping between sound card’s input channels and columns of output of this blockparameter.

When you select this parameter, an additional output port,O, is added to the block. TheOport outputs the number of samples overrun while acquiring a frame of data (one output matrix).

Data type of the output.

Note

If this parameter is specified asdoubleorsingle, the block outputs data in the range [–1, 1]. For other data types, the range is [min, max] of the specified data type.

Block Characteristics

Data Types

double|integera|single

Direct Feedthrough

no

Multidimensional Signals

no

Variable-Size Signals

no

Zero-Crossing Detection

no

aSupports 16- and 32-bit signed and 8-bit unsigned integers.

Extended Capabilities

Version History

Introduced in R2016a