Load music in the background (while game continues)?

Can I pre-load an MP3 for later playback without halting the game execution?

I have 4 music pieces I am rotating for playback. Loading just 1 of them during the start of the app feels OK, but loading all of them halts the game noticeably for some seconds. (I’m currently loading music pieces #2 - 4 after the end of the first game round, displaying the activity indicator during the delay, and compressing the MP3s to a medium-low quality, but that whole approach too isn’t optimal.)

Thanks for any help! [import]uid: 10284 topic_id: 11718 reply_id: 311718[/import]

did you try to make functions to load music? i used that for setup images
maybe something like:
function setUp_music()
–do your code here
end

then when you need it, just call setUp_music()

http://developer.anscamobile.com/code/sample-code-loop-background-music-synchronized-your-apps
check this also [import]uid: 16142 topic_id: 11718 reply_id: 42619[/import]

Darkconsoles, thanks, yes I do have caching and loading functions, but that doesn’t prevent the delay during the initial caching of the music right (or am I misunderstanding your suggestion? In my functions I’m using audio.loadSound() and then audio.play() to play the cached sound)? [import]uid: 10284 topic_id: 11718 reply_id: 42622[/import]

For music, you should not try to load the entire file into memory. That is a quick way to run out of memory on a device. Instead, you should use audio.loadStream().

[import]uid: 7563 topic_id: 11718 reply_id: 42715[/import]

Thanks Ewing, I will give this a try! [import]uid: 10284 topic_id: 11718 reply_id: 42783[/import]

Game runs smooth as a butterpie now, thanks so much! [import]uid: 10284 topic_id: 11718 reply_id: 42785[/import]