githubEdit

waveform-linesText to Music

Generate a full musical track from a text description using .GENMusic().

Basic Usage

IAudioAsset music = await "Upbeat electronic background music with a driving beat"
    .GENMusic()
    .ExecuteAsync();

AudioClip clip = await music.ToAudioClipAsync();
audioSource.clip = clip;
audioSource.Play();

Input Types

String Input

IAudioAsset music = await "Calm ambient piano melody"
    .GENMusic()
    .ExecuteAsync();

Prompt Input

var prompt = new Prompt("Epic orchestral battle theme in the style of {composer}");
IAudioAsset music = await prompt
    .GENMusic()
    .ExecuteAsync();

Alias Method

Configuration

Duration

Duration range depends on the provider (typically 10 – 300 seconds). If not set, the provider chooses an appropriate length based on the prompt.

Vocal Type

Control whether the generated track includes vocals:

MusicVocalType

Description

Unset

Provider decides (default)

Vocal

Include vocals if the prompt suits them

Instrumental

Instrumental track only

Model Selection

ElevenLabs: Composition Plan

For fine-grained control over song structure, provide a CompositionPlan instead of a simple prompt. When a CompositionPlan is set the Prompt property is ignored.

Provider Support

Feature

ElevenLabs

Google Lyria (Pro)

Text prompt

Duration control

Vocal / Instrumental

Composition plan

Realtime streaming

circle-info

Google Lyria uses a bidirectional WebSocket stream and is integrated via the LyriaMusicPlayer component. It is available in AIDevKit Pro only.

Unity Integration Example

Last updated