SquareAdd
Overview
Squares all inputs and then sums them together
Discussion
Squares all input channels, and sums them together. The ONECHANNELOUTPUT parameter allows the user to select between a multichannel output (for multichannel input pins), or a mono output. If ONECHANNELOUTPUT=1, then all of the signals are summed to form a mono output channel. If ONECHANNELOUTPUT=0, all input pins must have the same number of channels, and the ith channel for each input pin is summed together, resulting in a multichannel output.
Module Pack
Standard
ClassID
classID = 65
Type Definition
typedef struct _ModuleSquareAdd
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 oneChannelOutput; // Boolean value to determine if multichannel output or mono output.
} ModuleSquareAddClass;
Variables
Properties
| Name | Type | Usage | isHidden | Default Value | Range | Units |
|---|---|---|---|---|---|---|
| oneChannelOutput | int | const | 0 | 1 | 0:1:1 |
Pins
Input Pins
| Name | in1 |
| Description | Input signal |
| Data type | float |
| Channel range | Unrestricted |
| Block size range | Unrestricted |
| Sample rate range | Unrestricted |
| Complex support | Real |
| Name | in2 |
| Description | Input signal |
| Data type | float |
| Channel range | Unrestricted |
| Block size range | Unrestricted |
| Sample rate range | Unrestricted |
| Complex support | Real |
Output Pins
| Name | out |
| Description | Output signal |
| Data Type | float |
Matlab Usage
File Name: square_add_module.m
M=square_add_module(NAME, NUMIN, ONECHANNELOUTPUT)
Creates a square add module which squares all input channels and sums
them together.
Arguments:
NAME - name of the module.
NUMIN - number of input pins.
ONECHANNELOUTPUT - Boolean value to determine if multichannel output
or mono output. If ONECHANNELOUTPUT=1, then all of the signals
are summed to form a mono output channel. If ONECHANNELOUTPUT=0,
then all of the inputs pins must have the same number of
channels, and the ith channel for each input pin is summed
together. The resulting output pin has the same number of
channels as each of the inputs.
Copyright (c) 2026 DSP Concepts, Inc.