Construct 3 icon

Construct 3

Documentation

Audio script interface

Ashley's avatar
Medal
Construct Team Founder
Published 13 Jan, 2020
241 words
~1-2 mins

The IAudioObjectType interface derives from IObjectClass to add APIs specific to the Audio plugin.

The script interface essentially just provides access to the underlying AudioContext (part of the Web Audio API) that the Audio plugin uses internally for audio playback. However this is sufficient to provide complete control over audio playback, including setting up complex graphs of audio processing nodes. It is also convenient, since Construct manages some awkward details such as ensuring playback is enabled as soon as possible given most browsers impose autoplay restrictions. Adding the Audio object and using its script interface saves you from having to re-implement these details yourself.

Note this class derives from the object class interface, not the instance interface. Typically it is used through runtime.objects.Audio.

Audio APIs

audioContext

The Audio plugin's internal AudioContext used for audio playback.

destinationNode

The destination node to connect any additional audio nodes to.