Update on slow audio - Need your help!

Discussion and feedback on Construct 2

Post » Mon Mar 09, 2015 10:49 pm

I've heard good things about Opus (pun intended?) and it seems the most likely candidate for the one format that plays everywhere somewhere in the distant future, so I hope we can move to it eventually... but right now adding a third format in to the mix doesn't add much!
Scirra Founder
B
378
S
220
G
84
Posts: 23,868
Reputation: 188,111

Post » Tue Mar 10, 2015 7:43 pm

@Ashley

Over on the chromium bug report for this issue, rtoy brought up the following issue:

One additional item that can cause slow decoding. If the sample rate of the encoded audio files does not match the sample rate of the AudioContext, the audio file is resampled to the sample rate of the context. A high quality sinc resampler is used for this and can consume quite a bit of CPU.

So for those who reported slow decoding using the example URL, it would be good to know what the context sample rate was. (You can go to http://rtoy.github.io/webaudio-hacks/tests/osc.html which plays a tone and also displays the context sample rate.)


Could you work up a new version of the audio decoding test with 44.1khz and 48khz samples, so that test takers can eval both?
Don't lose your work. Backup your game with Dropbox.
B
43
S
10
G
10
Posts: 1,106
Reputation: 9,157

Post » Fri Apr 24, 2015 1:50 pm

Any updates on this? Will this be fixed soon?
How do other games/apps deal with it (the ones that are not made in C2)? Why do they load almost instantly (e.g. Red Ball 4)?
“The best time to plant a tree is 20 years ago. The second best time is now.”
B
31
S
7
G
4
Posts: 382
Reputation: 4,528

Post » Fri May 01, 2015 8:34 pm

grigrizljac wrote:Any updates on this? Will this be fixed soon?
How do other games/apps deal with it (the ones that are not made in C2)? Why do they load almost instantly (e.g. Red Ball 4)?


Not as far as I know. One of two major issues with audio in C2, the other being that we have no good way of manually clearing decoded audio out of memory, which can lead to a big pileup of decoded audio in ram (which doesn't always empty at the most opportune times).
Don't lose your work. Backup your game with Dropbox.
B
43
S
10
G
10
Posts: 1,106
Reputation: 9,157

Post » Fri May 01, 2015 10:53 pm

TiAm wrote:(which doesn't always empty at the most opportune times).

are you saying it does empty at some point? I thought all audio stayed loaded throughout the game.
B
75
S
26
G
13
Posts: 1,083
Reputation: 13,688

Post » Sat May 02, 2015 12:14 am

Pretty sure audio can be garbage collected just like anything else. But we ought to be able to indicate good times to do that...like in-between levels. ;)
Don't lose your work. Backup your game with Dropbox.
B
43
S
10
G
10
Posts: 1,106
Reputation: 9,157

Post » Sat May 02, 2015 1:02 am

it would be nice if sfx audio was only loaded into memory only if it is used in a particular layout and then upon ending the layout it was unloaded from memory. Although you should be able to make your audio global as well - in that case it would stay loaded the uptime of the entire game.

to actually have a "free" or unload Action is probably more than most need...and would be a little out of place since there are currently no other memory management actions in C2.
B
75
S
26
G
13
Posts: 1,083
Reputation: 13,688

Post » Sat May 02, 2015 2:21 am

Well, you can accomplish deferred decoding thru setting 'preload sounds' to 'false', and using the 'preload audio' action to load in only the sounds you need, avoiding the delay that occurs if you try to play an un-decoded sound. Personally, I would consider this a 'memory management action'.

However, we have no tools or options for unloading decoded audio. As you said, we should at least be able to unload audio at the end of layouts.

Personally, this hasn't been a problem for me, but my mobile projects have been on a small scale, with minimal audio. I could see it being a problem for a more ambitious/audio-rich project. Case in point: I became aware of this from posts by Tinimations about Klang, which isn't even a mobile game.

Anyway, returning to the thread subject, I think the sluggishness of decoding is an even bigger problem for most mobile games...who wants to wait a minute or more for a simple game to load?
Don't lose your work. Backup your game with Dropbox.
B
43
S
10
G
10
Posts: 1,106
Reputation: 9,157

Post » Mon May 04, 2015 11:53 am

What happens if you put all the sound into the Music folder? Then it decodes while playing - no need to wait. But idk how is that with sounds... You can try that...
“The best time to plant a tree is 20 years ago. The second best time is now.”
B
31
S
7
G
4
Posts: 382
Reputation: 4,528

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 12 guests