Skip to content
hanslindetorp edited this page Apr 20, 2020 · 8 revisions

The audio element is the mandatory root element of any WebAudioXML document. It acts as a main output connector and has its own WebAudio GainNode that controls the overall volume for all outputs. The audio element is also a good place to define general settings like "timeUnit" and "interaction". If i.e. timeUnit is set to "ms" all child elements will use milliseconds as unit for specifying time (applies to DelayNode and Envelopes). If the "interactionArea" is specified, all mouse, pointer and touch relative values will correspond to that element. The output from all child elements within an audio element are mixed into the master output. It acts as a master Mixer element.

This example sets the master volume to -6dB and make all child elements refer to time using milliseconds.

<?xml version="1.0" encoding="UTF-8"?>
<Audio version="1.0" gain="-10dB" timeUnit="ms" interactionArea="#touchArea">
  <OscillatorNode><<OscillatorNode>
</Audio>

This example shows an Audio element containing one oscillator. The timeUnit will be milliseconds for all subsequent child nodes and the interactionArea will be a HTML element with id="touchArea".

Clone this wiki locally