A (175)

(Tuis.) #1

660 APPENDIX A: Audio Concepts, Terminology, and Codecs


Raw Audio Data Optimization: Memory Footprint


What is important, if you are going to attempt the real-time audio compositing of six or eight audio
samples, is that each of these samples is well optimized. This makes what you learned about digital
audio data optimization extremely relevant when it comes to using SoundPool.


For instance, if you don’t really need HD (24-bit sample resolution) audio in order to get the quality
result, you should use CD-quality 16-bit audio, or even 12-bit audio, as you will save valuable
memory and get the same result. If you can get the same audio quality using a 32kHz sample rate
instead of a 48kHz sample rate, you are using 50% less sample memory!


For voiceover or sound effects audio, the memory savings are there for the taking, as often you can
sample a bomb or laser blast effectively by using 8-bit resolution with an 8kHz sample rate. You
often won’t be able to detect much difference between 16-bit 48kHz Stereo audio and the lower bit-
rate Mono audio, as you saw earlier in Chapter 12 between your WAVE and AMR samples, with a
200 fold memory savings (400KB down to 2KB).


If you don’t absolutely need Stereo samples, and can mix them down into Mono samples, you will
save 100% in memory. Combine this with lowering bit rates for the sample resolution and sampling
frequency, and you can get the same audio result, at least from the user’s perspective, using a
hundred times less data (in many circumstances).


It is important to remember that the users don’t hear the “before” (uncompressed) and the “after”
(compressed) audio samples like you do. As long as they sound similar, you are good to go!


The other significant variable you can optimize is the length (in time) of the sample. Notice, in
Figure A- 1 , that there is a significant portion of the sample after 0.8 seconds that does not have much
data in it. Reducing the sample duration from 1.2 seconds or 1,200 milliseconds to 0.8 seconds or
800 milliseconds results in a 50% reduction in raw audio data that is being sampled in the first place.
This kind of data savings can add up with several digital audio samples.

Free download pdf