Game Performance and audio
jhaas
Member Posts: 233
I've noticed that up until I add sound files to a game I'm working on everything work just fine. Once I add the mono 22khz sound effects files(about 8) and I play the game for about 10 minutes - I start seeing the game freeze and jitter occasionally.
Anyone else notice the same thing? Is this the .ogg files? I've also tried importing .wav files and allowing GS to do the conversion - no change.
Maybe the game engine needs some more work in the audio dept? It shouldn't bog down simply playing the same sound files over and over - it's sort of what a game engine is supposed to do.
Anyone else notice the same thing? Is this the .ogg files? I've also tried importing .wav files and allowing GS to do the conversion - no change.
Maybe the game engine needs some more work in the audio dept? It shouldn't bog down simply playing the same sound files over and over - it's sort of what a game engine is supposed to do.
Comments
"reducing the quality and/or number of channels in your audio files will help with both filesize and load time.
In situations where you want high-quality audio, there's another option: the Apple CAF format. GameSalad will accept .caf files without converting them to .ogg.
With CAF you have a choice of codecs. At the extreme end, uncompressed Linear PCM (16-bit little-endian) gives you CD-quality sound reproduction and will load lightning-fast, but will also increase filesize.
Max is a good, free utility that can do batch conversion between sound formats."
So I would be interested to know if you tried that (using CAF version of the file) if things ran any more performant!?
##
## Shell script to batch convert all files in a directory to caf sound format for iPhone
## Place this shell script a directory with sound files and run it: 'sh converttocaf.sh'
##
for f in *; do
if [ "$f" != "converttocaf.sh" ]
then
/usr/bin/afconvert -f caff -d 'aac ' -c 1 -l Mono $f
echo "$f converted"
fi
done
-------------------
If you're doing it to a single file, the command is :
/usr/bin/afconvert -f caff -d 'aac ' -c 1 -l Mono <filename>
Hope this helps!
afconvert etc etc etc ...
would be good enough.
Some additional tidbits...
1. I placed all the AIFF files I want to convert in a particular folder
2. Then launch Terminal
3. To change directory, the same as DOS with the 'cd' command but here's a quick tip...
3a. You can type 'cd ' (and space) then drag and drop the path from the GUI
- do this by dragging the small icon of the folder next to the folder name at the top of the folder window into the Terminal window
- especially good for long paths
4. Once in the right path, you can execute the .sh by typing ./<shellscript filename>
5. Have to be sure that the .sh is executable using the 'chmod' command
I'm not really an expert with the command line, but it has definitely saved me from a lot of work, especially for batch processing.
Is there a different setting of the MAX encoder that I should use or am I wasting my time trying to get any sound to work in my game?
Again the game plays fine with no stuttering with no sound effects.
Any suggestions?
Personally, I doubt that the audio alone is throwing up problems since my music app runs smoothly through the night (at least 7 hours). And you can be sure that even a 0.01 second delay will be noticed when it comes to music being assembled on the fly.
All I know is when I run with no sound effects - no issues.
Maybe it's the combination of the on screen activity and the way the engine handles repeatedly playing the sounds over and over that causes some resource constraint?
The .ogg file format seems to be a problem for GameSalad... but .caf or the other format for GameSalad, didn't work out for me either.
Mozart To Infinity with audio files in .ogg = crash on everything but iPhone 3GS
Mozart To Infinity with audio files in .caf = performs even on 1st Gen iPod Touch
Considering the fact that I did not change any part of the code, it's probably reasonable to assume that the process of converting to .caf helped with stability issues.
Moving forward, all my projects now are using audio files in .caf (mono, aac) until we experience something different with GS updates or new info from GS HQ.
In terms of just file sizes, here's what happened to Mozart To Infinity:
1. Total number of audio files = 272
2. Total size in AIFF = 166.8MB
3. Total size after .CAFF conversion using afconvert = 12.8MB
Because it's a command line program, it allows us to write a script to automatically go through an entire folder of AIFF files. Just imagine the amount of blood I'd be coughing out if I had to convert 272 clips by hand! :-O~
I can play my games for 3-5 Minutes and then each 30 sec. it slows down for 10-20 fps and your player dies!
When i delete the sounds ...the game runs flawless...
I will try to test the caf conversion above ( unfortunatly i have never used the terminal
These slowdowns with ogg files are very very annoying! (fix please!!)
The U-encoding files I made in Max didn't reliably play in the GS builder preview, so I took those out and replaced them with A-encoded files. These play fine in the preview, but they crash the app on the iPhone. (The app runs fine with no sounds and with oggs.)
My next step is to try scorelessmusic's terminal processing for my files. Onward!
Why does gamesalad auto convert to .ogg and not give an option for .caf when it knows that could save the designer ram usage?
I've tried all the various suggestions here with regards to sound effects causing noticeable stuttering. I have a sound effect that plays every time the player collects an object in game. Doesn't matter what effect I choose, how much I compress the chosen effect, what format (aiff, wav, mp3, caf), nothing seems to help.
I'm using Max to convert an mp3 into a caf... should I be directly converting the original aiff?
Thanks in advance.