LogicAny
Overview
Check if the input block has any non-zero values
Discussion
This module checks if any samples in the input block are non-zero. If there are non-zero values, then the instance variable .result is set to 1. Otherwise, if all input samples are zero, then .result is set to 0.
By default, the module has no output pin and the result of the computation is only stored to the internal instance variable. If the optional second input argument, OUTPUTVALUE, is set to 1, then the module has an output pin with dimension 1 channel and 1 sample. The output pin is updated on a block-by-block basis and contains .result.
When the module is bypassed, the output is set to 1.
Module Pack
Standard
ClassID
classID = 36
Type Definition
typedef struct _ModuleLogicAny
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 result; // Equals 0 if all input values in the block are 0. Otherwise equals 1.
} ModuleLogicAnyClass;
Variables
Properties
| Name | Type | Usage | isHidden | Default Value | Range | Units |
|---|---|---|---|---|---|---|
| result | int | state | 0 | 0 | 0:1 |
Pins
Input Pins
| Name | in |
| Description | Integer inputs |
| Data type | {int, fract32} |
| Channel range | Unrestricted |
| Block size range | Unrestricted |
| Sample rate range | Unrestricted |
| Complex support | Real |
Output Pins
| Name | out |
| Description | Contains the instance variable .result |
| Data Type | int |
Matlab Usage
File Name: logic_any_module.m
M=logic_any_module(NAME, OUTPUTVALUE)
Audio Weaver module that checks if any input samples within a block
are non-zero. The module is similar to the MATLAB any() function.
The module sets the internal Boolean variable .result. Arguments:
NAME - name of the module.
OUTPUTVALUE - specifies whether the module has an output pin.
By default, OUTPUTVALUE=0 and the result of the
computation is only stored to the instance variable
.result. If OUTPUTVALUE=1, then the module has
an output pin with numChannels = 1 and blockSize = 1
containing .result.
Copyright (c) 2026 DSP Concepts, Inc.