A (175)

(Tuis.) #1
CHAPTER 12: Digital Audio: Providing Aural Feedback for UI Designs Using SoundPool 459

This work process will allow me to see what the resulting AMR-NB file size would be when using a
maximum quality level setting. Let’s click on the Save button and export our buttonaudio.amr audio
file now. As you can see, this is by far the smallest data footprint that we have obtained thus far, and
yet when we play it back, it still sounds a lot like the button sound effect contained inside the other
supported codec formats we have generated.


The buttonaudio.amr file size is 2KB, representing more than a 99% data footprint reduction. To
figure this out, 2KB divided by 219KB is 0.00913242, which is 0.91% of the original, uncompressed
file size. 100% minus 1% equals the 99% file size reduction. If you invert 0.00913242 you get
109.50, which would represent a 10,950% reduction in data footprint. I don’t know about you, but
my decision for a basic button sound effect would be to use a 2KB audio asset rather than a 47KB,
49KB, 72KB or 109KB audio asset, since it’s just for aural feedback!


The only problem that you have now, and fortunately only with this last very niche codec and file
format, is that Audacity wants to export put AMR-NB files with an .AMR file extension, whereas
Android wants to see AMR-NB audio files using a 3GP file extension. It’s always something, isn’t it?
Let’s go back to the drawing board and look at the Audacity documentation. The Audacity manual
File Export section tells us that we should be able to specify certain non-standard file extensions and
get away with it, so let’s go back into Audacity 2.0.5 and try it!


Let’s follow the standard File ➤ Export work process, invoke the Audacity Export File dialog, and
select the AMR (narrow band) Files (FFmpeg) from the Save as type: drop-down menu selector.
This time, let’s name the file buttonaudio.3gp. I’m using a CH12 directory for this book, you could
use a C:\Android\Content\Audio folder, for instance. Next, click on the Options button and set the
12.20 kbps Bit Rate (audio quality) option, using the Specify AMR-NB Options dialog, as shown in
Figure 12-13. AMR Narrow band uses a mono audio channel format, as you probably noticed on the
right-hand side of Figure 12-13, in the Warning dialog message.


Once you click on the Save button, you will see the Warning dialog shown on the right side of
Figure 12-14. Click on the Yes button and save the file as buttonaudio.3gp so that you now have
seven different audio assets.


Figure 12-13. Export an AMR (narrow band) file named buttonaudio.amr with a Bit Rate setting of 12.20 kbps

Free download pdf