Overview
Checks if the input signal levels are within a specified upper and lower range.
Discussion
This module determines if the input signal falls within a specified range. The range is specified by the instance variables .lower and .upper. An input sample falls within the range if (in[i] >= .lower) && (in[i] <= .upper). The instance variable .withinRange is set to 1 if all of the input samples are within range. If one or more input samples are outside of the allowable range, then .withinRange is set to 0.
Type Definition
Code Block |
---|
typedef struct _ModuleWithinRange { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure FLOAT32 lower; // Lower edge of the allowable range. FLOAT32 upper; // Upper edge of the allowable range. INT32 withinRange; // Equals 1 if all input samples in the block are within range. Otherwise equals 0. INT32 outputValue; // Specifies the behavior of the output pin. } ModuleWithinRangeClass; |
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
lower | float | parameter | 0 | -0.5 | -1:1 | |
upper | float | parameter | 0 | 0.5 | -1:1 | |
withinRange | int | state | 0 | 0 | Unrestricted | |
outputValue | int | const | 0 | 1 | Unrestricted |
Pins
Input Pins
Name: in
Description: audio input
...
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: Boolean
Data type: int
MATLAB Usage
File Name: within_range_module.m
...