I have an array of audio elements with the time they need to be played representing a sound. I would like to be able to play the whole array at the correct times like a real sound.
Small precision, the table contains the data-key of the audio element, which is not a problem because I easily recover the audio element associated:
<audio data-key="65 81 80"src="static/assets/sounds/boom.wav"id="boomSound"></audio>
document.querySelector(
`audio[data-key*="${this.record[0]["key"]}"`
);
The record array :
It start at 0 sec.
In this example, I would like to play the 1st audio element after 0.2sec (200ms), then the 2nd 0.6sec after the beginning, …
record:[
{key:65,time:0.2},
{key:83,time:0.6},
{key:69,time:1.3},
{key:68,time:1.8},
{key:84,time:2.5}
]
Thanks.