FANDOM


      With the addition of the sound command to ChoiceScript the following article has been rendered obsolete.

Adding ambient sounds

Ambiental sounds are the sounds that play in the background of the game, and that don't signify any action in-game (for example, clicking the next button). They can be made by adding a sound player at the bottom of your game page, that plays the sounds (the ambiental sounds keep playing between scene transitions as well).

First, you will need a soundtrack (the one you want to be played during the playthrough of the game), in both .mp3 and .ogg formats (You can use Audacity to "export" them in these formats, for example).

Once you have your soundtrack in both of these formats, you place the soundtracks in your /web/mygame folder. Then, you open your index.html file (the one in the /web/mygame folder) with a text editor. Then, search for these lines (note that the lines below are close to the end):

<p>If you can't get the game to work, please write to us at
        
        <a href="mailto:support-external@choiceofgames.com">support-external@choiceofgames.com</a> for assistance.</p>
        
        </noscript>

Then, you paste the following lines right under those lines:

<audio controls="controls">
     
       <source src="soundtrack.mp3" type="audio/mpeg" />
     
       <source src="soundtrack.ogg" type="audio/ogg" />
     
     <embed height="50" width="100" src="soundtrack.mp3" />
     
     </audio>

So that if you paste the audio code there, the lines of code will look like this:

<p>If you can't get the game to work, please write to us at
      <a href="mailto:support-external@choiceofgames.com">support-external@choiceofgames.com</a> for assistance.</p>
      
      </noscript>
      
      <audio controls="controls">
      
        <source src="soundtrack.mp3" type="audio/mpeg" />
      
        <source src="soundtrack.ogg" type="audio/ogg" />
      
      <embed height="50" width="100" src="soundtrack.mp3" />
      
      </audio>
      
      </body>
      
      </html>


All you need to do is replace the word "soundtrack" with the name of your soundtrack and you're done! You can also customize the height/width of the sound player by changing the numbers after height and width respectively, on this line:

<embed height="50" width="100" src="soundtrack.mp3" />

Although that isn't necessary. That's it; a sound player will appear at the bottom of your game page and if you press the "play" button, you'll hear the soundtrack play.

Related articles

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.