Multiple audio sources? And general optimisation

Hello,

So I was just wondering; does unity allow for multiple audio sources? As I’m trying to add a second and every time I do it stops the first audio source from being played?

Also were near release of our first game, I’ve been optimizing it in regards to the texture compression and some code, but if anyone has any optimization advice in regards to the audio compression or in terms of script optimization that I may have missed then let me know!

Thanks
Adam.

you can have multiple audio sources but only one using compressed audio (and thats commonly the BG music, as it is the only file that gets really large, 3s wavs are no prob, 4min wavs indeed are ^^)
The hardware decompressor does not support more than one file at a time.

Yep, I had the same problem…till I read something in the manual. I have about 15 sounds two of which were (compressed) Ogg files the rest are Wavs. The BG music is Ogg and one of the SFX is also Ogg. When the game starts the BG music will play fine, but as soon as the other SFX is called the BG will stop.

Here’s info from the Getting Started Guide:

No Ogg Vorbis audio decompression

Runtime Ogg Vorbis decompression is very expensive for the iPhone’s processor and is disabled as such. When building for the iPhone, you will receive a build error if any of your project audio files are set to use Ogg Vorbis compression. You can switch these files to use uncompressed audio in the import settings. For background music you can use mp3 or m4a compressed audio files. Consult the AudioClip documentation for more information on usage of compressed audio for the iPhone.

Note to self…fix that. :sweat_smile:

Cool, thanks for that guys! Works perfectally now!

It’s not hard if you use Max.

Or something else like it, but that’s my favorite. Fast batch processing, and conversion to/from a bunch of formats.