Add Audio Input Channel


  • ch = addAudioInputChannel(s,deviceName,channelID)


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




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 is stored in the variable ch.


[ch,idx] = addAudioInputChannel(s,deviceName,channelID) additionally creates and displays the object idx, which is an index into the array of the session object’s Channels property.


Input Arguments

collapse all

s — Session objectcharacter string

Session object created using daq.createSession specified as a string variable. 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.

deviceName — Device IDcharacter string

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

channelID — Channel IDnumeric value

Channel ID, or the physical location of the channel on the device, added to the session, specified as numeric value. 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

ch — Audio input channel object1xn array

Audio input channel that you add, returned as an object containing a 1xn array of vendor specific channel specific information. Use this channel object to access device and channel properties.

idx — Channel indexnumeric

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


BitsPerSample Display bits per sample
Device Channel device information
ID ID of channel in session
MeasurementType Channel measurement type
Name Specify descriptive name for the channel
Range Specify channel measurement range
StandardSampleRates Display standard rates of sampling
UseStandardSampleRate Configure session to use standard sample rates


collapse all

Add an audio input channel

s = daq.createSession('directsound')

Add multiple audio input channels

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);

Author: iotmaker

I am interested in IoT, robot, figures & leadership. Also, I have spent almost every day of the past 15 years making robots or electronic inventions or computer programs.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s