Sounds from elsewhere. [SOLVED]

Can Quest play sounds that I have hosted elsewhere so it doesn't count against the game size limit?

For example, is there a way to put a URL where it says "sound.mp3" below and get it to play? I couldn't find this question answered after searching for quite awhile.

play sound ("sound.mp3", false, true)

Thanks in advance!


Why don't you just try it out?

play sound ("http://www.yourserver.com/sound.mp3", false, true)

It unfortunately doesn't work. Is it not supported?

Thanks!


You can use an HTML audio tag.

msg ("<audio src='http://media.textadventures.co.uk/games/1RurGHLuLUqrWdMJh53LTQ/bushcave-explicit-r9/sounds/bushcave.ogg' controls autoplay>")

You can remove the controls to keep the ...um... controls from displaying.

...and you can remove autoplay, but I wouldn't if the controls aren't displayed.

You can add loop next to autoplay and controls, if you wish.


This will not give you the option to pause play until the audio has finished (but we could probably improvise, if you'd like that option).


Okay...

I've created a function to do this that acts just like play audio when I set sync to true (which doesn't let the player do anything until the sound is over).

Check it out here:

http://textadventures.co.uk/forum/samples/topic/mkb_cnnzueibdlwpw9uceq/htmlaudiolib


Whoa, you, like, just did this? That's amazing!

2 more questions:

  1. does this work in gamebook mode as well?

  2. I've got about 300 pages written in my gamebook (it's an open world RPG gamebook) and have been deathly afraid of updating to new versions of quest. If I update to 5.7.2 am I 100% safe? I have version 5.6.3.

I know the gamebook mode isn't really thought much of around here. I just want to make sure the new version has at least has the same functionality!

Thanks in advance!


Give me about another hour before you add that library to anything. (It has already been vastly improved since the last post.)


That is not in Quest 5.7.2. It's just a library I made. (I'm just this dude who bores easily and likes to help.)

...but, if you were to update to 5.7.2 and find that something is messed up in your game, you could just uninstall and reinstall 5.6.3 (which is always available for download).

You should definitely make a backup copy of your game file first, just to be safe, but I don't think anything in a gamebook would be at risk, unless you've got some built-in functions overridden or something of that nature.


If anyone would like to speed the audio library's process along, you could do a quick check to see if you can listen to the sound when this game loads in your browser:

http://textadventures.co.uk/games/view/3udtmtkznugf154eydsakg/playaudiolib-tester


It works in Chrome, Firefox, Edge, and Internet Explorer on Windows 10, and all of those except Edge on Windows 7 (because Edge is not on WIndows 7).

On Samsung:

Galaxy S3, S6, and Tab 2: Works in Chrome and the stock browser.


I have not tested any in any other browsers or on any other operating systems.


UPDATE: I just got a report that it works on an iPad.


If playing on a mobile device, you should see controls appear. This is because audio files must be played manually on mobile devices (for some reason, which is unbeknownst to me). In this case, you'll have to press 'play' (of course).


Thanks!


Give me about another hour a while before you add that library to anything. (It has already been vastly improved since the last post.)


That is not in Quest 5.7.2. It's just a library I made. (I'm just this dude who bores easily and likes to help.)

...but, if you were to update to 5.7.2 and find that something is messed up in your game, you could just uninstall and reinstall 5.6.3 (which is always available for download).

You should definitely make a backup copy of your game file first, just to be safe, but I don't think anything in a gamebook would be at risk, unless you've got some built-in functions overridden or something of that nature.


Thank god for bored, helpful dudes.


You came up with the idea! So, thanks to you, too!


There are two problems with what I've posted so far.

1. If you play a looped sound, clearing the screen will stop the sound.

2. The sync option isn't up to par.


I've got some crazy stuff going on when the player is on a mobile device, and it involves the command bar (sort of).

I am SO glad you mentioned a gamebook! I need to test that out real fast (or "very quickly", if you prefer proper English).

After I successfully test out the gamebook on a mobile device, I shall unleash the new code. (Fingers crossed.)

Until then, you can use what I've posted as long as you don't want to pause play until the sound has finished OR have sounds continue playing when clearing the screen.


Okay...

I only need to figure out how to check if the game is a gamebook.


UPDATE

Got it.

if (not HasAttribute(game,"noclear")){
  // Not a gamebook!
}

Quick Q: do I add that to any page that has sound?

Otherwise, awesome. Lemme give everything a try on my end, I'll check back in! Really appreciate it.


Hello!

I'm sorry about the lack of response! There was more stuff to add than I'd realized, and I've been hard at it!

My last post was just me talking to myself (and knowing someone would correct me if I was mistaken). It does not matter if you're making a gamebook or a text adventure now. I fixed that issue.


This is thoroughly untested. I don't know if I've mentioned that...

http://textadventures.co.uk/games/view/phvys9dicuimsspr_m9wyq/audiovideolib

The BIG thing is: The desktop player will not play .mp3 files when using an HTML audio tag (which is what we're doing when we use the functions in this library).

Something about Chromium not including the mp3 format because it is not actually free to use:
http://www.chromium.org/audio-video

...and the desktop version of Quest is running an embedded Chromium browser, so: no mp3 functionality there. This, I believe, is why Alex added the play sound script in the first place.

So, I include an ogg file for desktop players, along with the mp3.

(You can use Audacity or ffmpeg (each are free) for all of your audio creation/conversion needs, by the way.)


Why not just use the ogg format, you ask? Because I'm not sure if that will play on iStuff. (I have no iStuff, nor do I have a Mac. So, I can't test that without troubling someone.)


Anyway...

To simply play a sound from a local file:

PlayAudio ("announcement.ogg;announcement.mp3")

Notice how I have two, separated by ;? This is because one file is a backup which will play if the browser does not support the other's format.

If I had those sounds hosted online, it would be:

PlayAudio("https://thehost.com/sound.ogg;https://thehost.com/sound.mp3")

PlayAudio(src) just plays a song throughout its entirety, even if you clear the screen or the player goes to a new page in the game.

To play a looped sound, use: PlayAudioLooped(src).

To stop all sounds, use: DestroyAllAudio.


NOTE: Quest will not include .ogg files unless you add that format to game.publishfileextensions!!!

image


Actual documentation coming very soon!


This is awesome K.V. I haven't had a chance to tinker with it yet, but am going to in the next few days. I'm also looking forward to the documentation. Did you just invent PlayAudio for this very purpose? I don't remember that being a thing.

I'll check back in soon and let you know how it goes (for me) and add a [SOLVED] tag when it invariably works perfectly!

My openworld RPG gamebook is freaking huge, and I've been scared about how to host sound and pictures elsewhere so I can fit it under the kb limit. This will change everything for me.

Love to you and yours.


I've still been working on it and this library seems to be the best I've cooked up for the desktop version.

https://github.com/KVonGit/AudioLib/wiki/Documentation


screenshot1


screenshot2


screenshot3


I'm still working on the easiest way for the online users to add these functions via the web editor, and I've got help, so it shouldn't be long.


Hi, K.V.!


Is there a place to access Attributes of game.whatever, like, for instance, game.publishfileextensions in gamebook mode (so I can tell it play my sweet, sweet .ogg files?)


In gamebook mode only three, sad tabs come up when you click on 'game,' and I've exclusively been having to add all my 'extra' stuff to 'Script.'



Go to full code view and past this line in exactly the same place pictured in this last screenshot:

<publishfileextensions>*.jpg;*.jpeg;*.png;*.gif;*.js;*.wav;*.mp3;*.htm;*.html;*.svg;*.ogg</publishfileextensions>

image


image


image


EDIT: Posted at the same time. That post ↑ is probably a better solution unless you often want to change attributes.

In gamebook mode only three, sad tabs come up when you click on 'game,' and I've exclusively been having to add all my 'extra' stuff to 'Script.'

Not sure if there's a place by default; but you can add it.
If you find the file GamebookCoreEditor.aslx somewhere in your quest directory, and open it in notepad/vi/whatever text editor you prefer.

Look for this bit:

    <tab>
      <caption>Script</caption>
      <advanced/>

      <control>
        <controltype>script</controltype>
        <caption>Script when entering page</caption>
        <attribute>roomenter</attribute>
      </control>
    </tab>

(that tells Quest to display the 'script' tab)
and after that, you can add a new tab:

    <tab>
      <caption>Attributes</caption>
      <advanced/>
      <control>
        <controltype>attributes</controltype>
        <expand/>
      </control>
    </tab>

You should now have an 'Attributes' tab :D

(make a backup copy of core files before editing them, just in case something goes wrong)


Brilliant, mrangel!


To permanently add the tab to gamebooks


If running 32 bit Windows, the file GamebookCoreEditor.aslx is in C:\Program Files\Quest 5\Core.

If running 64 bit, it is in C:\Program Files (x86)\Quest 5\Core.


PROCEED AT YOUR OWN RISK!

FOOLING AROUND WITH FILES IN WINDOWS' PROGRAM FOLDERS MAY CAUSE SERIOUS PROBLEMS!!!


  • Make a backup copy of the file first!

  • Open the file in a text editor

  • Add this code (as posted by mrangel), starting at line 453:

    <tab>
      <caption>Attributes</caption>
      <advanced/>
      <control>
        <controltype>attributes</controltype>
        <expand/>
      </control>
    </tab>
  • Save the file.

  • Close Quest, then open it back up, and we have:

image


I'm leaving the paragraph below (that I was about to post) for anyone who might run into the same problem. A (pretty stupid-seeming) workaround if you're getting 'Access Denied' messages is to save the file as something else (like a .txt file) and then manually renaming the file extension back to .aslx


I keep getting told 'Access Denied' (I'm on Windows 8.1) when I try to save my new GamebookCoreEditor.aslx. I took the entire Quest 5 folder out of Read Only (including all subfolders and files) and then specifically gave myself full administrator access to GamebookCoreEditor.aslx, and it's still saying "Access Denied" when I try to save it.
Any ideas?


2 questions:

PlayAudioLib seems to have disappeared from github. Is that temporary?

Where do I actually add the library?


I'm sorry. I thought I'd updated all the links when I changed the name.

https://github.com/KVonGit/AudioVideoLib/wiki/Adding-the-Library-to-Your-Game

https://github.com/KVonGit/AudioVideoLib/wiki/Instructions-for-Desktop-Users


Oh, and I made a 'WARNINGS' page, too:

https://github.com/KVonGit/AudioVideoLib/wiki/WARNINGS


I took the entire Quest 5 folder out of Read Only

Sorry, I should have warned against this up front.

I always try to avoid moving anything from a "Program Files" directory at all. Windows will more than likely throw a fit 99% of the time.

I might edit a file in there, or add a file, but moving things out usually doesn't turn out very well. (Copying is a totally different story.)


'Access Denied'

Terribly sorry about that (again)!

I use Notepad++, and it just asks if I'd like to save the file as an administrator. So, I'm spoiled now, and I forget about all the old problems like that.


If you only have Notepad, you can:

  • Make a backup copy of GamebookCoreEditor.aslx before doing anything

  • Open a new file in Notepad

  • Right-click on GamebookCoreEditor.aslx and open it with Notepad. (You will now have 2 instances of Notepad open.)

  • Select all the text in GamebookCoreEditor.aslx and copy it

  • Switch to the Notepad with the blank document, and paste the text from **GamebookCoreEditor.aslx into it.

  • Close **GamebookCoreEditor.aslx.

  • Save your new file as **GamebookCoreEditor.aslx, but save it into your "Documents" folder.

  • Copy the new file from your "Documents" folder to your "Core" folder in the Quest directory. It will ask about overwriting and doing it as an administrator. Just say "yes".


Holy moly. I hope you're a paid technical writer because these are some seriously clear and dumb-people-friendly instructions. I'll check back in when I invariably have amazing success. :)

Thanks for taking the time, I truly appreciate it.


Just a quick note for Gamebook mode users. 'Add' from the top menu only has these options:





Instead, you can do it from 'Advanced' and 'Included Libraries' on the folder tree on the left!



@K.V.

When you say on the WARNINGS page that autoplay for play sound doesn't work on mobile, do you mean now that we have the new AudioVideoLib installed, or do you mean autoplay never worked on mobile?


By the way, I just finally tested it all in depth and except for the question above (working on mobile), it works like a charm --- even in gamebook mode. I'm putting [solved] up in the title even though I'll probably have a couple more small questions.

Thanks so much, K.V. For real. <3


play sound does not work on mobile, whether or not you have my library included.

The only reason my functions work on mobile is because I add the controls when Quest finds an element which only exists when playing on a mobile browser.

Mobile browsers just don't do autoplay, on Android or iStuff. Something about the "user experience" and SPAM. The user must press 'Play' for sounds to work.


I hope it all goes well, MP!

I updated the page about adding the library , showing how to add the library from the object tree. Sorry you ran into so many problems, but thank you for helping improve the code!


the 'access denied' is just that the folder location is protected/blocked for a normal user account in being UN-able to mess with it's contents/files (you need to have/use administrative priviledges, know admin account password, or be on an admin account, on your computer), it's a good security feature that was implemented around the XP/Vista computer era, but it also causes quite some hassles too, lol.

https://en.wikipedia.org/wiki/User_Account_Control (UAC)

google search your OS, for example: windows 8 UAC, to learn more about it for that OS


Hey, does anyone know of a good site to use to host audio files?

A fellow forumer asked this, and I always just include my audio files with the game, so I have no clue what to suggest.


Audio files take up more space than images (other than gifs), so it's a good question.


I suppose on alternative would be to find a free php hosting site, make a front end page for visitors then stash your sounds there.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums