No MP3 Sound

Palacer
23 Jan 2015, 10:02
Using the desktop version under Windows XP (SP3)I have added a script to play an .mp3 sound effect after entering a room the first time but on running Play nothing is heard. The .mp3 file and Windows sound themselves are fine. Code view seems to show everything in order:

<object name="kitchen">
<inherit name="editor_room" />
<description type="script">
</description>
<enter type="script">
</enter>
<firstenter type="script">
play sound ("Crow_Call.mp3", false, false)
</firstenter>
<exit alias="north" to="room">
<inherit name="northdirection" />
</exit>
</object>

The .aslx file is attached. What needs to be done? Many thanks.

Silver
23 Jan 2015, 11:06
Is the sound file in your game directory?

Palacer
23 Jan 2015, 11:34
Thank you for checking. The .mp3 file is in the same game folder that contains the .aslix file.

Silver
23 Jan 2015, 11:42
Have you checked they're named exactly the same? Most of my problems of this nature has been me looking for a file called Thisfile.jpg which is actually called thisfile.jpg (this shouldn't be a problem if you've used the GUI to select the sound file though). And are you playing the game using the offline editor or playing online? If you've uploaded it and are playing it online you need to be aware that not all browsers support .mp3 files. Chrome, Safari and IE are the only ones that do.

Palacer
23 Jan 2015, 13:53
Good point but yes, the file is named Crow_Call.mp3 and was opened via the script's Browse function, so matches

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

I am using the desktop version of Quest under Windows XP (SP3), so presumably browser incompatibility isn't an issue.

I also tried instead of Before Entering... the alternative ready-made script variations Before entering/After entering/After leaving/After entering...first time but that didn't do the trick either.

BTW, I generated a published .quest version in the (unlikely) event that might make a difference but it too remains mute.

Silver
23 Jan 2015, 15:39
I'll need to be back at a PC to test this properly which will likely be tomorrow. Because I don't have access to your mp3 file I'll need to create a dummy to test the code. Unless someone else solves it before then.

Silver
23 Jan 2015, 15:42
Oh actually I may be able to do it. I'm about to embark on a long bus journey so I'll certainly have the time.

Silver
23 Jan 2015, 15:52
A thought I'm having now - which may well be wrong - is that if you've set it as entering room but it's the first room in the game you might not trigger the before entering script as you're already in the room when the game starts. That's easy to fix by creating a player start room as the first room in the game which just has a script which moves the player to the room where you want the player to start as its only function.

Palacer
23 Jan 2015, 16:08
Many thanks, Silver, for your further thoughts. The kitchen (where the .mp3 is supposed to sound) is the second room. It is south of the room where play starts.

Silver
23 Jan 2015, 16:52
Okay, I think I know what the issue is now after downloading and playing with your file. The code is absolutely fine. What happens with Quest though -- And it confused me despite me knowing about it -- is that if you change save locations Quest wont ever ever know that. I'm not saying that has happened but will you try something for me here? Instead of launching Quest and then clicking to edit your game file, could you instead go to your game directory and double click your game file to launch Quest that way? That's the only way to create a new directory path within the offline browser -- doing a 'save as' won't register it.

Silver
23 Jan 2015, 17:27
There's nothing wrong with the code. Which leaves the directory path issue, the browser, the mp3 file or your hardware left to look at.

Palacer
24 Jan 2015, 15:23
I am indebted to you, Silver, for all the trouble you've taken.

As to the path issue, one can specify a root folder for game saves (which subsequently contains also the Output folder) when installing, and Quest appears to copy into that designated folder extras such as .mp3 or .jpg files wherever they may be located elswhere.

Now here's an interesting thing. I started afresh with a different SFX, this time in the form of a .wav file. It worked perfectly. Then I substituted an .mp3 copy of the same file. Nothing. But as the .wav is 10.8MB and the .mp3 less than 1MB, that's rather an unwelcome workaround!

I just wonder whether there's a bug in my build of Quest, which I think is the latest:

Version 5.5.1
Build 5.5.5328.26623

Silver
24 Jan 2015, 15:30
I'm using 5.5.1 and your code worked fine (albeit with me swapping your .mp3 for one of mine following resolving the directory path rigmarole...)

Seems the code works for you now too. It's an absolute mystery to me why a .wav would play but an .mp3 not. The Quest app's internal browser is Chrome and the only issues I've had with that is when trying to play multiple sounds (a work around now exists, sort of).

So it remains a mystery. :? The only other thing I can think of it possibly being is a cache issue (I've had this online but not off) where the game still thinks it's pointing to an old file or bit of code. I'm guessing F5 works in the Quest browser as it would online? Or maybe not.

Edit: shift and F5 or ctrl and F5 whatever the combination is to update the cache.

Silver
24 Jan 2015, 15:40
Alternatively, rename the .mp3 file and try it again. Try and get into the habit of keeping file names all in lower case. So rename it to crowcall (I notice there's also an underscore, which shouldn't be an issue but I'd avoid symbols in file names too.)

Don't name it with the file name extension. I once had Quest not find intro.jpg until I renamed it to just intro (it was a .jpg file).

jaynabonne
24 Jan 2015, 17:11
Can you please post the .quest file or your game file? If not, I would try varying the sample rate, etc. See this:

http://stackoverflow.com/questions/9728 ... dio-player

The web browser used in the Quest desktop player is Chromium, if that helps at all.

Silver
24 Jan 2015, 17:17
He posted the ASLX file in the opening post...

jaynabonne
24 Jan 2015, 17:22
I would also look at this:

http://jplayer.org/latest/developer-guide/

Particularly, in the encoding section, for MP3:

MP3
Since some browsers use the Flash element of jPlayer, the MP3 files used must be encoded according to the browser's Adobe Flash Plugin limitations:

Constant Bitrate Encoded.
Sample Rate a multiple of 11,025Hz. ie., 22,050Hz and 44,100Hz are valid sample rates.


See if that helps.

jaynabonne
24 Jan 2015, 17:24

He posted the ASLX file in the opening post...



Yep, but the problem seems to be the audio file, not the game, since when you substituted one of yours or he switched to .wav, it worked. And I (at least) haven't seen that file yet. I suspect it's how the file is encoded.

If the .quest file has been posted online, we could download it and get the sound file out that way as well.

Silver
24 Jan 2015, 17:45
Oh right sorry, I misunderstood. I didn't know that to do with sample rates. Which is why I've been stuck thinking the issue has to be with some directory or filename issue.

Silver
24 Jan 2015, 17:48
I just auto compress to 44.1khz which is CD quality iirc.

jaynabonne
24 Jan 2015, 19:36
Yes, it is. :) And it seems to work ok for you, so that might be the trick.

Silver
24 Jan 2015, 21:02
Seems a good point to aim for. Some audiophile types (who I'd argue don't know what hey're talking about) reckon you can hear a difference between that and lossless stuff like flac wav or less compressed mp3. And using gold wires instead of copper ones. I'd say CD quality is the starting point then consider compressing more in terms of the web if file sizes are an issue. In terms of IF the last thing people are going to be looking at is the quality of audio samples: if they can actually even hear them.

Palacer
25 Jan 2015, 11:46
Many thanks to all for your advice and exchanges.

By way of belt and braces, I ran another conversion of the original .wav file in Audacity, selecting 44100 ( 44.1khz) as the bitrate. Again, the resulting .mp3 plays perfectly in VLC Media Player but not, alas, when referenced by the .aslx when played.

Just by way of an update, I'm uploading a slightly revised (tiny) .aslx. It has just three locations. The SFX named .chimes.mp3 is supposed to be heard after the player enters the Lobby. To recap, it works fine with the .wav, not with the .mp3.

If the .aslx passes muster in other respects and any forum member gets it working with their own .mp3 file, I would of course be grateful to know about it.

Silver
25 Jan 2015, 11:56
Again, it works fine for me when I substitute your .mp3 with one of mine. So there is nothing wrong with code. Can you publish it (get the .quest file I mean, not publish online) and post up that file like Jay suggested?

Palacer
25 Jan 2015, 12:20
Curiouser and curiouser!

Regrettably, when I try to attach the published 12MB .quest file, a pop-up states:

ERROR
Invalid file extension: NoSoundCheck.quest

Then I zipped it (though it stayed at 12MB) and got

ERROR
File too large: NoSoundCheck.zip

I think I've taken up enough of everyone's time. If my .aslx works with Silver's own .mp3, it must be a local problem - perhaps rooted in the desktop PC I'm using though I cannot comprehend what that might be. I'll run the .aslx again on my Windows XP (SP3) laptop and on another PC running Windows 7 and report back if I have any joy (or if I don't). My sincere thanks to all forum members who have contributed to this thread.

jaynabonne
25 Jan 2015, 12:24
If you do wish to make the .quest file available, you can upload it via the Create / upload file portion of the textadventures main site. You can mark the game as "Unlisted" so nobody will see it, but you can then hand out the URL to others to download the file.

(It is a pain what you can't upload to the forums. I know why, but still... it's a pain.)

And don't worry about taking up time. That's what we're here for. :)

Silver
25 Jan 2015, 12:24
You need to remove that huge .wav file from the game directory (quest will publish everything in the directory).

Silver
25 Jan 2015, 12:27
The forum may still reject a file with an mp3 in it though I suppose. Dropbox is another option.

Palacer
25 Jan 2015, 14:01
Have now uploaded - and guess what? The .mp3 file is heard correctly when the demo is played online:

http://textadventures.co.uk/games/view/ ... ound-check

I'm purely second guessing now but I can only think that Quest 5.5.1 (or the Chrome browser, if that is behind the scenes) references a codec for MP3s that isn't on my PC. For what it's worth, I have a stand-alone copy of the Chrome browser installed and it plays MP3s that are available to listen to online.

jaynabonne
25 Jan 2015, 14:13
Even more interesting: it works for me in *my* desktop Quest. :( Not sure what's going on.

Also, note that Chromium is not the same as Chrome, sadly.

jaynabonne
25 Jan 2015, 14:20
One thing I did notice: when the sound starts playing, I can't click on anything. (It's set to "Wait for sound to finish...") If I hit escape at that point to quit the game and then run it again, I'm still unable to click on anything, even though it's a new run. I have actually seen that before, where the player within the editor holds onto state in the background. I'd be curious to know if it works now for you (perhaps you have corrected a sample rate problem), but it was perhaps getting messed up by a previous instance still running. I know - grasping a bit here. If so, then just directly running the .quest file you uploaded should show one way or the other.

Silver
25 Jan 2015, 14:34
I think it was Pertex who said it was a Chrome browser... or maybe I read it wrong.

I was thinking codecs too. Have you tried it on another PC yet?

Silver
25 Jan 2015, 14:36
Jay I think initially he has it set to not wait and still had the issue.

jaynabonne
25 Jan 2015, 14:42
What I meant more was, if at some point the re-coded sound file would have worked but the internal Quest editor player was in a bad state from a previous run, then it might have still failed even though the file was now good. (An attempt to explain why it seems to be working everywhere else now - perhaps it works now for the OP as well.) A leap in the dark, I know, but... who knows. :)

Palacer
27 Jan 2015, 17:59
To summarise and update, neither the .aslx nor the published .quest files would play an .mp3 when called by a script but would play a .wav on my desktop Windowx XP (SP3).

Then I found that precisely the same occurred with my Windows XP (SP3) laptop. And that has a different installation of Windows XP (SP3) from the desktop: the first was factory installed, the other from a genuine installation disc.

But now I've found that with my second desktop PC installed with Windows 7, both the .aslx and .quest files play the .mp3 perfectly. And we already know that the .quest version behaves properly online.

It seems then that it is a Windows XP issue, which is a pity if it means that spot SFX or music in the form of desirably compact .mp3 files are not backwardly compatible with that release. Unless of course other forum members have run the sample .quest file (downloadable using the link given in a previous post) under Windows XP without any problem. If so, perhaps this is a puzzle that will never be solved...

Thanks again to all forum members who have contributed to this thread.

Silver
27 Jan 2015, 20:25
I don't know how audio works on that level. You already said that the audio played with VLC on those systems so I don't have an answer. One of the others might.

Silver
30 Jan 2015, 18:44
There's another way of testing this that we haven't looked at. You could try another game with an mp3 to see if that works.

Pertex
01 Feb 2015, 20:35
I just tested mp3 with Q5.6b and it still is not playing mp3s. So I did some internet research and found the following: Chromium, the browser component of the offline player doesn't support mp3. So our last change is that Alex will license the mp3 codec. Alex, you will do that, won't you? :D


Chromium Codec Support
As of February 2014, Chromium supports the following:
Vorbis audio codec
Theora video codec
Opus audio codec
VP8 video codec
VP9 video codec
PCM 8-bit unsigned integer
PCM 16-bit signed integer little endian
PCM 32-bit float little endian
Ogg container format
WebM container format
WAV container format

When building Google Chrome, the following codecs/containers are also included:
MP3 audio codec
AAC audio codec (Main only, not AAC-LC, AAC-SSR, HE-AAC)
H.264 video codec
MP4 container format


Silver
01 Feb 2015, 20:39
This is a joke. Why don't all browsers support mp3? It's the most widely distributed compressed audio filetype. Having to compress to ogg and other crap to cover all bases would just push up game file sizes and I've got better ways of spending my time.

Silver
01 Feb 2015, 20:41
Audio worked when I fired up 5.6 though despite the other problems I'm having...

Pertex
01 Feb 2015, 20:45
The Chrome browser supports mp3 but not the Chromium engine. As said you have to license the codec

You can play mp3 files in the offline version of Quest?

Silver
01 Feb 2015, 20:53
Yes. On 5.6 (and 5.5) I got audio. I was trying to find out if multiple audio would work using html5 but I had other issues.

Pertex
01 Feb 2015, 21:00
ah, yes, you can play mp3 with the build in command 'play sound' . I was talking of html5 support

Silver
01 Feb 2015, 21:27
Ah right, so that's not working then? Damn. That's what I was waiting for.

Alex
01 Feb 2015, 22:07
Interesting. Actually, the desktop version of Quest doesn't use Chromium for playing sounds - it uses the .net framework instead, so MP3s should be fine.

But I was thinking of making Quest use Chromium for sounds in v5.7... I guess that's not looking like such a good idea now.

Silver
01 Feb 2015, 22:44
That probably answers the op who is uing Windows xp - we all assumed Chromium dealt with the audio offline.

Silver
02 Feb 2015, 13:02
Alex wrote:Interesting. Actually, the desktop version of Quest doesn't use Chromium for playing sounds - it uses the .net framework instead, so MP3s should be fine.

But I was thinking of making Quest use Chromium for sounds in v5.7... I guess that's not looking like such a good idea now.


Does the .net framework not support multiple audio triggers then?

Alex
02 Feb 2015, 13:34
Probably, but I want any code I write for Quest to be cross-platform. I don't want to implement one feature for the desktop version and then have to re-implement it all over again a different way for the web version.

Silver
02 Feb 2015, 13:51
Ok. I think the answer is to use Chromium for audio and quit support for mp3 who are nickle and diming everyone. WebM looks like it covers most bases anyway. Don't know where that would leave backward compatability with games that have used mp3 though. Not sure how mp3 has even managed to be used without a licence for existing games tbh.

Silver
02 Feb 2015, 14:09
Hmm... as long as my sounds triggered with html5 are webM this should solve the problem with chromium for me now anyway. Have you tried this yet, Pertex?

Silver
02 Feb 2015, 14:43
Oh hang on... webm is video not audio. derr.

Silver
02 Feb 2015, 14:49
So I guess I mean Vorbis.

Pertex
02 Feb 2015, 16:11
Chromium Codec Support
As of February 2014, Chromium supports the following:
Vorbis audio codec
Theora video codec
Opus audio codec
VP8 video codec
VP9 video codec
PCM 8-bit unsigned integer
PCM 16-bit signed integer little endian
PCM 32-bit float little endian
Ogg container format
WebM container format
WAV container format

Silver
02 Feb 2015, 16:30
Yeah, I saw that. I'm gonna convert my html5-triggered samples over to that codec. But that means that the background looping audio will be mp3 and the rest will be Vorpis lol. Was just wondering if you'd tried it (I can't yet because 5.6 won't run properly until I do a re-install).

Silver
03 Feb 2015, 20:36
It totally works!! :lol:

As long as html5 triggered sounds are .ogg format it's all good in the offline browser now. 8)

Silver
03 Feb 2015, 21:28
Oh wow. The mp3 That I use as looping background audio is compatible with all browsers as it uses net framework so all browsers that are compatible with ogg are compatible. I'm half thinking whether I should put mp3 in with the html but all safari users have to do is install a plug-in for vorbis compatibility. Not sure about firefox. Who on earth uses that nowadays?