Hi all,
I am using this code to play background music :
[[SimpleAudioEngine sharedEngine] playBackgroundMusic:fileName loop:YES];
I call this when I touch the screen. But at the first time it plays with a long delay in the beginning something like 10 secs. Any idea how to remove this delay?
thanx in advance
playBackgroundMusic delay
(10 posts) (3 voices)-
Posted 2 years ago #
-
Sometime before you can:
[[SimpleAudioEngine sharedEngine] preloadBackgroundMusic:]Posted 2 years ago # -
I call that function in my init function but it doesn't make any difference.
Posted 2 years ago # -
Background music playback is very unreliable on the simulator. If you are getting the problem on a device then it could be a problem with your sound file, try another sound file e.g. the mp3 that comes with the CocosDenshion demo.
There is more info in the FAQ.
Posted 2 years ago # -
I tested it on ipod touch version 3.1 . the mp3 is a regular music file with 4 min length.
Posted 2 years ago # -
Did you look in the FAQ like I suggested? Especially this:
Did you try using the mp3 file that comes with the CocosDenshionDemo instead of your mp3 file like I suggested?
Posted 2 years ago # -
I've tested my program with mula_tito_on_timbales.mp3. But it had a little delay which fixed with [[SimpleAudioEngine sharedEngine] preloadBackgroundMusic:]. thanx alot DetectiveCakes and Steve. If I want to record a sound and use that, Do you have any idea how to do that so I don't get delay?
Posted 2 years ago # -
@alibozorgkhan - I would expect if you use iTunes to encode an mp3 that it will work okay. I use SoundForge and that seems to work okay. Was your mp3 variable bit rate? I don't use VBR and would guess that would be more likely to cause issues than a fixed bit rate.
Posted 2 years ago # -
Like Steve mentioned, I've noticed a performance hit using variable bit rate m3ps. Also, it generally seems the larger the file is the more likely there will be issues (which makes sense). So I've been converting mine to mono, shortening them when possible, and dropping the bitrate some (to 96 or even 64kbps... the difference is really not noticeable when played over the iPhone speaker anyways).
I've had good luck with Audacity for encoding and basic editing. http://audacity.sourceforge.net/
Posted 2 years ago # -
Is it good to create my sound files using garage band? or it is to professional for this !?
Posted 2 years ago #
Reply
You must log in to post.