Skip to content

Wave One Shot Player RAM

Overview

One-shot Wave Player supporting pitch shifting

Discussion

This module outputs float wave data triggered via an input pin.

User has to specify the file name as an argument.

The input .trigger is a Boolean value which if set starts the playback. Playback continues until the end of the file is reached and then it stops. Retrigger while playback is active has no effect and will be ignored.

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.

Module Pack

awe-mod-dspc-snd

ClassID

classID = 41812

Type Definition

typedef struct _ModuleWaveOneShotPlayerRAM
{
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 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 fIndex;                                 // Current index in the wave file
FLOAT32 fIndexFract;                          // Current fract index in the wave file
FLOAT32 currentFStep;                         // Current (smoothed) rate at which audio is read from the input buffer
INT32 triggerPrev;                            // State trigger signal to determine rising edge
INT32 triggerLatched;                         // State trigger denoting player is active
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
FLOAT32 smoothingCoeff;                       // Smoothing (pitch) coefficient
UINT32 pinID;                                 // Specifies which control pins are available.
INT32* waveBuffer;                            // Data transferred from PC to target DSP via this buffer.
} ModuleWaveOneShotPlayerRAMClass;

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
interpMode int const 0 2 Unrestricted
normRate float const 0 1 Unrestricted
maxRate float const 0 2 Unrestricted
waveLength int derived 0 8976 Unrestricted
fIndex int state 0 0 Unrestricted
fIndexFract float state 0 0 Unrestricted
currentFStep float state 0 1 Unrestricted
triggerPrev int state 0 0 Unrestricted
triggerLatched int state 0 0 Unrestricted
waveSR int derived 1 48000 Unrestricted
waveNumChannels int derived 1 1 Unrestricted
scaleFactor float derived 1 1 Unrestricted
smoothingCoeff float derived 1 0.1248 Unrestricted
pinID uint const 1 1 Unrestricted
waveBuffer int* parameter 1 [4490 x 1] Unrestricted

Pins

Input Pins

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 audio
Description output data
Data Type float
Name isPlaying
Description playing state
Data Type int

Matlab Usage

File Name: wave_oneshot_player_ram_module.m 

Copyright (c) 2026 DSP Concepts, Inc.