Data AcQuisition And Real-Time Analysis
Scope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
The following is from the Daqarta Help system:



Spectrum Analyzer

Signal Generator

(Absolutely FREE!)


Pitch Tracker


DaqMusiq Generator
(Free Music... Forever!)

Engine Simulator

LCR Meter

Remote Operation

DC Measurements

True RMS Voltmeter

Sound Level Meter

Frequency Counter
    Spectral Event

    MHz Frequencies

Data Logger

Waveform Averager


Post-Stimulus Time
Histogram (PSTH)

THD Meter

IMD Meter

Precision Phase Meter

Pulse Meter

Macro System

Multi-Trace Arrays

Trigger Controls


Spectral Peak Track

Spectrum Limit Testing

Direct-to-Disk Recording



Frequency response

Distortion measurement

Speech and music

Microphone calibration

Loudspeaker test

Auditory phenomena

Musical instrument tuning

Animal sound

Evoked potentials

Rotating machinery


Product test

Contact us about
your application!

Channel Select Macro

Macro: Ch

Certain macro functions require that a channel number be specified. Data Point Functions (Wv(), Sp(), and Av()) allow the channel to be specified as an explicit parameter preceding the index parameter, or it may be optionally set ahead of time with the Ch command so that only an index parameter is specified by the function.

Sigma (Summation) Functions (wSig(), BwSig(), sSig(), and BsSig()) must always have the channel set ahead of time; these functions take two index parameters only.

Wv(), Sp(), Av(), wSig(), and sSig() require that the Ch value be in the range of 0-3:

  • 0 = Left In
  • 1 = Right In
  • 2 = Left Out
  • 3 = Right Out

Buffer sigma functions BwSig() and BsSig() use the Ch value to select macro arrays Buf0 to Buf7.

Commands that allow specific channel selection via two-letter prefixes LI., RI., LO., or RO. can alternatively use the Ch. prefix to allow programmable control. Examples are Ch.Disp=1 to set a display channel, Ch.Curve0=1 to apply a Spectrum Curve, or Ch.TiltdB=3.01 to set dB/Octave for a Spectrum Tilt.

You can use Ch to select the Stream of the Generator that a macro command will apply to. For example, instead of the specific L.0.ToneFreq=F, you can use Ch.ToneFreq=F. That allows a WHILE loop to set multiple streams by stepping through Ch values. In this use, the streams are numbered 0-7:

    0  =  L.0.   Left Stream 0
    1  =  L.1.   Left Stream 1
    2  =  L.2.   Left Stream 2
    3  =  L.3.   Left Stream 3
    4  =  R.0.   Right Stream 0
    5  =  R.1.   Right Stream 1
    6  =  R.2.   Right Stream 2
    7  =  R.3.   Right Stream 3

Note that there is only one global Ch value, which must be shared by the above functions. See Multitasking Variable Usage under Multitasking Macros for methods to allow different tasks to use different Ch values.

You can read Ch just like any other variable to get the value that has been previously set.

For input and output channels (but not buffer numbers), you can also query Ch to see if a particular channel is active. For example, Ch?2 returns 1 (True) if channel 2 (Left Out) is active, or 0 (False) if not. You might want to do this to limit your use of data point or sigma functions to active channels only. (Applying one of these functions to an inactive channel returns 0, which could be confused with valid data.)

Queries only apply to input and output channels, not buffer numbers. Ch?4 to Ch?7 always return 0.

Alternatively, instead of a Ch?N query, you can use the chan() function (see Channel Status Function under Macro Math Functions), which allows you to use a variable or expression to specify the channel to be validated. This simplifies a Custom Control to select the channel to be set (say, for a Custom Meter).

A string expression can use the Channel Name format option (c) or (C) to specify that any variable in the 0-3 range be shown as a channel name instead of as a value. For example, if Ch has been set to 1, then Mtr0=Ch(c) would be displayed as "Right In", while Mtr0=Ch(C) would show the short form "R.I.".

You may also use a special query to determine the lowest visible channel number (active, and selected via its Display Channel button at the lower left of the display area). Ch?c returns the lowest of any (input or output) channel 0-3, Ch?i returns the lowest input 0-1, and Ch?o returns the lowest output 2-3. These queries allow a macro to specify a channel to use, without hard-coding a specific number. In operation, the channel can be changed just by toggling the relevant Display Channels.

See also Macro Overview


Questions? Comments? Contact us!

We respond to ALL inquiries, typically within 24 hrs.
Over 30 Years of Innovative Instrumentation
© Copyright 2007 - 2017 by Interstellar Research
All rights reserved