Overview
Threshold with hysteresis
Discussion
The hysteresis module implements switching above and below a threshold. The module accepts floating-point inputs and outputs 0 when the signal level is below the threshold and 1 when above. Instead of just a single threshold the module incorporates hysteresis by having separate upper and lower thresholds. The output switches from 0->1 when the input signal rises above the upperThreshold and then stays at 1 until the signal drops below the lowerThreshold. The module is thus above to avoid frequent switching when signal levels are close to the threshold.
...
When bypassed, the module continues to process data normally. That is, the module's processing function is called even when it is bypassed.
Type Definition
Code Block |
---|
typedef struct _ModuleHysteresis { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure FLOAT32 upperThreshold; // Upper switching threshold FLOAT32 lowerThreshold; // Lower switching threshold INT32* state; // Current state per chanel } ModuleHysteresisClass; |
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
upperThreshold | float | parameter | 0 | 1 | Unrestricted | |
lowerThreshold | float | parameter | 0 | -1 | Unrestricted | |
state | int* | state | 0 | [1 x 1] | Unrestricted |
Pins
Input Pins
Name: in
Description: Input signal
...
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: Output signal
Data type: int
MATLAB Usage
File Name: hysteresis_module.m
...