Hey guys, So I play a sound when I press a button, and when I run it in the simulator, it works, but when I put it in my device, it doesn't work. The volume was at full, and the silent switch wasn't off. Anyone know what to do?
if you are using a method to play sounds that depends on it being pre allocated before you play it, sometimes the speed on your computer will make it seem as if its working in simulator when really the code isnt meant to work that way and youre getting 'lucky'.
dont allocates these sound fx right when you play them.. usually you pre allocate them and keep them in mem till you know youll never need it again.. aka beginning of level, etc.
Okay, so I preloaded my sounds in viewDidLoad. They play in the simulator but not in the real device. I don't understand, it works for my other app...Does the file extension .m4a work?
Maybe a long shot but check you are loading the exact right case for your sound files, e.g. you are loading "Sound.m4a" and not "sound.m4a" if your file is saved as "Sound.m4a". The device has a case-sensitive file system whereas the simulator does not. Having said that I can't tell you if m4a works or not.
Yup I specified the right file. Hmm, anyone knows how to use the terminal conversion thing? I can't get it to work.
Which APIs are you using to play back the sounds? I've ran into plenty of .wav files that played fine in the simulator, but not on a real device. Reducing their size (by reducing frequency or bytes per sample) was almost always to get them working.
I'm using <AudioToolbox/AudioServices.h> It's a short sound, about 1 second or so only. I'm pretty sure it's the file type, since I used the same method in another app and it worked. Does anybody know how to convert it to a .caf file? I heard of using terminal, but somehow I can't get it to work.
It's possible to export sounds as aiffs within itunes. A .caf is simply an aiff with its suffix renamed. That being said, it's possible to play .wavs on both simulator and device.
Yup, so I got sounds files with a .caf extension. They worked perfectly. Now...Anyone know of a good free audio editor besides Audacity?
Audacity is "ok" but I much prefer GoldWave (free, fully functional demo) on PC. With GoldWave it's super easy to export sounds with exactly the bits per sample and frequency you like.