Ara
Download

Search or run a command

Jump to a section or open an Ara link.

Component · audio

MusicSource

Plays a .music document's interactive score (segments, transitions, intensity layers) from this entity, non-spatial. Presentation intent: gameplay writes intensity and segment; the audio presenter follows them.

Fields

music

option<asset<music>>
The score (.music document).
default null

bus

string
Mixer bus the stems play on.
default "music"

intensity

f32
Intensity from 0 to 1: stems whose range contains it are audible.
default 00 – 1

segment

string
Segment to transition to (on the score's sync rule); empty follows the score.
default ""

Usage

Every edit is an undoable command: from the CLI as below, or the same JSON from an agent over MCP. See component.add and property.set.

Add it

ara do component.add -p entity=name:Crate -p component=MusicSource --why "Add MusicSource"

Set a field

ara do property.set -p entity=name:Crate -p path=MusicSource.music -p value=null --why "Tune MusicSource"

In a scene document

{
  "MusicSource": {
    "music": null
  }
}

From C#

/// <summary>Raise adaptive music intensity during combat.</summary>
public static void UseMusicSource(Entity entity, in Tick tick)
{
    ref var component = ref World.Get<MusicSource>(entity);
    component.Intensity = 0.8f;
}

From C#

Scripts read and write it with Get<MusicSource>(); see the MusicSource struct.