APPENDIX A: Audio Concepts, Terminology, and Codecs 655
Android Digital Audio: Digital Audio Formats
There are considerably more digital audio codecs in Android than there are digital video codecs, as
there are only two video codecs—MPEG and WebM. Android audio support includes .MP3 (MPEG3)
files, WAVE (PCM or Pulse Code Modulated) .WAV files, .MP4 (or .M4A) MPEG4 audio, OGG Vorbis
(.OGG) audio files, Matroska (.MKS) audio files, FLAC (.FLAC) audio files, and even MIDI
(.MID, .MXMF and .XMF) files, which technically aren’t really even digital audio data at all.
Let me explain what MIDI is first, since it is not a format that you are going to be using in your
HelloUniverse application.
MIDI stands for Musical Instrument Data Interface, and it is one of the very first ways that digital
audio and computers worked together, dating all the way back to ancient times (the 1980s). The very
first computer to feature the MIDI data port hardware was the Atari ST1040. This computer allowed me
to plug my keyboard synthesizer, at the time it was my Yamaha DX-7, into that MIDI port. MIDI allowed
me to play and record performance data into the computer using the MIDI data format along with an
audio software genre called a MIDI sequencer and MIDI Sequencing software called FinalTrack.
A MIDI file contains zero sample data—that is, it contains no audio data, only the performance data.
When this performance data is played back into the synthesizer using the MIDI hardware (cable and
ports), the synthesizer generates the audio tones using this MIDI performance data. MIDI will record
which keys on the synth or sampler keyboard were pressed, and when, along with the keypress
duration, how hard it was pressed (called after-touch), and similar performance nuances.
When MIDI files are played back through a synthesizer, the synth replicates the exact performance of
the performer or composer, even though that person is no longer playing that performance track; the
computer is now playing that performance data exactly the way that it was originally performed.
The way that MIDI data was used in MIDI sequencing software is that you can play an instrument
track, record it as MIDI data, and the sequencer will then play it back for you, while you play another
instrument track right alongside of it. This enables digital songwriters to assemble complex musical
arrangements using the computer, instead of hiring a studio full of musicians. You can download
open source MIDI software called Rosegarden at rosegardenmusic.com; it not only contains a full
MIDI sequencer, but also contains a music notation (scoring) program as well. Rosegarden was
originally for Linux OS but is being “ported” to the Windows OS as well currently.
Android supports playback of MIDI files, but does not implement a MIDI class. It would not be an
easy task to code a MIDI sequencer for Android, although some on the code forums are talking about
it. For that reason it is beyond the scope of this book, and I mention it here only to educate you as to
the history and scope of digital audio. MIDI played an important role early on in the evolution of digital
audio, and is still part of digital audio today, especially if you are a songwriter or a sound designer.
The most common digital audio format supported by Android is the popular MPEG3, or MP3,
digital audio file format. Most of you are very familiar with MP3 digital audio files, due to the music
download websites like Napster. Most people collect songs in this format to use on popular MP3
players and via CD-ROM- and DVD-ROM-based music collections.
The reason the MP3 digital audio file format is popular is because it has a fairly good
compression-to-quality ratio, and because the codec needed to play audio back can be found
almost anywhere, even in the Android OS. MP3 is an acceptable format to use in an Android
application, as long as you get the highest quality level possible out of it by using an optimal
encoding work process.