TriggeredPulseV2
Overview
Generates pulse of pulseDuration, in msec, duration, when the input pin is triggered from 0 to 1.
Discussion
This module generates a rectangular pulse signal with a specified duration in response to an input trigger signal. You specify the pulse duration in milliseconds using the variable pulseDuration. The signal on the input pin triggers the pulse when it is non-zero. This module is "level-triggered" rather than the more typical "edge-triggered" The output signal is 1 while the trigger is 1 and then, once the trigger returns to 0, remains 1 for the pulse duration and 0 otherwise.
If the pulse is retriggered (trigger goes from 0 to 1) while the output is still active, then the process restarts and the output will be high for pulseDuration milliseconds.
Type Definition
typedef struct _ModuleTriggeredPulseV2
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
FLOAT32 pulseDuration; // Width of the output generated pulse.
INT32 pulseDurationSamples; // Width of the output generated pulse in samples.
INT32 counter; // Counts down for each sample while the pulse is active.
} ModuleTriggeredPulseV2Class;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
pulseDuration | float | parameter | 0 | 100 | 0:1000 | msec |
pulseDurationSamples | int | derived | 1 | 4800 | Unrestricted | |
counter | int | state | 1 | 0 | Unrestricted |
Pins
Input Pins
Name: in
Description: Control input signal
Data type: int
Channel range: 1
Block size range: 1
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: Control output signal
Data type: int
MATLAB Usage
File Name: triggered_pulse_v2_module.m
M = triggered_pulse_v2_module(NAME, BLOCKSIZE, SAMPLERATE)
Creates a triggered pulse module for use with the Audio Weaver
environment. The module generates output pulse with the duration
specified by the parameter pulseDuration in msec, when the input pin
is triggered from 0 to 1.
Arguments:
NAME - name of the module.
BLOCKSIZE - number of samples on output channel. By default,
BLOCKSIZE inherits from the input pin.
SAMPLERATE - sample rate of the output signal, in Hz. By default,
SAMPLERATE inherits from the input pin.