Skip to content

Wave Loop Player FFS V2

Overview

Periodic WAV playback supporting pitch shifting

Discussion

This module outputs wave data in float 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 = 41836

Type Definition

typedef struct _ModuleWaveLoopPlayerFFSV2
{
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
INT32 interpMode;                             // Linear or cubic interpolation
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 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
FLOAT32 fIndexFract;                          // Current fract 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 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
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
} ModuleWaveLoopPlayerFFSV2Class;

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
interpMode int const 0 2 Unrestricted
normRate float const 0 1 Unrestricted
maxRate float const 0 2 Unrestricted
waveLength int derived 0 0 Unrestricted Samples
currFSInstIdx int state 0 0 Unrestricted
fIndex int state 0 0 Unrestricted
fIndexFract float 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
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
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 float
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_module.m 
 M = wave_loop_player_ffs_v2_module(NAME, NUMFSINSTANCES, NUMCHANNELS, BLOCKSIZE, SAMPLERATE, WAVFILE, INTERP, NRATE, MAXRATE, MUTEPIN, ENABLEPIN, ISPLAYINGPIN) 
 Creates a source module that reads wave samples from a wave file and outputs blocks of data. This module works in combination with  
 AWE FFS wrapper module and outputs blocks of data of wave file whose name is an argument. 

 Arguments: 
    NAME           - name of the module. 
    NUMFSINSTANCES - number of fs instance inputs 
                   - by default, NUMFSINSTANCES = 1. 
    NUMCHANNELS    - number of interleaved channels in each output pin. 
                     By default, NUMCHANNELS = 1. 
    BLOCKSIZE      - number of samples per output channel.   
                     By default, BLOCKSIZE = 256. 
    SAMPLERATE     - sample rate of the output signal, in Hz.   
                     By default, SAMPLERATE = 48000. 
    WAVFILE        - name of the wave file. 
                     By default, WAVFILE = ''. 
    INTERP         - interpolation method. 
                     By default, INTERP = linear. 
    NRATE          - normalized playback rate.  
                     By default, NRATE = 1. 
    MAXRATE        - Maximum playback rate (relative to NRATE). 
                     By default, MAXRATE = 1 
    MUTEPIN        - Boolean that determines whether the module exposes an input pin that allows   
                     mute control during run-time 
    ENABLEPIN      - Boolean that determines whether the module exposes an input pin that allows   
                     en/disabling playback during run-time 
    ISPLAYINGPIN   - Boolean that provides the current playback state (PLAYING=1, STOPPED=0) 


 Copyright 2025.  DSP Concepts, Inc.  All Rights Reserved. 

 AudioWeaverModule [This tag makes it appear under awe_help] 

Copyright (c) 2026 DSP Concepts, Inc.