iOS 5 New Sound and Music Problems!!!

Hi,

Well the question is the my app is ready on the app store now since just a few days and preparing for the Press Release, but after update to the iOS5 the app does not woks well with the sounds and music. I did report the bug too, but really need a solution soon, please.

The bug report:

The same app binary after update to iOS 5 then start to stop the music and/or sound after few seconds, after change from one scene to another. I am using director, the test code is “Tilt Monster”, I had another iPod Touch with iOS 4.2.1 and work well, after changing the scene, like play again or comeback from help screen or setting screen, the music and sound start normal, but after a few seconds its stop playing.

I did change the code many times in order to do different testing, like do not audio.stop(), but does not work.

All the tests woks well on iOS 4.2.1, but not in iOS 5

The Corona Simulator woks well too.

This is my device console:

Oct 16 02:22:25 unknown kernel[0] : launchd[7544] Builtin profile: container (sandbox)
Oct 16 02:22:25 unknown kernel[0] : launchd[7544] Container: /private/var/mobile/Applications/ABF2964B-A841-4D1F-8B53-65A0409552DE [69] (sandbox)
Oct 16 02:22:26 unknown com.apple.SpringBoard[68] : CoreAnimation: timed out fence 1af63
Oct 16 02:22:26 unknown MoveThePot!v11[7544] : Using OpenFeint version 3252011 (2.10). https://api.openfeint.com/
Oct 16 02:22:28 unknown com.apple.SpringBoard[68] : CoreAnimation: timed out fence ffffffff
Oct 16 02:23:02 unknown UIKitApplication:MoveThePot!v11[0x1395][7544] : ???ERROR
Oct 16 02:23:09 unknown UIKitApplication:MoveThePot!v11[0x1395][7544] : ???ERROR
Oct 16 02:23:17 unknown UIKitApplication:MoveThePot!v11[0x1395][7544] : ???ERROR
Oct 16 02:23:34 unknown UIKitApplication:MoveThePot!v11[0x1395][7544] : ???ERROR
Oct 16 02:23:46 unknown UIKitApplication:MoveThePot!v11[0x1395][7544] : ???ERROR
Oct 16 02:23:51 unknown MoveThePot!v11[7544] : Error setting audio session active to 0! '!act’
Oct 16 02:24:00 unknown com.apple.launchd[1] : (UIKitApplication:MoveThePot!v11[0x1395]) Exited: Killed: 9
Oct 16 02:24:00 unknown SpringBoard[68] : Application ‘MoveThePot!v11’ quit with signal 9: Killed: 9

Please, note the line with …???ERROR this lines became after the sound or music stop, the other are after press the iPhone home button and after delete the app from the multitask bar at the bottom of the iPhone.
Regards,

Varela [import]uid: 8423 topic_id: 16450 reply_id: 316450[/import]

Hi,

I had streaming audio issues (using AAC files for my background music) with iOS5.
iOS 3.x and 4.x worked fine.

However after compiling with daily build 2011.639 my problems were fixed.
The Ansca team have made quite a few iOS5 improvements in the latest daily builds.

[import]uid: 70847 topic_id: 16450 reply_id: 61407[/import]

I did try rebuilding with this version, but not resolved yet.
Thanks anyway for your comment!
The problem is with the stop and hit the play again.
[import]uid: 8423 topic_id: 16450 reply_id: 61434[/import]

Same issue here with audio.loadStream() on iOS 5. Music plays for about 2 seconds and then abruptly stops. Sound effects seem fine, but I can’t be sure since they aren’t really long enough to get cut off.

I’ll try building using daily 640 and see again. [import]uid: 41955 topic_id: 16450 reply_id: 61445[/import]

Yeah this is holding up our submission too. Audio is not working correctly.

UIKitApplication:com.adventureworks.origins[0xf0fa][566] : ???ERROR

[import]uid: 8545 topic_id: 16450 reply_id: 61499[/import]

You guys might want to ready this thread:

https://developer.anscamobile.com/forum/2011/08/06/sound-not-working-latest-ipad-build

Read the second to last post by Ewing.

[import]uid: 66859 topic_id: 16450 reply_id: 61507[/import]

Hi all,

I was intrigued by the fact that others were still experiencing this problem even after re-compiling with one of the later daily builds, so I decided to see if I could find some reason behind this.
After a few hours of digging around some sample code, and comparing with my own, I found one difference that seems to be the reason why I’m not having any audio problems with iOS5.

First I just want to clarify that I’ve only had this issue with streaming audio loaded with audio.loadStream(). As mentioned by Ansca in other threads, this issue is not within Corona SDK.
It’s quite a nasty little regression bug that’s been introduced in iOS5.

The way I’ve gotten around this issue is to reserve channels for all streaming audio. You can do this with audio.reserveChannels(). I’ve used audio.reserveChannels(10) to reserve the first 10 channels for my streaming audio.
What I’ve also done is that I’ve hardcoded the channels that are used for each streaming audio file that I have in my app (background music=channel 1, chatter=channel 2 etc). I’m not sure if that’s necessary, but that’s how I’ve coded my app, and it’s working without any problems.

To test this I had a look at the “Tilt Monster” code and changed it according to what I’ve explained above. It runs perfectly on iOS5 after the changes.

I would also recommend to use AAC encoded files for iOS (although it’s not necessary for this discussion). All iOS devices have built-in hardware decoding of these files (albeit only one at a time). MP3 files need to use the CPU to decode the stream which has a significant impact when running on slower devices like the iPhone 3G or 2nd generation iPod Touch.

I hope this information will help to eliminate the audio issues you’re having.

In my opinion this is quite a serious issue, and I urge all Corona developers to file a bug report with Apple to have them bump up the priority.
In fact, I think it would be a good idea if this was taken up on the Ansca Blog, so that more developers would become aware of the issue and where all developers are urged to file a bug-report to Apple.
If you have the “Tilt Monster” code, you can test the above by editing maingame.lua yourselves.

  1. Search for audio.play

  2. For every line you find where it’s going to play runningSound, gameMusic1, gameMusic2 or gameMusic3, set the channel to a unique channel.
    I used the following:
    gameMusic1 = channel 1
    gameMusic2 = channel 2
    gameMusic3 = channel 3
    runningSound = channel 4

  3. Go to line 4983.
    After physics.setGravity, add the following statement:

audio.reserveChannels(10);
  1. Compile for device and transfer to a device with iOS5 for testing. It should now work as expected.
    [import]uid: 70847 topic_id: 16450 reply_id: 61536[/import]

It’s WORKS!!! THANKS A LOT!!!
Send your address in order to send a BOX OF BEERS!! ; )

Regards and thanks to all of you for your useful help!

Varela [import]uid: 8423 topic_id: 16450 reply_id: 61641[/import]

Great news!
I’m really happy that it all worked out for you!

If ever I’m in Madrid, maybe we can have a beer together :slight_smile:
[import]uid: 70847 topic_id: 16450 reply_id: 61798[/import]

Sure! Count with me!! just send a note!
carlos@varela.com [import]uid: 8423 topic_id: 16450 reply_id: 61953[/import]

Testing this out now. I had the same issue while trying to update one of my games. [import]uid: 39391 topic_id: 16450 reply_id: 62465[/import]

I’ve been having the same problem: my game’s streaming music stops after a while on iOS 5 (works fine on iOS 4). I’ve reserved sound channels for the streams as per ingemar’s suggestion (BTW, thanks!), and it seemed to work fine at first. But if I keep playing the game, the song eventually stops. Granted, it takes a longer time to fail now, but the issue is still there. Has anyone had better luck with this?

Thanks in advance!
-Dario
[import]uid: 21281 topic_id: 16450 reply_id: 65527[/import]

Which Corona build are you using?
All these issues should be fixed if you use build 645 or later. [import]uid: 70847 topic_id: 16450 reply_id: 65577[/import]

You’re right! After updating my Corona to the latest daily build, the problem went away. Thanks!!! [import]uid: 21281 topic_id: 16450 reply_id: 65685[/import]

Thanks!! I had the same problem, I go to try this at home. Thanks again. [import]uid: 28716 topic_id: 16450 reply_id: 66265[/import]

I don’t have access to daily builds at this point but when is the next public version coming out? I really need this to work because the solutions provided here don’t. Streamed music still stops after a short while. [import]uid: 76315 topic_id: 16450 reply_id: 71046[/import]

Hi guys,

@ingemar, I really appreciate your time and effort trying to get it solved for all of us as Asca Team as well but even using your “solution” mentioned in the post above (#6) as “reserving audio channels when using the API audio.loadStream” and also using .aac audio file instead .mp3 but after trying all I got nothing! :\

This solution did not solve the audio playing issue (stattering) I am having at this time (using the daily build 2011.698, 699).:frowning:

Anyway thank you.
Cheers,
Rodrigo. [import]uid: 89165 topic_id: 16450 reply_id: 71083[/import]

@Rodrigo
The work-arounds I gave in post #6 were before Ansca solved these problems with Build 645 and later. In these later builds my work-arounds should not be necessary.

However, if you use build 698 or later you may experience some stuttering on devices with iOS 5.0.1. This stuttering goes away if the device has iOS 5.1 beta installed.

If your app is experiencing audio problems I would recommend testing with build 645.
[import]uid: 70847 topic_id: 16450 reply_id: 71090[/import]

ingemar: Nobody has told us anything about stutter problems in 698 or later. 698 was in fact supposed to solve stuttering problems introduced in 645. You need to submit us a bug report with a reproducible test case because we have not seen this.

You also need build 698 or later to avoid running the iOS 5.0.x workaround code (which is slow) on post 5.0.x OS’s (e.g. 5.1) on the hope Apple fixes this regression bug in 5.1. (All developers should file bug reports with Apple to let them know this is important.)
[import]uid: 7563 topic_id: 16450 reply_id: 71101[/import]

@ewing
As a matter of fact I *did* report this… and I know you’ve read it :slight_smile:
https://developer.anscamobile.com/forum/2011/12/01/build-2011698-and-almixer-ios-5-testing [import]uid: 70847 topic_id: 16450 reply_id: 71104[/import]