Skip to content

Wave Loop Player FFS V2 Fract32

Overview

Periodic WAV playback supporting pitch shifting

Discussion

This module outputs wave data in fract32 format in loop mode. It extracts wave data based on "fileName" argument from an AWE Flash File System container on control input pin "fsInstance". User has to specify the file name as an argument and can also change file name directly in the "fileName" array as 32-bit packed data during run time. The WAV files itself must be in 16 bit PCM format.

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 will be used. If the wave file has less channels than output pin channels, then the remaining output channels will be muted.

If any errors occurs in the module, it is captured in the parameter .errorCode.

ERROR CODES

Possible ERROR codes, reported (Inspector -> errorCode):

E_CANTOPEN -43 : Wav file may exist but FSInstPtr is NULL

E_FILE_NOT_FOUND -50 : Wav file could not be found in file systems

E_ILLEGAL_FILE_ATTRIBUTE -51 : Wav file has an illegal file attribute, e.g. bit resolution is not 16 bit

Version 2 of this module, compared to version 1, allows the option to connect multiple FFS Wrapper modules and hence look after files sequentially in multiple wave libraries. For muting during file change the mute mechanism has been revised: Optional muteGet/muteSet pins can , be used for outsourced mute control logic (similar approach as in ActivationMute module).

Module Pack

awe-mod-dspc-snd

ClassID

classID = 41837

Type Definition

typedef struct _ModuleWaveLoopPlayerFFSV2Fract32
{
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 startDelay;                             // Starting delay value in samples
INT32 enable;                                 // En/Disable playback. Resets sample position upon stop
INT32 numFSInstances;                         // Number of FS instances
FLOAT32 normRate;                             // Rate of data used to compute the ratio for normalized players
FLOAT32 maxRate;                              // Highest allowed rate of playback that can be specified
INT32 fracBits;                               // Number of least-significant bits for the fractional part of the NCO word (word size: 32)
INT32 waveLength;                             // Number of samples in currently loaded file
INT32 currFSInstIdx;                          // Current active AWE flash file system instance
INT32 fIndex;                                 // Current index in the wave file
INT32 errorCode;                              // Captures errors that could arise in the module C code. Appears on the inspector 
FLOAT32 currFStep;                            // Current (smoothed) rate at which audio is read from the input buffer
INT32 isReady;                                // Boolean that indicates if WavePlayer is ready to output data
INT32 wavePlayerStatus;                       // Internal state machine status
INT32 pinIdxFRatio;                           // Pin index located for fRatio
INT32 pinIdxEnable;                           // Pin index located for Enable
INT32 pinIdxMuteGet;                          // Pin index located for MuteGet
INT32 pinIdxAudioOut;                         // Pin index located for Audio Out
INT32 pinIdxMuteSet;                          // Pin index located for MuteSet
INT32 pinIdxIsPlaying;                        // Pin index located for isPlaying
INT32 waveLengthFract;                        // Number of samples in Q-format (fixed representation)
INT32 waveCh;                                 // Number of channels in the wave file
INT32 waveSR;                                 // Actual sample rate of the wave file
FLOAT32 scaleFactor;                          // Scale factor for playback rate
FLOAT32 smoothingCoeff;                       // Smoothing (pitch) coefficient
FLOAT32 QFormatF;                             // Integer value of left-shift by NCOFracBits. Determines the precision of the linear interpolation
FLOAT32 QFormatI;                             // Integer value of left-shift by NCOIntBits. Determines the maximum playback rate and the maximum size of a wave file in samples
INT32 decBlockSize;                           // Decimated block size
INT32 decFactor;                              // Decimated Factor
INT32* fileName;                              // Name of wave file to playback
INT32* fileNamePrev;                          // Name of previous loaded wave file
UINT32 ** fsInstancePtr;                      // Array of AWE flash file system instance pointer
UINT32 * waveBuffer;                          // State variable holds the start address of the wave file in filesystem
INT32 getMuteStatus;                          // State variable holds get mute pin status
} ModuleWaveLoopPlayerFFSV2Fract32Class;

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
startDelay int parameter 0 0 Unrestricted
enable int state 0 1 0:1
numFSInstances int const 0 15 Unrestricted
normRate float const 0 1 Unrestricted
maxRate float const 0 1 Unrestricted
fracBits int const 0 12 Unrestricted
waveLength int derived 0 0 Unrestricted Samples
currFSInstIdx int state 0 0 Unrestricted
fIndex int state 0 0 Unrestricted
errorCode int state 0 0 Unrestricted
currFStep float state 0 1 Unrestricted
isReady int state 0 0 Unrestricted
wavePlayerStatus int state 0 0 Unrestricted
pinIdxFRatio int const 1 15 Unrestricted
pinIdxEnable int const 1 16 Unrestricted
pinIdxMuteGet int const 1 17 Unrestricted
pinIdxAudioOut int const 1 18 Unrestricted
pinIdxMuteSet int const 1 19 Unrestricted
pinIdxIsPlaying int const 1 20 Unrestricted
waveLengthFract int derived 1 0 Unrestricted
waveCh int derived 1 0 Unrestricted
waveSR int derived 1 0 Unrestricted Hz
scaleFactor float derived 1 1 Unrestricted
smoothingCoeff float derived 1 0 Unrestricted
QFormatF float derived 1 4096 Unrestricted
QFormatI float derived 1 524300 Unrestricted
decBlockSize int derived 1 1 Unrestricted
decFactor int derived 1 1 Unrestricted
fileName int* parameter 1 [14 x 1] Unrestricted
fileNamePrev int* state 1 [14 x 1] Unrestricted
fsInstancePtr UINT32 ** state 1 Unrestricted
waveBuffer UINT32 * state 1 Unrestricted
getMuteStatus INT32 state 1 Unrestricted

Pins

Input Pins

Name fsInstance1
Description AWE file system instance pointer
Data type int
Channel range Unrestricted
Block size range 1
Sample rate range Unrestricted
Complex support Real
Name fsInstance2
Description AWE file system instance pointer
Data type int
Channel range Unrestricted
Block size range 1
Sample rate range Unrestricted
Complex support Real
Name fsInstance3
Description AWE file system instance pointer
Data type int
Channel range Unrestricted
Block size range 1
Sample rate range Unrestricted
Complex support Real
Name fsInstance4
Description AWE file system instance pointer
Data type int
Channel range Unrestricted
Block size range 1
Sample rate range Unrestricted
Complex support Real
Name fsInstance5
Description AWE file system instance pointer
Data type int
Channel range Unrestricted
Block size range 1
Sample rate range Unrestricted
Complex support Real
Name fsInstance6
Description AWE file system instance pointer
Data type int
Channel range Unrestricted
Block size range 1
Sample rate range Unrestricted
Complex support Real
Name fsInstance7
Description AWE file system instance pointer
Data type int
Channel range Unrestricted
Block size range 1
Sample rate range Unrestricted
Complex support Real
Name fsInstance8
Description AWE file system instance pointer
Data type int
Channel range Unrestricted
Block size range 1
Sample rate range Unrestricted
Complex support Real
Name fsInstance9
Description AWE file system instance pointer
Data type int
Channel range Unrestricted
Block size range 1
Sample rate range Unrestricted
Complex support Real
Name fsInstance10
Description AWE file system instance pointer
Data type int
Channel range Unrestricted
Block size range 1
Sample rate range Unrestricted
Complex support Real
Name fsInstance11
Description AWE file system instance pointer
Data type int
Channel range Unrestricted
Block size range 1
Sample rate range Unrestricted
Complex support Real
Name fsInstance12
Description AWE file system instance pointer
Data type int
Channel range Unrestricted
Block size range 1
Sample rate range Unrestricted
Complex support Real
Name fsInstance13
Description AWE file system instance pointer
Data type int
Channel range Unrestricted
Block size range 1
Sample rate range Unrestricted
Complex support Real
Name fsInstance14
Description AWE file system instance pointer
Data type int
Channel range Unrestricted
Block size range 1
Sample rate range Unrestricted
Complex support Real
Name fsInstance15
Description AWE file system instance pointer
Data type int
Channel range Unrestricted
Block size range 1
Sample rate range Unrestricted
Complex support Real
Name fRatio
Description Playback rate
Data type float
Channel range 1
Block size range 1
Sample rate range Unrestricted
Complex support Real
Name enable
Description Flag to enable playback
Data type int
Channel range 1:1:1
Block size range 1:1:1
Sample rate range Unrestricted
Complex support Real
Name muteGet
Description Mute input
Data type int
Channel range 1:1:1
Block size range 1:1:1
Sample rate range Unrestricted
Complex support Real

Output Pins

Name audio
Description Output data
Data Type fract32
Name muteSet
Description Mute output
Data Type int
Name isPlaying
Description Playing state
Data Type int

Matlab Usage

File Name: wave_loop_player_ffs_v2_fract32_module.m 

Copyright (c) 2026 DSP Concepts, Inc.