I did everything like the play a sound but It doesn't work for me. Please i had to add a sound to my gamebook
what version of quest web or pc?
and what is the format of the song?
Is it mp3?
You can put it in the start script of the game, but i wouldnt recommend large audio file.
Mr.night. I'm using a phone and the Song is mp3 while I don't have a clue that quest or web has a version
You need to be able to either link to the audio file directly or give quest a direct path to the file on your computer.
If youre on your phone youre using the web version, so I'm not sure what the method if any there is to do that.
You should have a backup file format to fall back on to prevent the sound not being played.
I suggest you encode all your sounds/music to both .mp3 and .ogg and script them both.
There's information about this on the forums (search for Audiovidlib, Ogg etc.
I've never worked with gamebooks so I don't know how it differs from scripting in a text adventure (I'm guessing it's easier though).
Edit: Removed factual errors
K.V. (a super swell guy who used to roam the forums. Incredibly helpful too!) wrote a library called AudioVideoLib. It's a fantastic tool for adding sounds/music to your game. I'll never use another to be sure!
Check this out:
Click here for info and download.
Download, information and documentation can be found within the "game".
Someone say my name?
You can't add libraries unless you're using the desktop version of Quest.
...but you can use the built-in stuff to add an mp3 on an Android device (I assume it should be similar on iThing):
I created a new gamebook online:
I selected Page2 (which is where I will add a sound).
Changed the dropdown from "Text" to "Script + Text", then clicked "Add a script". (NOTE: I have to turn my phone so it is vertical to see the "OK" button during this step.)
Now to add the sound file.
First, click on "Choose file".
Then, select "Choose file" a second time.
At this point, it asked if wanted to allow Chrome to access a couple of things. I clicked "Deny" both times.
Then, I selected my audio file:
Now, my sound is set up to play when Page 2 is loaded, BUT it will probably not work on all devices.
Some phones (or tablets) only play ogg files, and some only play mp3 files.
A few months ago, my Android would not play sounds from a Quest game without adding HTML controls, but now it works perfectly. (NOTE: I just updated my phone today. That may have something to do with it.)
Here is the test game, if anyone would like to try it: http://play2.textadventures.co.uk/Play.aspx?id=editor/6100d753-4855-4702-8fb7-5bcb16cdba03%2fAdd+mp3+to+gb+via+mobile+editor.aslx
The only thing it does is play audio when you go to Page 2.
This works on my Android phone and in Firefox on a PC. (I doubt it works across all devices.)
If you'd like to get more technical with HTML and/or JS (to add controls or include backup formats), this should help you out:
Thanks for the kind words, Cheese!
From memory- audio doesn’t work on mobile devices. This (again from memory) is because phone hardware isn’t configured to auto play because it would hammer people’s data.
A month (or two) ago, 'Play a sound' scripts did not work in Quest games on my Android. Neither did an HTML audio element with autoplay. The only way to get audio to play in a Quest game on my Android was to add the controls to the HTML audio element.
Now it works without the controls, though. Well, the 'Play a sound' script does on my phone in the Chrome browser. I didn't test beyond that.
MP3 or WAV files are the only two formats that work with the 'Play a sound' script on my desktop in Quest.
We can use HTML audio tags to play MP3, OGG, or WAV files when using Chrome or Firefox. The only time I've seen MP3 not work was on a mobile device or a Linux machine, and that is because the format is (or was) not truly free to use. (NOTE: I've never used a Mac, but I hear the MP3 format doesn't work out of the box with them, either.)
This was written when neither Android nor iThing devices would play anything without the user actually pressing 'Play':
I believe things have been deregulated since then.
Yeah, I should have added the caveat that I was working off old info. Thanks for the update. I devoted considerable time into working out how to play multiple audio tracks a few years back. In the end it still seemed too unstable to be useful (the Quest implemented one on a loop I mean, not the html5 triggered ogg files, it didn’t always trigger).
With looping background sound there’s also the issue of saving the game, exiting and then loading again. It doesn’t automaticallly know which background sound should be playing; that all needs to be coded with a system of flags. In the end it got too much. It all works in theory though.