Skip to main content
Skip table of contents

WaveIndexVector

Overview

Common index vector for looping wave player

Discussion

This module computes the common sample index vector based on the greatest common divisor of all wave files.

The input to the module can be either .fRatio or .RPM dependent on the useRPM argument.

The argument MAXRATE specifies the maximum playback rate in the units of playbackRatio or RPM. MAXRATE is used to determine the extension size of the circular index array. The module internally clips the value at to lie within the range [0 MAXRATE]. That is, if you exceed MAXRATE then the sound no longer increases in frequency (and you will not have buffer overrun artifacts). The module computes the sample-by-sample stride internally based on gcd(NUMWAVPLAYER), .rpm and the sample rate.

Type Definition

CODE
typedef struct _ModuleWaveIndexVector
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    INT32 smoothingTime;                          // Time constant of the pitch smoothing process
    INT32 smoothingFactor;                        // Update rate for smoothing coeffs (per block)
    INT32 maxIndex;                               // Usually length of the WAV file in samples
    INT32 numWavPlayer;                           // Size of base rate array
    FLOAT32 currentFStep;                         // Current (smoothed) rate
    FLOAT32 currentIndex;                         // Current vector index
    FLOAT32 maxRate;                              // Max rate or number of rotations in units of RPM
    FLOAT32 scaleFactor;                          // Inverse of the wave file rpm
    FLOAT32 smoothingCoeff;                       // Smoothing (pitch) coefficient
    INT32 vectorLength;                           // Length of the index table
    INT32* normRate;                              // Array of normalized playback rate / number of rotations of each wave player.
} ModuleWaveIndexVectorClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

smoothingTime

int

parameter

0

10

0:1000

msec

smoothingFactor

int

parameter

0

4

1:512

maxIndex

int

const

0

48000

Unrestricted

numWavPlayer

int

const

0

2

Unrestricted

currentFStep

float

state

0

1

Unrestricted

currentIndex

float

state

0

0

Unrestricted

maxRate

float

const

1

1

Unrestricted

scaleFactor

float

const

1

0.01667

Unrestricted

smoothingCoeff

float

derived

1

0.1248

Unrestricted

vectorLength

int

derived

1

48000

Unrestricted

normRate

int*

parameter

0

[2 x 1]

Unrestricted

Pins

Input Pins

Name: ratio

Description: Specifies the playback speed

Data type: float

Channel range: 1

Block size range: 1

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: index

Description: Sample index vector

Data type: float

MATLAB Usage

File Name: wave_index_vector_module.m

JavaScript errors detected

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

If this problem persists, please contact our support.