These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:10 pm Advanced search

handling multiple <audio> tags at once

Here you can discuss things related to HTML and the Web in general that do not fit in to other categories.

handling multiple <audio> tags at once

Postby o1sound » Thu May 05, 2011 12:38 am

My plan is to build a grid that can play many sounds at once using html5's audio tag.
As a result, I need to call many <audio> tags at once, which I organize using unique tag id's

Are there any known or obvious limitations to calling mutliple sound files at once? Does anyone shudder if I say I want to run 10 or 20 simultaneous sounds using html5? How about even more?

Second, calling so many sound files is quite messy if I include them all at the top of my main html file.
Can I place these tags in an external file much like Css.css or javascript.js?

Thanks!

<body>

<audio loop id="sound1"> <source src="sound1.ogg"/> <source src="sound1.mp3"/> </audio>
<audio loop id="sound2"> <source src="sound2.ogg"/> <source src="sound2.mp3"/> </audio>
<audio loop id="sound3"> <source src="sound3.ogg"/> <source src="sound3.mp3"/> </audio>
<audio loop id="sound4"> <source src="sound4.ogg"/> <source src="sound4.mp3"/> </audio>
....etc....

</body>
o1sound
<h6>
 
Posts: 2
Joined: Thu May 05, 2011 12:35 am

Re: handling multiple <audio> tags at once

Postby zcorpan » Thu May 05, 2011 9:31 am

Well it *should* work, but audio doesn't work well enough yet - see http://www.phoboslab.org/log/2011/03/th ... tml5-audio

You can put it in an external javascript file. No need to append the audio elements to the document even. There's a convenience constructor new Audio() which creates an 'audio' element and sets preload="auto".
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Re: handling multiple <audio> tags at once

Postby o1sound » Mon May 09, 2011 8:25 pm

Thanks. I decided to leave the <audio> tags in the html. I have over 20 sounds running smoothly, but I had to set audioElement.volume=0.1 as sounds started to clip if too many are played at once at regular volume.
o1sound
<h6>
 
Posts: 2
Joined: Thu May 05, 2011 12:35 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest