Data Acquisition Toolbox | ![]() ![]() |
Example: Adding Channels for a Sound Card
Suppose you create the analog input object ai
for a sound card.
Most sound cards have just two hardware channels that you can add. If one channel is added, the sound card is said to be in mono mode. If two channels are added, the sound card is said to be in stereo mode. However, the rules for adding these two channels differ from those of other data acquisition devices. These rules are described below.
Mono Mode
If you add one channel to ai
, the sound card is said to be in mono mode and the channel added must have a hardware ID of 1.
At the software level, mono mode means that data is acquired from channel 1. At the hardware level, you generally cannot determine the actual channel configuration and data can be acquired from channel 1, channel 2, or both depending on your sound card. Channel 1 is automatically assigned the descriptive channel name Mono
.
Stereo Mode
If you add two channels to ai
, the sound card is said to be in stereo mode. You can add two channels using two calls to addchannel
provided channel 1 is added first.
Alternatively, you can use one call to addchannel
provided channel 1 is specified as the first element of the hardware ID vector.
Stereo mode means that data is acquired from both hardware channels. Channel 1 is automatically assigned the descriptive name Left
and channel 2 is automatically assigned the descriptive name Right
.
While in stereo mode, if you want to delete one channel, then that channel must be channel 2. If you try to delete channel 1, an error is returned.
The sound card is now in mono mode.
![]() | Referencing Individual Hardware Channels | Configuring Analog Input Properties | ![]() |