(8.D.1.2) ImpulseSourceFract32
Overview
Source module which periodically outputs an impulse
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 .period specifies the period of the generation process in samples. .period can be adjusted at run-time. If .period = SAMPLERATE, then the module generates an impulse every second. If .period = 1, then the module outputs a DC constant. If .period = 0, then the module stops output 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
typedef struct _ModuleImpulseSourceFract32
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 period; // Period or rate of the impulse generator
INT32 sampleIndex; // Specifies the index of the next non-zero value
} ModuleImpulseSourceFract32Class;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
period | int | parameter | 0 | 48000 | 0:240000 | samples |
sampleIndex | int | state | 1 | 0 | Unrestricted | Â |
Pins
Output Pins
Name: out
Description: audio output
Data type: fract32
MATLAB Usage
File Name: impulse_source_fract32_module.m
M=impulse_source_fract32_module(NAME, BLOCKSIZE, SAMPLERATE)
Source module which periodically outputs an impulse. An impulse is
a single non-zero sample of value 1. The period can be adjusted at
run-time.
Arguments:
NAME - name of the module.
BLOCKSIZE - number of samples per output channel. By default,
BLOCKSIZE = 32.
SAMPLERATE - sample rate of the output signal, in Hz. By default,
SAMPLERATE = 48000.
Â