This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

addAudioInputChannel

Add audio input channel to session

Syntax

ch = addAudioInputChannel(s,deviceName,channelID)
[ch,idx] = addAudioInputChannel(s,deviceName,channelID)

Description

example

ch = addAudioInputChannel(s,deviceName,channelID) creates and displays the object ch representing a channel added to the session s using the device represented by deviceName, with the specified channelID. The channel object is stored in the variable ch.

Tips

example

[ch,idx] = addAudioInputChannel(s,deviceName,channelID) additionally assigns to idx the index into the array of the session object's Channels property.

Examples

collapse all

s = daq.createSession('directsound');
addAudioInputChannel(s,'Audio1',1);

Add two audio input channels and specify output arguments to represent the channel object and the index.

s = daq.createSession('directsound');
[ch,idx] = addAudioInputChannel(s,'Audio1',1:2);

Input Arguments

collapse all

Data acquisition session specified as a session object created using daq.createSession. Use the data acquisition session for acquisition and generation operations. Create one session per vendor and use that vendor session to perform all data acquisition operations.

Device ID specified as a character vector or string, as defined by the device vendor. Obtain the device ID by calling daq.getDevices. The channel specified for this device is created for the session object.

Data Types: char | string

Channel ID, or the physical location of the channel on the device, added to the session, specified as numeric value. Supported values are specific to the vendor and device. You can also add a range of channels. The index for this channel displayed in the session indicates this channels position in the session. If you add a channel with channel ID 1 as the first channel in a session, the session index is 1.

Output Arguments

collapse all

Audio input channel that you add, returned as a channel object containing vendor specific channel information. Use this channel object to access device and channel properties. The channel object has the following properties.

BitsPerSampleDisplay bits per sample
DeviceChannel device information
IDID of channel in session
MeasurementTypeChannel measurement type
NameSpecify descriptive name for the channel
RangeSpecify channel measurement range
StandardSampleRatesDisplay standard rates of sampling
UseStandardSampleRatesConfigure session to use standard sample rates

Channel index returned as a numeric value. Through the index you can access the array of the session object's Channels property.

Introduced in R2014a