Wave One Shot Player
About This Guide
This application note describes the Wave One Shot Player module in AudioWeaver and demonstrates its uses.
The Wave One Shot Player module is a WAV file player. The module plays out the .wav file when triggered in an awd. The module can be found in Sound Design->WavePlayer-> WaveOneShotPlayer in the Module Bar on the left-hand side of the AudioWeaver Designer.
![](../../__attachments/3037332047/att_10_for_3037332047.png?inst-v=afeb83b1-861e-46b8-b4de-1c642321bb7f)
Figure 1: WaveOneShotPlayer module location
Module Functional Description
The WaveOneShotPlayer module is WAV file player. This module three different variants along with their Fract32 versions.
Wave One Shot Player RAM
Wave One Shot Player RAM Fract32
Wave One Shot Player Flash
Wave One Shot Player Flash Fract32
Wave One Shot Player FFS
Wave One Shot Player FFS Fract32
Wave One Shot Player RAM & Fract32
The RAM based Wave One Shot Player reads the audio data embedded from samples stored within the module.
![](../../__attachments/3037332047/att_4_for_3037332047.png?inst-v=afeb83b1-861e-46b8-b4de-1c642321bb7f)
Figure 2: Wave One Shot Player RAM
Input/Output Pins:
The Wave One Shot Player RAM has two input and one output pins.
Trigger input pin is a control value and is used to trigger the audio playback file. It is a Boolean value pin and requires a Low to High input for the playback to start and continues until the end of the WAV file and then stops. Retrigger while being in the middle of the playback has no effect and is ignored.
In the Figure 1 shown below the module is being triggered by an Impulse Source module which generates an impulse every 5msec.
![](../../__attachments/3037332047/att_7_for_3037332047.png?inst-v=afeb83b1-861e-46b8-b4de-1c642321bb7f)
Figure 3: Trigger to Wave One Shot Player module.
fRatio is the second input pin and is a float data type. This input pin is used to specific the sample rate ratio or the pitch factor that can be applied on the wave samples to produce the output audio. In the above example the fRatio is being controlled by a DC source which acts as a pitch controller for the module.
Audio output pin is the first output pin in this module and produces the processed audio samples from the wave files.
isPlaying is the second optional output pin which is a Boolean flag indicating the playback state. The value is set to 1 if playback is ongoing and 0 if not.
Variables:
The variables are the first tab in Module properties which is Rt Click on the module View Properties.
![](../../__attachments/3037332047/att_8_for_3037332047.png?inst-v=afeb83b1-861e-46b8-b4de-1c642321bb7f)
Figure 4: View Properties
Variables | Description | Default Value |
smoothingTime | The smoothing time in milliseconds is applied on the pitch factor per block. | Default value is 10msec. |
smoothingFactor | Is for updating the rate for the smoothing coeffs (per block). | Default value is 4. |
Arguments:
Arguments can be found Rt Click View Properties second tab in the properties as shown. The following table shows the list of arguments in the Wave One Shot Player RAM module, explanations’ along with their respective default values.
![](../../__attachments/3037332047/att_9_for_3037332047.png?inst-v=afeb83b1-861e-46b8-b4de-1c642321bb7f)
Figure 5: Argument Tab for WaveOneShotPlayerRAM
Arguments | Description | Default Value |
numChannels | Number of interleaved channels in the audio 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. |
fileName | Name of the wave file to be played. | By default, WAVFILE = ''. |
InterpolationMode | interpolation method. Linear Cubic | By default, INTERP = linear. (Only in floating point variant) |
normalizedPlaybackRate | normalized playback rate. | By default, NRATE = 1. |
maxPlabackRate | Maximum playback rate (relative to NRATE). | By default, MRATE = 1. |
isplayingpin | Boolean that provides the current playback state (PLAYING=1, STOPPED=0) |
Workings
The RAM module starts playback of a wave file provided by the user which is stored as a buffer array. The example below describes the workings of a wave one shot player RAM module. In this example we are taking two RAM modules and have stored two short wav files. The two RAM modules are working alternatively in a Ping-Pong manner. DC sources named PitchA and PitchB are used to vary the pitch of RAM1 and RAM2 respectively. In this example we are using an Impulse source for both the wave modules as a trigger to start playback of the wave files respectively. RAM2 has been given a delay of 2 msec which in turn creates the Ping Pong effect. The wav file used here is a Bell sound.
![](../../__attachments/3037332047/att_13_for_3037332047.png?inst-v=afeb83b1-861e-46b8-b4de-1c642321bb7f)
Figure 6: Wave One Shot Player RAM Example
Wave One Shot Player FFS & Fract32
![](../../__attachments/3037332047/att_5_for_3037332047.png?inst-v=afeb83b1-861e-46b8-b4de-1c642321bb7f)
Figure 7: Wave One Shot Player FFS
Input/Output Pins:
The Wave One Shot Player FFS has three input and one output pins. The added input pin is explained below whereas the the rest remain the same as for RAM.
fsInstance is the second input pin and is an integer data type. This input pin provides the instance address of the flash file system wrapper and must be valid to be ready to use.
Variables:
The variables are the first tab in Module properties which is Rt Click on the module View Properties. In this case the variables are the same as in the case of RAM module.
Arguments:
Arguments can be found Rt Click View Properties second tab in the properties.
Arguments | Description | Default Value |
numChannels | Number of interleaved channels in the audio 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. |
fileName | Name of the wave file to be played. | By default, WAVFILE = ''. |
InterpolationMode | interpolation method. Linear Cubic | By default, INTERP = linear. (Only in floating point variant) |
normalizedPlaybackRate | normalized playback rate. 1 corresponds to 1x playback rate. | By default, NRATE = 1. |
maxPlabackRate | Maximum playback rate (relative to NRATE). | By default, MRATE = 1. |
fracbits | Number of least-significant bits for the *fractional* part of the NCO word (word size: 32). | By default: 12 bits. (Only in fixed point variant) |
isplayingpin | Boolean that provides the current playback state (PLAYING=1, STOPPED=0) | By default: False |
muteMod | Used to mute output before changing file in run time. | By default: Blank |
unMuteMod | Used to unmute after reconfiguration. | By default: Blank |
Workings
We are using the same Ping Pong example as in case of the RAM variant of the module. In FFS module variant we have another input which is the fsInstance. In our example we are using the native mode as a target. We are using the SourceInt module with numChannels 2 and blockSize 1 to place the RAM address where the bin file is stored.
Rt Click on the SourceInt module --> Properties --> Array: value Tab --> Column 1 value is the Lower 32 bit that we input, and the Column 2 value is the Upper 32 bit. On a 32-bit system, the user must place the RAM address in Column 1 of the Array: value and column 2 will have the 32-bit address.
Output from SourceInt module with the above configuration is connected to the FFSWrapper module. The instance address of the flash file system wrapper is being provided by an FFS Wrapper module (for more details about the FFS Wrapper module link). The Bin file containing the wave file/files are uploaded in the FFSWrapper which in turn is connected to the fsInstance of the Wave One Shot Player FFS module.
The Output remains the same as that of the Wave One Shot Player RAM modules.
![](../../__attachments/3037332047/att_1_for_3037332047.png?inst-v=afeb83b1-861e-46b8-b4de-1c642321bb7f)
![](../../__attachments/3037332047/att_12_for_3037332047.png?inst-v=afeb83b1-861e-46b8-b4de-1c642321bb7f)
Figure 8: Wave One Shot Player FFS Example
Wave One Shot Player Flash & Fract32
This Wave One Shot Player variant extracts wave data from AWE Flash File System container on the target Flash device, based on wave file argument. User must specify the file name as an argument and can also change file name directly into fileName array as 32-bit packed data during run time.
![](../../__attachments/3037332047/att_6_for_3037332047.png?inst-v=afeb83b1-861e-46b8-b4de-1c642321bb7f)
Figure 9: Wave One Shot Player Flash
Input/Output Pins:
The Wave One Shot Player FFS has three input and one output pins. The added input pin is explained below whereas the rest remain the same as for RAM.
fsValid is the second input pin and is an integer data type. Boolean indicates flash file system is ready.
Variables:
The variables are the first tab in Module properties which is Rt Click on the module View Properties. In this case the variables are the same as in the case of RAM module.
Arguments:
Arguments can be found Rt Click View Properties second tab in the properties.
Arguments | Description | Default Value |
numChannels | Number of interleaved channels in the audio 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. |
fileName | Name of the wave file to be played. | By default, WAVFILE = ''. |
InterpolationMode | interpolation method. Linear Cubic | By default, INTERP = linear. (Only in floating point variant) |
normalizedPlaybackRate | normalized playback rate. | By default, NRATE = 1. |
maxPlabackRate | Maximum playback rate (relative to NRATE). | By default, MRATE = 1. |
fracbits | Number of least-significant bits for the *fractional* part of the NCO word (word size: 32). | By default, 12 bits. (Only in fixed point variant) |
isplayingpin | Boolean that provides the current playback state (PLAYING=1, STOPPED=0) | By default, False |
muteMod | Used to mute output before changing file in run time. | By default, Blank |
unMuteMod | Used to unmute after reconfiguration. | By default, Blank |
maxWaveChannels | Max number of channels a wave file can have. | By default, maxWaveChannels = 10. |
maxRatio | Max pitch factor supported. | By default, maxRatio = 10. |
Workings
We are using the same Ping Pong example as above. The only difference here is that the Flash module extracts wave data from AWE Flash File System container on the target Flash device, based on WAVFILE argument. User must specify the file name as an argument and can also change file name directly into fileName array as 32-bit packed data during run time.
![](../../__attachments/3037332047/att_11_for_3037332047.png?inst-v=afeb83b1-861e-46b8-b4de-1c642321bb7f)
Figure 10: Wave One Shot Player Flash Example