Web sounds | Sololearn: Learn to code for FREE!

+1

Web sounds

Please don’t mind my ignorance but is there a tag for sounds on web page? Or Can we produce sounds on our web page?

9/18/2020 12:59:02 AM

Jasmine👽

9 Answers

New Answer

+6

Yes there is a tag, it's the <audio> tag, it works like this <audio src="example.mp3" controls/> That is the easiest syntax to add an audio element to your page, the html course will go into more detail in the HTML.5 section of the course 🙂 And yes, with the Web Audio API (nothing special here, that's just what it's called), we can create our own sounds in JavaSricpt, althoght it gets a bit tricky and is ideal to use for Web games, usually the <audio> tag is enough to get audio from a source and play it

+6

https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API

+6

Yes, Verinmbe Eramo you need JavaScript to create your own sound in a website, lemme quickly make an example code!

+5

Verinmbe Eramo yes you can produce a variety of sounds using JavaScript

+5

Verinmbe Eramo here is one I found fairly quickly searching for piano https://code.sololearn.com/W9D32ys5201l/?ref=app

+2

so... i will have to learn java script to be able to produce sound for my code?

+2

thanks

+2

thanks

+2

<audio>