Audio Doesn't Work On Some Machines

When I test my game on my own PC and whenever I've checked with friends, audio always functions properly. However, a very small handful of people have reported that audio in my game doesn't work for them. (For a better idea, hundreds of people play my game but only two have come forward with this issue.)

Are there any troubleshooting questions that I can ask the user(s) who experience this issue? Should they reinstall Quest, or are there other software/driver issues that might be involved?

FYI, this is using the desktop version of the game with the latest client.


Hello.

Is the audio included in the game, or are you pulling it from online somewhere?

If it's not actually included in the game, there might be issues connecting to it online for some people?


If everyone is using the same installed version of Quest and their PC's audio works for everything else, I can't think of anything that could mess it up if the audio files are packaged with the game..

If some people are playing the game online, different browsers handle different types of audio files differently -- and sometimes not at all -- and sometimes on mobile you have to have code to handle the whole autoplay thing.

https://docs.textadventures.co.uk/quest/adding_sounds.html

Specifically:

https://docs.textadventures.co.uk/quest/adding_sounds.html#browser-compatibility


Because of the headache known as "cross-browser compatibility", I have to advise against adding audio (or video) to games.

(I tried to fight it. I really did. I tried to find some code that always handles everything, and I sort of did a couple of times. Then, the dirty dogs updated the browsers and messed it all up! TWICE!!!)


Yeah, sound has definitely been a bit of a pain; I've had to completely disable it when players are playing the game through their browser. It's just too much of a hassle to keep up with. I actually thought this might be the issue too, but my game also hides the sound enabler/disabler object if it detects a browser, and the users with the issue can still see this object.

To answer your question, I have my audio files compiled into the game, so they're all included. I have both MP3 and OGG versions because I had tried to use browsers before. I confirmed that they're not using the online browser as well, and the issue persists after reinstalling the client.


Well, you're definitely "in the know" concerning most of what I know about this.

Hrmm...

How are you detecting the browser? Quest has Chrome 39 in it (if you haven't already found that). I just check for Chrome 39, otherwise "no soup for you!"

...but we have to do that via ASLEvent (unless you've found a different way; if so, please share!?!), and that means there's around 3 second delay between JS and Quest. Sometimes, having such things in my code makes my game behave ... or misbehave, as it were ... unexpectedly.

I tried and tried (and tried) to make audio work across the board. Finally, I decided [EXPLETIVE DELETED] it. These are text adventures, after all, and I'm only working with text henceforth.

In Quest (and all other IF software which can produce games that can be played online), I've (sadly) learned that doing anything besides just outputting some text is asking for trouble.


Back to the issue, though . . .

I don't know, especially without seeing the code that decides whether or not the browser is worthy of handling the audio. Maybe the problem is somewhere in that code?


PS

You might have someone experiencing the issue open their HTML Developer Tools window in Quest while experiencing the issue and see if the console shows any errors.


The way I do it is this:

if (GetFileURL("blurgh").StartsWith("quest://")) {
    Sound System.enabled = true
    MakeObjectVisible (Sound System)
}
else {
    Sound System.enabled = false
    MakeObjectInvisible (Sound System)
}

This seems to work for me. I do that check at the start, and then I play sounds only if Sound System.enabled is true. "blurgh" can be anything supposedly, but it always seems to work. With this system in place, the user is seeing the Sound System but they can't hear the sounds, so that's why I didn't think this was the issue.

I got them to try the HTML Developer Tools as well, and the console remained blank for them.


I DO get the following error in my debug.log when I open my game:

[0521/152629:ERROR:renderer_main.cc(207)] Running without renderer sandbox

Though, this is while I am hearing sounds in my game, so I'm not sure if it's related.


Hmmmm...

To debug, I would add a msg("ATTEMPTING TO PLAY AUDIO") in whatever code plays some audio. See if that shows up on their screen.

If you really trust someone with the issue, maybe send them all your game's files and let them run the game from the editor -- where they can use Quest's debugger to check stuff out during play.


Also, I've heard of people downloading Quest and something corrupting the download which resulted in a Quest installation with missing files.

...but you said:

and the issue persists after reinstalling the client.

I wonder if they reinstalled from the same downloaded installer? Or if they downloaded it again before reinstalling? (Just taking shots in the dark here.)


Unfortunately, it doesn't seem like they have the know-how to use the debugger. They also reinstalled Quest using a fresh installer.

It also looks like I made my last post at the same time as yours, so you might have missed it. I'm not sure if it's connected, though.


Huh.

Maybe try putting an onerror in the audio tag?

https://www.w3schools.com/Tags/ref_av_dom.asp

Maybe something when it thinks it's playing the audio, too?

(I like to add debugging messages everywhere to figure out what the heck is happening.)


[0521/152629:ERROR:renderer_main.cc(207)] Running without renderer sandbox

I don't have a clue what that means.

Maybe someone else around here does. Here's a forum thread concerning this that says solved:
https://textadventures.co.uk/forum/quest/topic/-llotqtbe0iab7tafz9zvw/quest-offline-reader-reader-stuck-on-first-page-solved#dad8d7ec-b3dc-48bc-a1ef-cb4d1ad6dcbb

I started to guess this earlier. What sort of Windows user privileges do the people experience audio issues have?

Wait... I just now realized you said that's your machine with that error, and your machine plays the audio files properly.

Hrmm...


Where would I put onerror? When I play a sound, I usually do something like:

OutputTextNoBr ("<audio autoplay><source src=\"" + GetFileURL("Sound.ogg") + "\" type=\"audio/ogg\" /><source src=\"" + GetFileURL("Sound.mp3") + "\" type=\"audio/mp3\"/></audio>")

And yeah, I saw that thread as well and tried launching Quest in administrator mode. The error still remained in the debug.log, but I can't say that's actually causing any issues.


I think what matters is that the Windows account can run things as Administrator. I don't think running Quest as Administrator would change anything, but if a user can't run things as Administrator that usually means their Windows user account won't let apps do certain things (like maybe interact with the system to play audio, but I have no proof of this).


...and hold on. Let me go test out the code with onerror before I share any ideas. (Don't wanna inadvertently send you on any wild goose chases.) Be right back.


Huh...

When I create a new game, with no audio files whatsoever, and I paste your code into a script to run on the first room's enter script, it doesn't throw any errors at all, even after I add onerror everywhere (even places it probably doesn't belong).

It is printing the element, though. It's there. I can target it with jQuery and everything.


EDIT If anyone saw the bit about seeing double, I was just calling the script twice because I'm silly.


Okay...

If my game is called "foo", after I publish, the output game file is called "foo.quest".

If you rename that to "foo.zip", you can unzip the archive to see if the audio files are actually in there. Make sure you rename to "foo.quest" before trying to play the game again, though! :)

I mean, they should be automatically put in there if .ogg and .mp3, but I'm just checking things off the list.


PS

This won't really solve anything, but if you're only allowing desktop users to hear the audio, you may as well only include the .ogg and change the code to this:

OutputTextNoBr ("<audio id='audio-div' autoplay src=\"" + GetFileURL("Sound.ogg") + "\" />")

It still just doesn't play sound if the file name doesn't point to an actual file, with no errors anywhere.

It is shorter, though, and it saves the space of having the .mp3 included.


Can the people play your sound files on their system? I mean without Quest?


I did a little more testing with him and I've narrowed down the issue. He is able to play all the sounds when I send the files outside of Quest (both MP3 and OGG). However, when I send him an audio test as a Quest game, he only hears sounds when they are played as MP3's but NOT when they are OGG's.

Since his computer is playing the same OGG files fine outside of Quest, is there anything he can do to get them to play inside of Quest? Or will I need to sort out some kind of workaround?


Audio is a little confusing even when there aren't any issues.

As far as I understand it:

  • The play sound script in Quest will only play WAV or MP3.
  • When using HTML audio tags in Quest, the browser will only play WAV or OGG. (Chrome 39 had no MP3 support.)

Having said that, are you playing MP3 audio via play audio script in that game?


Ah, yes, MP3's are the ones he is hearing and they are the ones I am using with play sound. I've been using that for the BGM's, then I've been playing sound effects over that with the HTML that I showed earlier:

"<audio autoplay><source src=\"" + GetFileURL("Sound1.ogg") + "\" type=\"audio/ogg\" /><source src=\"" + GetFileURL("Sound1.mp3") + "\" type=\"audio/mp3\"/></audio>"

It's weird that I can hear the OGG sounds when played as an HTML audio tag, but I suppose that if I want everyone to hear them, I should use WAV for that instead?


The AUDIO tag should be able to handle OGG or WAV. If it can play one, it should be able to play the other.

I would wonder if Chrome 39 simply doesn't like your OGG for some reason, but if it plays in one Quest 5.8 installation, it should play in all of them, as they are all just Chrome 39.

Hrmm...

Does your game ever clear the screen?


Alternatively, if you send me a link to your game, I can look at it and test things rather than making all these (slightly) educated guesses and you having to test out each of my guesses.


Yes, my game clears the screen each time you enter a new room, so there usually shouldn't be a bunch of clutter lagging everything out. This issue was also happening 100% of the time for OGG sounds in his client, and 0% of the time for me.

I'm not sure why his machine was having issues with playing OGG files in Quest, but I switched everything over to WAV and it's been working swimmingly for both myself and him. Perhaps this is the best fix? It doesn't seem to have any repercussions so far.


I switched everything over to WAV and it's been working swimmingly for both myself and him. Perhaps this is the best fix? It doesn't seem to have any repercussions so far.

As long as you're not exceeding the file size limit, I would say you're good. WAV is better quality than OGG, anyway.


If you add an HTML audio element via msg(), clearing the screen afterwards will remove that element, thus deleting/stopping the audio.

...unless you happen to have the transcript on, in which case I'm not sure what would happen, because it doesn't actually clear the screen when the transcript is on; it just hides all the old elements.

I wonder if playing the game differently results in the screen being cleared at different times?

BUT, if it works now, don't listen to me. I'm just not convinced the OGG format is the issue, especially if his PC plays OGG outside of Quest. Like they say, though: if it ain't broke, don't fix it!


PS

In the future, you might give my AudioVideoLib library a shot:

https://github.com/KVonGit/Quest5-Stuff/wiki/AudioVideoLib---Adding-the-library-to-your-game


It adds audio or video elements via JS rather than just adding an HTML element (sometimes), which will allow a sound to continue living after a ClearScreen (by default, and there is no way to change that).

There is documentation, too:

https://github.com/KVonGit/Quest5-Stuff/wiki/AudioVideoLib---Documentation


I honestly wouldn't mess with your current game, if I were you. "If it ain't broke, don't fix it!"


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

Support

Forums