0
votes

I am having the same problem as this question: SimpleAudioEngine, playing .caf files (which is closed)

The solution, however, does not work.

I have Battle.wav, which works just fine with

[[SimpleAudioEngine sharedEngine]playBackgroundMusic:@"Battle.wav"];

Now, I want to convert it to .caf. According to the answer in that question, I should use this terminal line:

afconvert -f caff -d LEI16@22050 Battle.wav

The resulting file, however, does not work. When I use:

[[SimpleAudioEngine sharedEngine]playBackgroundMusic:@"Battle.caf"];

Xcode displays the following message when I do that:

AudioStreamBasicDescription: 2 ch, 44100 Hz, 'lpcm' (0x00000C2C) 8.24-bit little-endian signed integer, deinterleaved

I don't really know what does that mean. What I do know, however, is that the file indeed does not sound.

The question at playing a .caf file: works fine in simulator but not in iPhone doesn't help either (and the problem they have doesn't seem the same basic thing I'm having here).

Cocos2d-iphone 1.0.1, iPhone 4.

1

1 Answers

0
votes

Try opening and exporting the file as AIFF (.caf) using Audacity (free). That should work if it is a file format problem.

One thing that may be an issue is the caf file using 2 channels. It may be as simple as SimpleAudioEngine not supporting stereo sound effects. If you want background music, use .mp3 since they can be decoded in hardware, and are generally a lot smaller.