Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Scroll Documents: Update page title prefix

Overview

Periodic one shot WAV playback with linear interpolation

Discussion

This module outputs blocks of audio data by interpolating from the upstream wave data. The input pin .ptr is a pointer to the upstream wave data module, which is periodic_streaming_module. Input pin .trigger is a boolean to initiate playback. When it goes from 1->0 then the module starts generating output audio by interpolating the wave data. The input pin .fRatio controls the playback speed as a decimal ratio, where 1.0 is the default speed, increasing above 1.0 speeds up the playback speed, and decreasing below 1.0 slows down the playback speed. Any negative fRatio value will be replaced with a zero internally. This module assumes the wave data from upstream module is a float data type.

Type Definition

Code Block
typedef struct _ModuleWAVInterpOneShotSource
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    FLOAT32 smoothingTime;                        // Time constant of the smoothing process
    INT32 circularBufferSize;                     // Size of the upstream circular buffer.
    INT32 extensionSize;                          // Size of the extension region of the circular buffer
    FLOAT32 currentFRatio;                        // Specifies rate at which audio is read from the input buffer
    FLOAT32 smoothingCoeff;                       // Smoothing coefficient
    FLOAT32 fIndex;                               // state index
    INT32 psObjectID;                             // Object ID of the upstream PeriodicStreaming module
    ModuleInstanceDescriptor ** psObjectPtr;      // Points to the upstream PeriodicStreaming module
} ModuleWAVInterpOneShotSourceClass;

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

float

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

...

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: output data

Data type: float

MATLAB Usage

File Name: wav_interp_oneshot_source_module.m

...