Skip to main content
Skip table of contents

ImpulseMsecSource

Overview

Source module which periodically outputs an impulse. Time specified in msec.

Discussion

This module has a single mono output pin and generates a periodic impulse of value 1; all other output samples are set to 0. The variable .periodMsec specifies the period of the generation process in milliseconds and can be adjusted at run-time.

If .periodMsec = 1.0, then the module generates an impulse every second. If .periodMsec = 0, then the module stops outputting values.

As with all source modules, you have to set the blockSize and sampleRate of the output pin. The module is initialized so that it fires immediately; sample 0 of block 0 is set to 1.0f.

Type Definition

CODE
typedef struct _ModuleImpulseMsecSource
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    INT32 periodMsec;                             // Period or rate of the impulse generator (in msec).
    INT32 period;                                 // Period or rate of the impulse generator (in samples).
    INT32 sampleIndex;                            // Specifies the index of the next non-zero value.
} ModuleImpulseMsecSourceClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

periodMsec

int

parameter

0

1000

0:10000

msec

period

int

derived

1

48000

0:240000

samples

sampleIndex

int

state

1

0

Unrestricted

Pins

Output Pins

Name: out

Description: audio output

Data type: float

MATLAB Usage

File Name: impulse_msec_source_module.m

CODE
 M=impulse_msec_source_module(NAME, BLOCKSIZE, SAMPLERATE)
 Source module which periodically outputs an impulse. An impulse is
 a single non-zero sample of value 1. The period is specified in msec
 and can be adjusted at run-time.  Arguments:
    NAME - name of the module.
    BLOCKSIZE - number of samples per output channel. If empty, then the
         blockSize is taken from the system input pin.  By default,
         BLOCKSIZE = [].
    SAMPLERATE - sample rate of the output signal, in Hz.  If empty, then
         the sample rate is taken from the system input pin.  By default,
         SAMPLERATE = [].

JavaScript errors detected

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

If this problem persists, please contact our support.