Web sounds | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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?

18th Sep 2020, 12:59 AM
Jasmine👽
Jasmine👽 - avatar
9 Answers
+ 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
18th Sep 2020, 1:22 AM
Vachila64☕
Vachila64☕ - avatar
+ 6
Yes, Verinmbe Eramo you need JavaScript to create your own sound in a website, lemme quickly make an example code!
18th Sep 2020, 1:44 AM
Vachila64☕
Vachila64☕ - avatar
+ 5
Verinmbe Eramo yes you can produce a variety of sounds using JavaScript
18th Sep 2020, 1:04 AM
BroFar
BroFar - avatar
+ 5
Verinmbe Eramo here is one I found fairly quickly searching for piano https://code.sololearn.com/W9D32ys5201l/?ref=app
18th Sep 2020, 2:02 AM
BroFar
BroFar - avatar
+ 2
so... i will have to learn java script to be able to produce sound for my code?
18th Sep 2020, 1:41 AM
Jasmine👽
Jasmine👽 - avatar
+ 2
thanks
18th Sep 2020, 1:42 AM
Jasmine👽
Jasmine👽 - avatar
+ 2
thanks
18th Sep 2020, 1:42 AM
Jasmine👽
Jasmine👽 - avatar
+ 2
<audio>
19th Sep 2020, 6:20 PM
Arshia
Arshia - avatar