Document toolboxDocument toolbox

(8.D.2.7) ZeroCrossingDetectorFract32

Overview

Zero crossing detector

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

typedef struct _ModuleZeroCrossingDetectorFract32 { 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. } ModuleZeroCrossingDetectorFract32Class;

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: fract32

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: audio output

Data type: fract32

MATLAB Usage

File Name: zero_cross_detector_fract32_module.m

M=zero_cross_detector_fract32_module(NAME) Creates a zero crossing detector module for use in the Audio Weaver. 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. The .detectorType field of the instance structure 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.

Â