Examples of sound formats
In your story, you can use a number of sound formats (sound effects and music). However, the most frequently used formats are the following:
- Mp3 (.mp3) – type: audio/mpeg
- OGG (.ogg) – type: audio/ogg
- Wave (.wav) – type: audio/wav
It is best to convert sound into the mp3 format in order to get a small file (the sound is uploaded faster) and to make sure that it will work in any Internet browser.
<audio> tag (of HTML), you can put a selected sound into a particular fragment of the story (a particular slip).
Syntax – autoplay
<audio autoplay> <source src="link.mp3" type="audio/mpeg"> Oops! Your browser does not support this audio element. </audio>
Autoplay loop (indefinite autoplay):
<audio autoplay loop> <source src="link.mp3" type="audio/mpeg"> Oops! Your browser does not support this audio element. </audio>
autoplay attribute starts replaying the sound as soon as the particular fragment of the story (slip) is accessed – the sound source is not visible in this case.
loop attribute makes the sound be replayed indefinitely.
Syntax – virtual audio controls
<audio controls> <source src="link.mp3" type="audio/mpeg"> Oops! Your browser does not support this audio element. </audio>
controls attribute provides visual audio controls in the place where the sound has been added to the fragment of the story (the slip). The sound is not played automatically – you need to click on a particular button.
Using the Java Script (JS) language, you can obtain the effect of background music. Even when players move from one fragment of the story to another (clicking on the links), the music will be replayed automatically in an indefinite loop.
var music = document.createElement("audio"); music.src = "link.mp3"; music.loop = true; music.play();
In your project, you can use the following sound effects and music:
- Soliloquy – opengameart.org
- Grassy_World – opengameart.org
- TremLoadingloopl – opengameart.org
- happy-sandbox – freesound.org
- victory_fanfare – freesound.org
- dun-dun-dun – freesound.org
- door-opens-and-shuts – freesound.org
- harpsicord-dream-enter – freesound.org
- heart-beat – freesound.org
Please, remember that there are copyrights which protect all intellectual property. Therefore, you should use your own materials or materials created by authors who have agreed to share their works, for example, based on the Creative Commons license. It is good practice to provide a list with sources of the sounds you have used in your project and to add a slip with special thanks to the authors.