Skip to main content

Streaming sound wave

For Voice Activity Detection (VAD), refer to this page.

A streaming sound wave is a type of imported sound wave that supports adding audio data dynamically, even during playback. It offers the same functionality as an imported sound wave, e.g. rewinding, and can be used in SoundCues, etc.

Creating a streaming sound wave

First you should create a streaming sound wave.

Create Streaming Sound Wave node

Playing the sound wave

You can then play back that sound wave. However, this is not necessary to do now, you can start playing the sound wave later.

Various examples of playing a sound wave

Pre-allocating audio data

Optionally, you can pre-allocate audio data (bytes) to avoid reallocating the entire PCM buffer each time new audio data is appended.

Pre Allocate Audio Data node

Appending audio data

To add audio data to the end of the existing buffer, use the appropriate functions for dynamically appending audio data. The playback will follow the queue sequence of these appends.

Append Audio Data node

Avoiding accelerated audio playback

Often, when you need to stream audio data and play simultaneously, you should add a slight delay before the playback to avoid accelerated audio due to too fast buffer population. A delay of around half a second is typically recommended.

Example usage

Finally, your implementation might look like this:

An example of using a streaming sound wave