Help Please, Playing A Short Sound Tutorial Not Working
I've looked at the "Playing A Short Sound" tutorial many times, making sure all my code is correct. My code compiles, but I hear no sound. I think something may have changed with the new SDK..
I've looked at the "Playing A Short Sound" tutorial many times, making sure all my code is correct. My code compiles, but I hear no sound. I think something may have changed with the new SDK..
Try using the SoundEffect class files from the metronome example from Apple. It has some console messages that are printed if there's a problem loading sound files etc. It could give you a better idea of what's going wrong.
@bhearn where would I put that code, and in place of what?
@11111111 the highlighted red does not seem to be different from what I already have.
@mxweas I am testing on the simulator
@refreshe I am not good enough at Objective-C to to see what I am doing wrong. The metronome app is too confusing for me to understand how that can relate to mine.
@refreshe I am not good enough at Objective-C to to see what I am doing wrong. The metronome app is too confusing for me to understand how that can relate to mine.
Well I posted the relevant code for SoundEffect.h & SoundEffect.m files from the metronome app. Just replace your SoundEffect.h/m code with those.
They're basically the same, except they'll spit out some error messages if they exist.
Open the console when you build your app and see if any error messages show up.
Apart from errors in loading the sound, is the sound file itself compatible?
It should be under 5 seconds or it won't play using this playback method. Also maybe try converting it to apple's preferred .caf format instead of .wav
Apple have instructions in the dev center to go about doing this using a Terminal command.
Sorry guys, this was totally my fault. The sound file was created wrong. Instead of exporting in wav, I simple renamed it from a mp3. It works now, sorry about that
By the way... if you compile it on your iphone make sure its not on vibrate otherwise you won't hear the sound lol.
When I tried playing sounds i seriously thought it was the code and spent like 2 hours trying to figure it out then it turned out my phone was muted lol.
By the way... if you compile it on your iphone make sure its not on vibrate otherwise you won't hear the sound lol.
When I tried playing sounds i seriously thought it was the code and spent like 2 hours trying to figure it out then it turned out my phone was muted lol.
At least your app responds to that mute. I hate it when apps don't!
So after all this Ive followed the tutorial 2x now and after it goes thru the first wave of build, I get these errors:
HTML Code:
"Linking /Users/foobar/Document/xcode/Debug-iphonesimulator/Sounds.app/Sounds
_AudioServicesPlaySystemSound", referenced from:
-[SoundEffect play] in SoundEffect.o
"_AudioServicesCreateSystemSoundID", referenced from:
-[SoundEffect initWithContentsOfFile:] in SoundEffect.o
symbol(s) not found
:gun to my head: inevitably when I think Ive got it working I hit this wall? any suggestions?
So when I added the framework I had copy if needed checked, I deleted the framework, readded, then unchecked the copy if needed box after reimporting. the app works exactly as it should now.
So when I added the framework I had copy if needed checked, I deleted the framework, readded, then unchecked the copy if needed box after reimporting. the app works exactly as it should now.
glad you added this. i had the same problem and deleted and added without the copy and it worked for me too.
I've found all my sound issues to be much easier using the AVAudioPlayer. It requires 2.2.1, but that's not such a big deal. I've got more information on it here.
So when I added the framework I had copy if needed checked, I deleted the framework, readded, then unchecked the copy if needed box after reimporting. the app works exactly as it should now.
MY! MY! MY!
Fought with this all day before I found this post. Delete and readd worked like a champ.
Thanks
I did everything perfectly like the tutorial said. It works fine, absolutely no errors. I checked the code multiple times and it's exactly the way it should be. The sound works perfectly on the iphone 3.0 SIMULATOR. But when i put it on the device the sounds do not come out. I also checked to make sure the vibrate was OFF.... Any ideas?
It did take a fair amount of fiddling and googling to get it to work the first time!
I'm running this and I can't get any sound output from my simulator OR iphone. There are no errors or warning though. Maybe my wav file is bad? How can I check that?
I did everything perfectly like the tutorial said. It works fine, absolutely no errors. I checked the code multiple times and it's exactly the way it should be. The sound works perfectly on the iphone 3.0 SIMULATOR. But when i put it on the device the sounds do not come out. I also checked to make sure the vibrate was OFF.... Any ideas?
thanks!
Some times some formats of sounds play on simulator, but not works on device.. eg: mp3