Hi all, thanks to yours useful directions, i've finally found sound effects for my game. Now i wonder which sound 'resolution' are you using for effects? I mean, 16bit-44Khz-Stereo may be a bit too large... or not? I'd like my game to be enjoyable with earphone too. Other question... In a book i bought years ago (http://www.apress.com/9781430219682) i've read that mixing different resolution sound effect could create serious performance issues. I quote here: "In OpenAL a sound effect is stored in a buffer and then played when needed. The format of the sound data in this buffer is critical because if you have 30 sound effects all going off simultaneously, then you dont want the CPU to have to do any extra work converting the hundreds of thousands of samples every second from the buffers format to Core Audios native format. Therefore, all sound effects should be identically formatted and in Core Audio File Format (CAFF) format. You should never have some of your sounds be 22 kHz and some 44.1 kHz. They must all be the exact same frequency, bit depth, and format, and they must be mono. Even having just one oddball effect can destroy the audio pipeline and cause serious performance issues. " Is this still true with new iOS devices? The author here developed a game (Nanosaur) for iPhone 2G/3G. Thanks again, sigLuca Game Artesan
typically; sounds libraries have a buffer for playback. the higher your frequency; the more data gets pushed through the buffers; what this means is that 44khz processes the buffer 2x faster than a 22khz stream. the key question here; is pure latency. buffer size: 1024 bytes 8khz: largest latency = 1024/8000 = 0.128 seconds 44khz: largest latency = 1024/44100 = 0.023 seconds so; technically - you are better off with 44khz. in the lemmings preview we did; our audio samples were 8khz; but we dynamically extrapolated them to 22khz so we could reduce the latency. this is when programming gets fun; but you need to be hard core at the bit level
I don't know much about the technicalities of audio programming, but here's my experience: Using OpenAL (via the finch framework), playing 44100hz 16-bit .wav files.. I can play lots and lots of sound effects, even triggering multiple .wavs every single frame, without any noticeable performance hit or latency, even on 2G iPod Touch (not sure about 1st gens, haven't seen one in action). I just keep piling on the sfx and haven't had any problems.. iPhone/iPod/iPad seem to have really good audio hardware, as you'd expect So yeah, I reckon you don't have to worry much about it! [edit: although, my games are 2D using OpenGL, and most of my sound effects are quite small.. it may be a different story if you're making something like 3D environmental soundscapes with long, streaming samples, or something... dunno]
if your game use a lot of sound fx, than you should put some good fx at 44k stereo, choose mono if your game use a 3D/2D environment. and if you're scary about the performance, try to FPS your game with and without the sound.
It almost certainly depends how many sounds you plan to be playing at once and how you are going to position them. I suspect it's all a non issue unless your game is going to play 8+ of them at the same time, all positioned individually and played at different frequencies.
IMA4 is your friend You can play any non-compressed formats (PCM) and a few compressed (IMA4, ADPCM) at any frequency and bit depth without affecting performance or quality. The mixer is running full-speed all the time in software. It will take care of all the details. Apple recommends you use IMA/ADPCM audio (IMA4) format for playing multiple sounds simultaneously, but any PCM format is fine. For MP3, AAC and other compressed formats the device uses the hardware mixer, which can only play back one sound at a time. We did a lot of experimenting with formats in order to find the best compromise of quality vs. size. We chose IMA4 .caf as our final solution. It gives you 4:1 compression of 16-bit stereo PCM audio and it still sounds pretty good. Download Lingua Free and listen for yourself. For a compressed format, it really is surprising how good it sounds. The key is to normalize all your sounds and use compression to bring up the levels without distortion. I've read that OpenAL doesn't support IMA4 but we aren't using OpenAL so I can't say for sure. Have a look here for more details: Apple Coding How-To's on Audio Aaaaaaaand this link tells you exactly how to extract IMA4 for use with OpenAL: IMA4 with OpenAL Good luck!