I could really use some advice
I need to load (and play) a large amount of audio data, for an app that relies heavily on audio tracks.
The project contains almost 1 hour of audio data and tracks range from 1 - 3 minutes. I know this much audio data seems like a lot, but it's for a health advice app, so the audio is a really vital part of the app.
I have tried loading the audio from the music folder, but there is always quite a noticeable lag between starting the track, and actually hearing it play (sometimes as much as 10-12 seconds).
I've also tried loading it from the sound folder, but the tracks are so large that they take forever to load. And, audio from the sound folder can't play until it's completely loaded.
Does anyone have any useful tips or suggestions on how we can achieve our goal.
Thanks for any advice you can offer
Are your audio files as small as possible - like instead of stereo mono, smallest bitrate, ...
Can you guess which audio file could be played next?
Thanks for your reply.
I'm using a sample rate of 44.1khz (required for C2 audio, I believe) with a bit depth of 16 bits. I've also reduced the size by setting the tracks to mono, rather than stereo. So I think they're as optimized as they can be, but it's still a lot of audio data.
Each track is linked to a separate page, and each page discusses a particular health issue. So I can tell when each track will be required.
I have tried loading each track a few pages before it was required. But with audio lag ranging anywhere from 6-12 seconds, this approach seemed to cause a few problems. Firstly, this approach still can't load the first track we require fast enough (so it's not ready when the first page loads). However, I had considered adding a controlled loader layout to overcome this problem.
Secondly I've tested on several mobile devices and each one handles the lag slightly differently (e.g. some devices play a track after 6-7 seconds and others take 10-12 seconds before the track is ready). This makes guessing when we should begin to load a track, quite difficult.
Thirdly, with so many tracks being loaded simultaneously (e.g. track 1 still buffering when I start to load track 2 for the next page etc.) some lower end devices just seem to give up all together, and crash the app.
It wouldn't be a problem if the C2 audio plugin could stream audio immediately (on mobile). But this lag issue is really throwing a spanner into the works.
Thanks again for the reply, if you have any useful ideas, I'm all ears
This is a problem I've had as well, and preloading the audio a screen or two before you want it is the way to go. Perhaps make a loading screen like you said, and make your own .ogg files in a program like Audacity so you can crank the bitrate way down? OGG format has very good compression and you can push it quite far before it sounds really bad.
Develop games in your browser. Powerful, performant & highly capable.
Thanks for the advice mikehive, I'll give it a try.
I'm also looking at other audio plugins, to see if any of them can deliver better/faster results.