Skip to main content
Skip table of contents

ZeroCrossingDetector

Overview

Detects when a signal crosses zero and changes sign

Discussion

Multichannel zero-crossing detector, running at the sampling rate. The module outputs a 1.0 whenever a zero crossing is detected and 0.0 otherwise. The detectorType parameter controls the behavior of the detector.

If detectorType = 0, then all zero crossing are detected.

If detectorType > 0, then only positive transitions (negative->positive) are detected.

If detectorType < 0, then only negative transitions (positive->negative) are detected.

Type Definition

CODE
typedef struct _ModuleZeroCrossingDetector
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    INT32 detectorType;                           // Determines which zero crossings are detected: 0=all, >0 negative->positive, <0 positive->negative.
    INT32* lastSign;                              // Holds the sign of the last input value. This is an array so that multiple channels can be supported.
} ModuleZeroCrossingDetectorClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

detectorType

int

parameter

0

0

-1:1

lastSign

int*

state

1

[1 x 1]

Unrestricted

Pins

Input Pins

Name: in

Description: audio input

Data type: float

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: audio output

Data type: float

MATLAB Usage

File Name: zero_cross_detector_module.m

CODE
 M=zero_cross_detector_module(NAME)
 Creates a zero crossing detector module for use in the Audio Weaver
 environment. The module has a single multichannel input pin and a single
 output pin of the same size as the input pin. The module outputs a 1.0
 whenever a zero crossing is detected and 0.0 otherwise.
 
 Arguments:
    NAME - name of the module.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.