Overview
WAV playback using index vector as pitch factor input
Discussion
This module outputs wave data in loop mode and takes an input stream or vector as sample index input. User has to specify the file name as an argument. Along with the above parameters, the playback functionality can be enabled from the control input pin, 1 - Enable and 0 - Disable.
The module supports multichannel such that, if the wave file has more channels than provided to the module argument then only channels up to output pin channels will be used. If the wave file has less channels than output pin channels, then the remaining output channels will be muted.
Type Definition
typedef struct _ModuleWaveIndexPlayerRAM { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 enable; // En/Disable playback INT32 interpMode; // Linear or cubic interpolation FLOAT32 normRate; // Rate of data used to compute the ratio for normalized players INT32 waveLength; // Number of samples in currently loaded file FLOAT32 formatF; // Integer value of left-shift by NCOFracBits. Determines the precision of the linear interpolation. INT32 waveSR; // Actual sample rate of the wave file. INT32 waveNumChannels; // Number of channels in the wave file. FLOAT32 scaleFactor; // Scale factor for playback rate UINT32 pinID; // Specifies which control pins are available. INT32* waveBuffer; // Data transferred from PC to target DSP via this buffer. } ModuleWaveIndexPlayerRAMClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
enable | int | state | 0 | 1 | 0:1 | |
interpMode | int | const | 0 | 2 | Unrestricted | |
normRate | float | const | 0 | 1 | Unrestricted | |
waveLength | int | derived | 0 | 8976 | Unrestricted | |
formatF | float | const | 1 | 65540 | Unrestricted | |
waveSR | int | derived | 1 | 48000 | Unrestricted | |
waveNumChannels | int | derived | 1 | 1 | Unrestricted | |
scaleFactor | float | derived | 1 | 1 | Unrestricted | |
pinID | uint | const | 1 | 3 | Unrestricted | |
waveBuffer | int* | parameter | 0 | [4490 x 1] | Unrestricted |
Pins
Input Pins
Name: enable
Description: flag to enable playback
Data type: int
Channel range: 1
Block size range: 1
Sample rate range: Unrestricted
Complex support: Real
Name: index
Description: sample index vector input data
Data type: float
Channel range: 1
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: audio
Description: output data
Data type: float
Name: isPlaying
Description: playing state
Data type: int
Scratch Pins
Channel count: 1
Block size: 256
Sample rate: 48000
MATLAB Usage
File Name: wave_index_player_ram_module.m