Skip to main content

Audio Composition

The VideoEditor SDK supports adding custom audio overlays on top of the video's soundtrack. Learn how to add custom audio clips.

Audio Composition tool

The VideoEditor SDK supports adding predefined audio libraries from which an audio clip can be overlayed on top of the video's soundtrack. Inside the audio tool, the audio clip can be trimmed and balanced with the original soundtrack of the video. The corresponding tool is implemented in the AudioOverlayOptionsToolPanel class and can be customized using the UiConfigAudio configuration.

Adding audio clips#

Audio Tracks are inserted into the SDK using the UiConfigAudio.

An AudioTrackCategoryItem object holds the metadata of an audio clip category, such as its preview image and the title and has an array of AudioTrackItem objects, which references via ID to the AudioTrackAsset holding the metadata such as its AudioSource, title, artist, and duration. The AudioSource class is not optimized to handle remote resources which therefore should be downloaded in advance and then passed as a local resource.

// Add Assets
// Takes title, artist and artwork from the Metadata
AudioTrackAsset("id_track_my", AudioSource.create(R.raw.track_trapped_in_the_upside_down)),
// Overrides, title, artist and duration -> faster loading speed
AudioTrackAsset("id_track_fancy", AudioSource.create(Uri.fromFile(downloadedFile)), title = "New Title", artist = "New Artist", durationInSeconds = 126),
AudioTrackAsset("id_track_summer", AudioSource.create(downloadedUri)),
settingsList.configure<UiConfigAudio> {
"audio_cat_elsewhere", "Elsewhere",
// Artist picture is taken from the metadata
// Overrides the artist picture
AudioTrackItem("id_track_fancy", ImageSource.create(R.drawable.pictogram)),