Ara
Download

Search or run a command

Jump to a section or open an Ara link.

Component · audio

AudioGraphSource

Plays a procedural audio graph (an ara-audio-graph graph document, domain audio) from this entity, spatialized and attenuated by its AudioSource (whose clip stays empty). Gameplay writes parameters and bumps triggers; the audio presenter forwards changes sample-accurately at the next control frame.

Fields

graph

option<asset<graph>>
The audio graph document.
default null

parameters

map<f32>
Parameter values by name (clamped to the graph's declared ranges).
default {}

triggers

map<u32>
Trigger counters by name: each increment fires the trigger once.
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=AudioGraphSource --why "Add AudioGraphSource"

Set a field

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

In a scene document

{
  "AudioGraphSource": {
    "graph": null
  }
}

From C#

/// <summary>Tune a procedural oscillator.</summary>
public static void UseAudioGraphSource(Entity entity, in Tick tick)
{
    ref var component = ref World.Get<AudioGraphSource>(entity);
    component.Parameters = new() { ["frequency"] = 440f };
}

From C#

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