APPENDIX A: Audio Concepts, Terminology, and Codecs 661
I went into Audacity and further reduced the 32-bit 48kHz (393KB) sample to 16-bit 48kHz (219KB)
and then used the Audacity Tracks ➤ Stereo Track to Mono menu sequence to create a Mono 16-bit
48kHz (110KB) raw data footprint for this audio data. Then, I selected the last portion of the sound
wave, between the 0.8 and 1.15 duration, and pressed the Delete key, removing that unused data.
I saved that out and it was 76KB of data. I reduced the raw audio data that will be recreated in
system memory by Android, by 517% (81% less data).
I just showed you three different levels (sample resolution, stereo vs. mono, and sample duration)
of raw audio data reduction (you can think of this as memory usage once the digital audio data has
been decompressed by the Android OS into system memory). And this is before you even get into
file size optimization using various encoders.
Codec optimization will affect your app’s APK file size, but when the audio sample needs to play
back inside your app, this audio sample still needs to be recreated in (decompressed into) system
memory, before it can be “triggered” by the SoundPool engine.
Therefore, there are really two stages to audio optimization—what you do to the raw audio wave
sample prior to encoding, relating to sample resolution, sample frequency, sample duration, and
mono versus stereo sample playback, and what you do as you export into various codecs using
settings to ascertain how much APK file size they can save your app.
Figure A-1. Audacity 2.0.5 main audio editor screen showing the stereo 32-bit floating point 48 kHz sample data