Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Scroll Documents: Update page title prefix

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 only negative transitions (positive->negative) are detected.

Type Definition

Code Block
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

...

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

...