0
Adding sounds files by using js?
I'm trying to make a guitar by using floating divs as the "strings". I have the right sound files to play when each div is touched. Can anyone tell me a way to add the files. Also is it possible for the audio to overlap each other so that I can press multiple divs at once?
2 Answers
+ 4
If you want to use those guitar sounds on Sololearn then you have to upload them on hosting service like Dropbox.
Here is quick guide to do that
https://www.sololearn.com/discuss/1054246/?ref=app
Now, to play the audio, you can use Audio() class of Javascript.
var sound1 = new Audio();
sound1.src = "https://yourlink.com/audio.mp3";
And then have a function that plays the audio and call it on an onclick event.
function playAudio() {
sound1.play();
}
0
Thank you for the help!