+ and -
Arithmetic addition and subtraction in AUX work across scalars, vectors, audio signals, text, time sequences, and null values.
Syntax
z = x + y
z = x - y
Operands and Result
| x | y | z |
|---|---|---|
NUL | anything | same as the non-null operand |
SCAL | anything | same shape/type as the other operand when supported |
VCT | VCT | VCT |
VCT | AUD | AUD |
TSEQ | array/time-sequence forms | TSEQ when supported |
Allowed types: SCAL, VCT, AUD, TEXT, TSEQ, NUL
Not allowed: CLASS, CELL
Notes
- For
SCAL + VCTandSCAL + AUD, the scalar is applied to the entire array or signal. - For
VCT + VCTandVCT + AUD, the operation proceeds while both operands have values available. - For
AUD + AUD, the operation is time-based and is applied wherever both signals are present. - For
SCAL + TSEQ, the scalar is added to the value of the time sequence at each time point. - For
TSEQ + TSEQ, both operands must have the same number of time points, although the actual times do not need to match. - When both operands are grouped as matrices, they must have the same number of groups (rows).
- Addition is commutative. Subtraction is not.
Examples
AUX> noise(30)@-10 + tone(200,10)@-10 >>50
z =
audio (0.0ms~30.0ms) (50.0ms~60.0ms)
AUX> tone(100,100)@-6 + tone(200,100)@-6 >>50
z =
audio (0.0ms~150.0ms)
Current source basis:
op_plus.html