-
Notifications
You must be signed in to change notification settings - Fork 4
HTML attributes
Hans Lindetorp edited this page Oct 25, 2023
·
1 revision
An easy way to connect HTML events to control WAXML is to use the HTML attributes (If you prefer Javascript, please refer to the Javascript API). WAXML can listen to any event on any HTML element and respond by triggering, stopping, or setting the value of a variable. The syntax is:
data-waxml-[eventName]-[commandName]
- eventName can be any event appropriate for the HTML element, e.g. click, mouseenter, mouseleave, loaded etc.
- commandName can be either trig, stop or set.
ex:
<div data-waxml-mouseenter-trig="sound1" data-waxml-mouseleave-stop="sound1">Rollover Sound</button>
<ObjectBasedAudio src="audio/sound1.mp3" trig="sound1" stop="sound1" />
It is also possible to set a variable using WAXML HTML attributes:
This example show how a button can turn on the audio by setting the variable "gain" to 1 (supposed it is configured to control the volume in WAXML) or from a slider controlling the volume between 0 (off) to 1 (on):
<button data-waxml-click-set="gain=1">Turn on audio</button>
<input type="range" min="0" max="1" value="0" step="0.01" data-waxml-input-set="gain=this.value" />
<GainNode gain="$gain" />
Please follow my research journey at http://hans.arapoviclindetorp.se and https://www.facebook.com/hanslindetorpresearch/
- Collaborative music-making: special educational needs school assistants as facilitators in performances with accessible digital musical instruments (Frontiers in Computer Science 2023)
- Playing the Design: Creating Soundscapes through Playful Interaction (SMC2023)
- Accessible sonification of movement: A case in Swedish folk dance (SMC2023)
- Evaluating Web Audio for Learning, Accessibility, and Distribution (JAES2022)
- Audio Parameter Mapping Made Explicit Using WebAudioXML (SMC2021)
- Putting Web Audio API To The Test: Introducing WebAudioXML As A Pedagogical Platform (WAC2021)
- Sonification for everyone everywhere – Evaluating the WebAudioXML Sonification Toolkit for browsers (ICAD2021)
- WebAudioXML: Proposing a new standard for structuring web audio (SMC2020)