Learn how to implement interactive, dynamic music on a web page using WebAudioXML (WAXML).
Try the interactive p5.js Sketch and add your own layers: https://editor.p5js.org/hanslindetorp/sketches/jOlwL0VFb
The audio.xml file:
1 2 3 4 | <Mixer crossFadeRange="1" mix="$intensity"> <GainNode id="mix1-A" /> <GainNode id="mix1-B" /> </Mixer> |
This code generates a mixer that can fade between two different sounds. The sounds are place (in sync) in an arrangement in the musixc.xml file:
1 2 3 4 | <arrangement class="music"> <track loopLength="2" src="audio/percussion-120bmp-2bars.mp3" output="#mix1-A" /> <track loopLength="4" src="audio/drums-120bmp-4bars.mp3" output="#mix1-B" /> </arrangement> |
Please, note that the output on the tracks routes the audio signal into the different inputs in the dynamic mixer.
Try this interactive p5.js Sketch: https://editor.p5js.org/hanslindetorp/sketches/xIVIfAnho