Document toolboxDocument toolbox

(8.D.2.1) PulseGen

Overview

Generates a periodic rectangular pulse

Discussion

This module generates a periodic rectangular pulse. The overall period of the pulse, in msec, is specified by the variable period. The pulse starts at a value of 1.0 and stays on for onTime msec.

You can enable and disable the pulse generate by setting the isOn variable. When turned off, the pulse generator completes the last period of the wave form.

Type Definition

typedef struct _ModulePulseGen { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure FLOAT32 period; // Total period of the pulse. FLOAT32 onTime; // Duration of the positive portion of the pulse. INT32 isOn; // Boolean that turns the beeping on or off. INT32 periodSamples; // Total period of the pulse in samples. INT32 onTimeSamples; // Duration of the positive period of the pulse in samples. INT32 count; // Sample counter that increments for each value output. } ModulePulseGenClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

period

float

parameter

0

500

0:1000

msec

onTime

float

parameter

0

100

0:1000

msec

isOn

int

parameter

0

1

0:1

 

periodSamples

int

derived

1

24000

Unrestricted

 

onTimeSamples

int

derived

1

4800

Unrestricted

 

count

int

state

1

0

Unrestricted

 

Pins

Output Pins

Name: out

Description: output data

Data type: float

MATLAB Usage

File Name: pulse_gen_module.m

M=pulse_gen_module(NAME, BLOCKSIZE, SAMPLERATE) This module creates a period rectangular pulse with amplitude 0.0 and 1.0. Arguments: NAME - name of the module. BLOCKSIZE - number of samples per 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.

Â