Provider for file based Audio Tracks.

// @input Asset.AudioTrackAsset audioTrack 

var control = script.audioTrack.control;

if (control.isOfType("Provider.FileAudioTrackProvider")) {
control.loops = -1; //set to loop forever
}
var audioFrameArray = new Float32Array(control.maxFrameSize)

script.script.createEvent("UpdateEvent").bind(function(eventData){
var frameShape = control.getAudioFrame(audioFrameArray);
print(frameShape.x + " samples were read on this update")
print(control.position + " current audio track position");
});

Hierarchy (View Summary, Expand)

Constructors

Properties

duration: number

The duration of the AudioTrackAsset in seconds.

loops: number

Loop count, if -1 is provided, the audio track will loop forever.

maxFrameSize: number

The maximum frame size of the audio track asset.

position: number

The current position of the AudioTrackAsset in seconds.

sampleRate: number

Sample rate (samples per second) of the audio track asset.

Methods

  • Writes readSize samples into the passed in audioBuffer Float32Array.

    Parameters

    • audioBuffer: Float32Array
    • readSize: number

    Returns vec3

  • Writes current audio frame to the passed in Float32Array and returns the frame shape.

    Parameters

    • audioFrame: Float32Array

    Returns vec3

  • Returns true if the object matches or derives from the passed in type.

    Parameters

    • type: string

    Returns boolean

MMNEPVFCICPMFPCPTTAAATR