AGS 3.3 chopping voice OGG files?

Started by , Tue 19/08/2014 17:22:56

Previous topic - Next topic

m0ds

Hi guys, ags devs, I have a simple question that is plaguing our latest game.

It would seem that during the game, some of the voice OGG vorbis files will play about 3 seconds worth and then cut out. This happens with multiple lines, generally if they last longer than 4 or 5 seconds.

The fix I found so far is to keep them as WAV files*, but as soon as some of them become OGG files, AGS starts playing half of them but not the second half. Ie a line "This is a very big doorway, I wonder what's behind it" comes out as "This is a very big doorway, I wo..." and continues to display the text of the line.

Is there a known OGG issue? I've passed the game onto testers and it happens to them too. Could it simply be my ogg format? I've tried a couple of different settings. Perhaps audio channel settings within the game or something?

A possible issue is "stereo" ogg files, because when I switched them to mono, AGS seemed to either do it less often or stop (I can't quite remember).

Anyway, I'm using the same ogg files I always have (same hz, sample settings etc) and never had a problem in 3.2. But since moving up to 3.3 this problem has begun.

Any ideas/thoughts please? Many thanks :)

* Of course, this means large sized vox which isn't ideal for distribution.

Crimson Wizard

Have you tried running them as normal audio by Play command? Are they cut the same way then?
Do you use threaded audio in your project?
OGG player was patched by JJS, but I vaguely remember what was that; I need to refresh my memories.

selmiak

have you tried another converter when converting them from wav to ogg? VLC and SUPER are the first to come to mind, sadly these xiph guys don't recommend any converter, hopefully there are some more converters out there as ogg is the open source format. I don't know why, but sometimes changing small things works...

Baron

I think Ponch told me once that .ogg format messed up sometimes when the file size aligned with perfect increments of storage size, like exact multiples of 24Kb or something.  Try adding a fraction of dead air to the end of an offending track (or winnowing off a fraction) and see if it still messes up.

Crimson Wizard

Mods sais this started when they moved to 3.3 ...

BTW, have you actually tried to play these files in 3.2 project?

arj0n

@CW:
So could this be related to this post?

Changes since version 3.2.1:
* Fixed OGG speech ending prematurely if the audio file size is a multiple of 32 KB.



Crimson Wizard

Quote from: Arj0n on Wed 20/08/2014 14:24:39
Changes since version 3.2.1:
* Fixed OGG speech ending prematurely if the audio file size is a multiple of 32 KB.

Yes, that's what JJS did. But it sais "fixed" :).
Still waiting any answer from Mods.

BTW, since I am at it, Mods, can you send me one of the OGG files that fail to play?

m0ds

Thanks. You've all provided me a few new things to try, I'll let you know! :)

PS. No file sorry I'm still looking. I thought it was random and not line specific. Will try a couple of things suggested above first :)

m0ds

#8
Ok, so after various testing and hunting the issue down - I'm 99% certain it's the multiple of 32's causing this. All the broken files are multiples of 32 size. It doesn't matter if it's the size or size on disk, if one of those is a multiple of 32 - speech lines cut out. ie 56kb, 160kb, 256kb etc. All the non-multiples are working fine.

If I make it so they're a few kb less or more than the multiples, they work again.

I'm using AGS 3.3.0.

AGS Editor .NET (Build 3.3.0.1162)
v3.3.0, April 2014

We can only conclude that the supposed fix - isn't fixed? ??? Not sure why I'm experiencing this and no-one else has mentioned it, surprised it hasn't affected Golden Wake or other recent talkies etc but perhaps they're using a slightly older version, or some other format than ogg?

FYI - Two people have edited our lines (me and Arjon) and both used different conversion tools, yet both sets of lines have some at multiples of 32 and they cut out, so that rules out the conversion software pretty thoroughly.

Out of curiosity - what could've happened to the OGG decoder to make it do this now and not in previous versions?

Crimson Wizard

Hmm, I can take a look at this, although to be honest this will be the first time I see OGG running code.

Can you send me any file that causes this?

m0ds


Crimson Wizard

#11
The sound is cut only when the OGG is used for a speech. When played as normal sound it works fine. There's a technical difference in how these two types are processed internally (speech is being streamed, not preloaded), so this may have explanation.
The speech is cut both in 3.3.0 and 3.2.1. This means that whatever JJS was fixing he did not fix that to the end.

EDIT: hmm, this might not be related to what JJS was fixing. It appears the OGG playing library is returning error on that last chunk of sound... Some further investigation needed.

EDIT2: I sort of misread information about multiple of 32. JJS was fixing a problem with OGGs which size was multiple of 32 Kilobytes (32768 bytes). There was nothing made regarding multiple of 32 bytes.
I am not sure what's going on there yet. I can only tell that on some point, when there's 320 bytes left in the OGG stream, the OGG player returns error. Unfortunately, AGS does not checks errors in this case and the speech "hangs" for unlimited time (not really playing anything), until user clicks button to skip it. At least that's what is happening to me.

EDIT3: Interesting fact. I increased the streaming buffer, making it equal to the file size under examination, and it played flawlessly to the end.
The error OGG were returning is "buffer underrun" which means that it can't find all data it wants. It looks like there may be a byte sequence that OGG player treats as incomplete and "stumbles" over it.

m0ds

Thanks. Yes, they hang infinitely for us too.

I kind of understand what you're saying. Can we expect a fix anytime, or should I go ahead and use the workaround? Is there any way we can increase the 'streaming buffer' our end?

It wouldn't surprise me if we're using longer lines of text and speech than various other games with speech at the moment hence why we've suffered it but no-one else has. It's typically only the longer lines that are affected.

Crimson Wizard

#13
I do not know how to fix this properly yet. I never worked with OGG streaming. This probably should be simple, but library documentation is somewhat lacking.
So far I managed to force it play further in case of error and read remaining piece of file. It almost worked, but there is a noticeable jump a fraction of second in length.

And, no, there's no way to change the size of buffer game properties, or script atm.

Quote from: Mods on Wed 10/09/2014 14:10:00
It wouldn't surprise me if we're using longer lines of text and speech than various other games with speech at the moment hence why we've suffered it but no-one else has. It's typically only the longer lines that are affected.
Hmm, maybe it is length that matters, rather than size multiplier?

m0ds

I can't imagine so, there are far longer lines than the broken ones which work just fine. It just seems to happen to the lines that are longer than a single sentence, and like I say, they're all multiples of 32 in size whether that's a cause or just co-incidence.

m0ds

#15
Edit. Ok, yes, you're right. It seems to happen in 3.2 also.

Crimson Wizard

#16
Are you sure it is not happening to previous versions?
As I wrote earlier, I have tested the OGG you sent me in 3.2.1 and got same results.
This is important to clarify.

If you can confirm that 3.2.1 works well with your OGGs, I could make a set of builds from various stages of development and see when it started to fail.

E: Just tested with 3.2.0, it cuts off too.
E2: Tested with 2.72 and it cuts off too...

m0ds

#17
Sure, you're right. It occurs with other versions. Back to the drawing board...

One of the most perplexing mysteries ever for me...!! Sorry I grumbled about 3.3 but you're right, there must be something else to it.

Something about my PC... because OGG files encoded by me on this PC and encoded by Arjon in NL have had this problem, so something about it compiling on my crap old PC perhaps...? hm But then it can't be that if you're able to reproduce the error in a project file for yourself. So weird :=

Crimson Wizard

I wish I knew! Last time I was investigating this I left with feeling that there's a bug in ogg library AGS is using.
It has something to do with OGG stream fractioning, because when I made the size of buffer equal to the size of file, this error did not occur.
I am interested to see how the Linux port works because it should be using more recent versions of the libraries.
In the very last case we could add a hack, some option in config perhaps, that would force OGG player to always load whole speech file in the large buffer...

SpeechCenter

The problem is that ov_read returns 0 even though it's not the end of file.
Indeed this is likely a bug in libvorbis. Check out https://bugzilla.redhat.com/show_bug.cgi?id=505610 reporting similar behavior. So if the Linux library uses libvorbis-1.2.2 or above it's likely to not reproduce there. Alternatively, update the library in Windows and see if it works.


SMF spam blocked by CleanTalk