I’ve got an MP3 I’ve been using for my intro sound and last night I tried switching the import settings from uncompressed to mp3. The sound plays fine in the editor but not on the phone. In fact no compressed sounds play on the phone. Is there something else I need to do for compressed audio/“background music”?
No, you don’t need to do anything special. Except the fact that only single compressed sound can be played at the time (Editor should simulate that too).
Try to remove your asset and re-add it. If that doesn’t help, check if you have any strange information printed out in the XCode console.
Question for UT, what happens if I play more than one compressed sound? Do both stop, does the second one not play, or does the second interrupt the first?
I’m not UT, but this is the first thing I played with in 1.01. In the editor, at least, the old sound stops and the new sound takes over. It is not seamless in the editor (but it isn’t slow, either). I have not played with this stuff on the actual iPod yet, but I expect the same results.
did you compress them somehow specially. VBR or alike?
IIRC I just used a fixed bit rate. I’ll mess with it more tonight.
I am having a similar issue. I have 8 levels. The first is a menu with no sound, then the rest of the levels have compressed music. The problem I am having is that the music doesn’t play on the first level(not the menu level), but it plays on the following levels. At level 4 I change the music to another one, and it continues play fine. It is odd that only on that first level it doesn’t play, but on the rest it does. It does this no matter what. If I use fewer levels, the first one still does not play the music.
edit: odd, now it appears to work fine. No clue why it was doing that.
pretty sure whatever the last sound allocated plays… you cant do more than 1 compressed sound because its decoded via hardware. i have a game that is not done with unity that i play 2 audio tracks and i ship with mp3s and pre decode the 2nd to wav so they can play simultaneously… this would be a nice feature for unity
OK, well I’m going to submit a bug because I can reproduce it every time I switch between compressed and uncompressed audio. When I use an uncompressed clip (only 1 clip is playing) it works fine. I’m using them as OneShots, though I tried assigning the clip to the source and had the same problem.
Edit: Bug # 67595, includes project files.
Uggg. Compressed audio really doesn’t work. Wasn’t this the big deal for 1.01?? :x
Filing bug report.
audio.PlayOneShot(your audio) don’t work with compressed audio, instead of that you need to do this:
audio.clip = your audio
audio.Play()
I think the compressed audio should be used only for background music, and loaded in the start of your game or you’ll get some lags in middle of your game
I don’t have problems with compressed audio, you need to find how to implement it in your game, that’s all.
Thanks. It works. I’m very disappointed, but at least I know what’s going on now.
I tried that, but the problem is that code still doesn’t seem to work in my Start() function when the game loads. In OnLevelWasLoaded that works fine. Now this is only on the phone, in the editor it works fine.
I only really started in with Unity iPhone audio today, but found that there is a whole lot of stuff that fits this description.
I only have a problem with an audio that don’t play and it’s because it’s forced to mono.
Here is a link to a fix for jarleif’s issue that was posted earlier in this thread on page 1. This might not be the best fix, but it works for me at the moment. Hope this helps those who are in need. Link: http://forum.unity3d.com/viewtopic.php?p=111870#111870.