Document toolboxDocument toolbox

(8.D.2.2 ) PeriodicSource

Overview

Continuously outputs a buffer of data

Discussion

This module continuously outputs a stored buffer of data. The module starts with the first sample and continues to the end of the array. Once the end of the array is reached, the module wraps to the beginning of the buffer. Thus, the data values are circularly addressed. The module supports an internal buffer size which can be different from the block size of the module. The module also supports an arbitrary number of output channels.

Type Definition

typedef struct _ModulePeriodicSource { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 L; // Number of (multi-channel) samples in the internal buffer. INT32 numChannels; // Number of channels in the output. This is only needed for the MATLAB simulation. INT32 blockSize; // Output blockSize. This is only needed for the MATLAB simulation. INT32 stateIndex; // Index of the next data sample to output. This circularly wraps. FLOAT32* value; // Output data array. } ModulePeriodicSourceClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

L

int

const

0

32

Unrestricted

 

numChannels

int

const

1

1

Unrestricted

 

blockSize

int

const

1

16

Unrestricted

 

stateIndex

int

state

1

0

Unrestricted

 

value

float*

parameter

0

[32 x 1]

Unrestricted

 

Pins

Output Pins

Name: out

Description: audio output

Data type: float

MATLAB Usage

File Name: periodic_source_module.m

M=periodic_source_module(NAME, L, NUMCHANNELS, BLOCKSIZE, SAMPLERATE) Create a module which generates a periodic signal by repetitively outputing a buffer of data. Arguments: NAME - name of the module. L - length of the repetition which equals the number of samples in the buffer. NUMCHANNELS - number of interleaved channels in each output pin. By default, NUMCHANNELS = 1. BLOCKSIZE - number of samples per output channel. By default, BLOCKSIZE = 32. SAMPLERATE - sample rate of the output signal, in Hz. By default, SAMPLERATE = 48000.

Â