Search
Loading...
Skip to content

Audio

The CreativeEditor (CE.SDK) provides different audio features you can leverage in web-based apps. This section covers how to add audio blocks, extract audio from videos, control playback, generate waveforms, and manage multi-track audio.

Use Cases#

Use the CE.SDK audio features when you need to create:

  • Background music
  • Voice-overs
  • Sound effects
  • Podcasts

How Audio Works in the CE.SDK#

The CE.SDK represents audio as audio blocks.

Each block has:

  • Source (file or extracted track)

  • Playback properties (time, speed, volume, mute)

  • Timeline properties (offset, duration, trim length)

  • Optional waveform thumbnails for UI visualization

What Are the Timeline Properties#

Each audio block has properties that determine when and how much of the sound plays:

  • Offset: the delay before an audio block begins playing inside the scene timeline.

  • Trim length: cuts the audio to keep only a specific part of it.

  • Duration: defines how long the audio plays.

What Are Waveforms#

Waveforms are visual representations of the audio signal over time. They show the amplitude (volume level) of the sound at each moment, using peaks and valleys.

The CE.SDK can generate sampled waveform data that you can render in your UI. This is especially helpful for editing tools.

When to Create VS. Extract Audio#

The CE.SDK allows you to either create a blank audio block or extract the audio from a video.

  • Create an empty audio block when you want to add external or standalone audio that doesn’t come from a video.

  • Extract the audio when it comes from a video block already in your scene.

CE.SDK Audio Features Overview#

The table below summarizes the main audio-related capabilities in CE.SDK.
Each feature is related to an example further down the page.

CategoryActionAPI NameNotes
Create Audio BlocksCreate empty audio blockcreateCreates an audio block with no source.
Extract audio from videocreateAudioFromVideoRequires a video block ID and track index.
Playback ControlSet playback positionsetPlaybackTimeTime in seconds.
VolumesetVolumeRange 0.0–1.0.
MutesetMutedBoolean.
Playback speedsetPlaybackSpeedRange 0.25–3.0.
Timeline ManagementOffsetsetTimeOffsetTo move the playback starting point in the scene timeline.
DurationsetDurationTotal length (seconds).
Trim lengthsetTrimLengthCuts content to a defined length.
Replace Audio SourceReload edited scenescene.loadFromStringUsed when replacing audio at runtime.
WaveformsGenerate thumbnailsgenerateAudioThumbnailSequenceProduces waveform sample data for UI.
Export AudioExport WAVexportAudioMIME type: audio/wav.
Export MP4exportAudioMIME type: audio/mp4.

Examples#

Find in the following list of examples different API calls listed in the preceding table.

Create Audio#

To create an empty audio block, use:

const blockId = engine.block.create('audio');

Control Audio Playback#

Use engine.block.setPlaybackTime(blockId, time: number).

This example sets the current playback at 3 seconds:

engine.block.setPlaybackTime(blockId, 3)

Manage Audio Timeline#

If the audio has an offset of:

  • 0 s → It plays immediately when the scene starts.

  • 2 s → The CE.SDK waits 2 seconds before playing it.

  • 10 s → The audio only starts at the 10-second mark.

Use engine.block.setTimeOffset(blockId, offset: number).

This example starts the audio at 2 s on the timeline:

engine.block.setTimeOffset(blockId, 2);

Next Steps#

For each feature’s detailed instructions and options: