Document toolboxDocument toolbox

(8.D.2.7) Debounce

Overview

Debounces signals

Discussion

Debouncer module which limits how often a signal can change. After a signal changes, the module holds the current block for .waitTime milliseconds before allowing it to change again. If a signal is constantly changing then it will only change every .waitTime milliseconds.

The module supports any data type but only 1 channel of data with any blockSize of samples. When a change is detected, the .count variable counts down from .waitCount down to zero before allowing another change.

At the start of processing, the module samples and holds the first input block. It holds this block for .waitTime until finally resampling the input.

Type Definition

typedef struct _ModuleDebounce { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure FLOAT32 waitTime; // Waiting time before switching INT32 count; // Counts down to zero INT32 waitCount; // waitTime as a number of blocks INT32 firstTime; // Indicates first block processed INT32* previousBlock; // Held block } ModuleDebounceClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

waitTime

float

parameter

0

100

0:5000

msec

count

int

state

0

0

Unrestricted

 

waitCount

int

derived

1

149

Unrestricted

 

firstTime

int

state

1

1

Unrestricted

 

previousBlock

float*

state

1

[32 x 1]

Unrestricted

 

Pins

Input Pins

Name: in

Description: audio input

Data type: {float, int, fract32}

Channel range: 1

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: audio output

Data type: {float, int, fract32}

MATLAB Usage

File Name: debounce_module.m

M = debounce_module(NAME) Audio Weaver module which debounces a signal (reduces the frequency of changes). Arguments: NAME - name of the module.

Â