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.
Sound effects
Using the <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>
The 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.
The 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>
The 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.
Background music
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();
Sound database
In your project, you can use the following sound effects and music:
Music
- https://nckgdansk.github.io/gameofgdansk-audio/Soliloquy_1.mp3
- https://nckgdansk.github.io/gameofgdansk-audio/Grassy_World.mp3
- https://nckgdansk.github.io/gameofgdansk-audio/TremLoadingloopl.mp3
- https://nckgdansk.github.io/gameofgdansk-audio/happy-sandbox.mp3
Source
- Soliloquy – opengameart.org
- Grassy_World – opengameart.org
- TremLoadingloopl – opengameart.org
- happy-sandbox – freesound.org
Sound effects
- https://nckgdansk.github.io/gameofgdansk-audio/victory_fanfare.mp3
- https://nckgdansk.github.io/gameofgdansk-audio/dun-dun-dun.mp3
- https://nckgdansk.github.io/gameofgdansk-audio/door-opens-and-shuts.mp3
- https://nckgdansk.github.io/gameofgdansk-audio/harpsicord-dream-enter.mp3
- https://nckgdansk.github.io/gameofgdansk-audio/heart-beat.mp3
Source
- victory_fanfare – freesound.org
- dun-dun-dun – freesound.org
- door-opens-and-shuts – freesound.org
- harpsicord-dream-enter – freesound.org
- heart-beat – freesound.org
License
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.