Document toolboxDocument toolbox

(8.D.2.1) WAVInterp16OneShotSourceFract32

Overview

Periodic one shot WAV playback with linear interpolation

Type Definition

typedef struct _ModuleWAVInterp16OneShotSourceFract32 { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure FLOAT32 smoothingTime; // Time constant of the smoothing process INT32 circularBufferSize; // Size of the upstream circular buffer, in 16-bit words. INT32 extensionSize; // Size of the extension region of the circular buffer, in 16-bit words FLOAT32 currentFRatio; // Specifies rate at which audio is read from the input buffer FLOAT32 smoothingCoeff; // Smoothing coefficient INT32 fIndex; // 32-bit fractional state index INT32 psObjectID; // Object ID of the upstream PeriodicStreaming module ModuleInstanceDescriptor ** psObjectPtr; // Points to the upstream PeriodicStreaming module } ModuleWAVInterp16OneShotSourceFract32Class;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

smoothingTime

float

parameter

0

10

0:1000

msec

circularBufferSize

int

const

0

0

Unrestricted

 

extensionSize

int

parameter

0

0

Unrestricted

 

currentFRatio

float

parameter

1

1

Unrestricted

 

smoothingCoeff

float

derived

1

0.03278

Unrestricted

 

fIndex

int

state

1

0

Unrestricted

 

psObjectID

int

state

1

-1

Unrestricted

 

psObjectPtr

ModuleInstanceDescriptor **

state

1

 

Unrestricted

 

Pins

Input Pins

Name: ptr

Description: Pointer to the streaming transfer object

Data type: int

Channel range: 1

Block size range: 1

Sample rate range: Unrestricted

Complex support: Real

 

Name: trigger

Description: Boolean trigger signal

Data type: int

Channel range: 1

Block size range: 1

Sample rate range: Unrestricted

Complex support: Real

 

Name: fRatio

Description: Specifies sample rate ratio

Data type: float

Channel range: 1

Block size range: 1

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: output data

Data type: fract32

MATLAB Usage

File Name: wav_interp16_oneshot_source_fract32_module.m

M=wav_interp16_oneshot_source_fract32_module(NAME, NUMCHANNELS, BLOCKSIZE, SAMPLERATE) Creates a source module that connects to a streaming buffer module and outputs blocks of data. The function includes linear interpolation allowing playback to be slowed down and speeded up. This version uses 16-bit WAV data and a 32-bit fIndex register for efficient implementation. This version is a "one shot player" in which the playback is triggered by an input pin and then stops after the WAV data has been played once. Arguments: NAME - name of the module. 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.

Â