Androidiophile – Blurring the line between MP3 player and mobile phone
In this project we aim to write a real-time MP3 player application for the Android mobile phone platform. We will accomplish this using the Eclipse Java IDE, the Android Software Development Kit, and the Android Native Software Development Kit. These are all tools that are freely available for download from the Android Developer site. The development platform that will primarily be used is the Droid Incredible from HTC with Android 2.2 Froyo. The code developed will be backwards compatible to Android 1.5 in order to be compatible with older handsets. The first goal of the project is to write a simple mp3 player with minimal interface in order to get the mp3 codecs functional. The second goal is to develop a user interface with more features. The third goal is to develop an equalizer for mp3 playback in order to give greater control over sound quality. Time permitting, our fourth goal is to develop an extension to the application that enables listening to Internet radio stations. This project is to be functional (i.e. mp3 playback and simple user interface) by the due date of the project (December 15, 2010). A more stringent outline will be developed in the next two weeks, while familiarizing ourselves with the Java language and the Android platform.
The ubiquity of MP3 players and mobile phones in everyday life is undeniable. Even in the conservative mobile development environment of the United States, mobile penetration is at 91.0% as of December 2009 (1). Our project aims to implement a new class for handling media playback for Android. This will allow us to include additional features in the MP3 player program such as an equalizer and internet radio integration. These features are not necessarily to be included in the main project, but rather are future goals for project development.
Hard vs. Soft System
There are two options for MP3 playback on the Android phone speaker. One is to use the built-in DAC (Digital to Analog) controller. This will simplify the frame resolution of MP3 playback, doing most of the “heavy lifting” so the multipurpose microprocessor does not have to. However, this may limit the amount of control that can be given to the MP3 player driver program as a result of limited inputs and outputs. How this interacts with the objective of implementing an equalizer will be further explored.
There is a public class in the Android/Java built-in library called MediaPlayer that is used to handle playback of audio and video files and streams. This may be implemented in our program to simplify the actual coding and allow us to focus on additional features. If necessary or advantageous to the player, we may implement our own class with similar functions, but with our own structure and capabilities. This may facilitate the addition of several new features such as equalization that would not be possible with the default libraries.
MediaPlayer has its own inherent flaws and faults. It is known to be fault-intolerant, causing frequent crashes and errors. MediaPlayer is optimized for performance, but does not check for errors. This is handled by the fact that the Linux kernel running the Android OS is very stable, simply ending the processes rather than crashing the entire phone. There are also known problems with playback of any format besides OGG Vorbis , MP3, and WAV(PCM Uncompressed). This is why we have decided to implement our own MediaPlayer variant.
Description in Terms of the Reference Model
Our project will primarily consist of a MediaPlayer class designed to be a functional audio player implementation. This will involve several subclasses. Some of these may include an audio codec interface with the Android OS, a DAC interface, a file system structure handler, and a frame buffer implementation.
The decoder will primarily be designed to handle different audio file types with regards to the respective codecs. The DAC interface will be used to handle the inputs and outputs of the Digital-Analog converter in order to output sound to the speaker. The file system structure handler will be used to recognize which file is being played, as well as listing, organizing, sorting, and switching between the different files and formats being played back. The frame buffer implementation will be the representation of each individual frame being sent to the codec.
The MediaPlayer library in Android essentially functions as a state machine. It may be reinitialized at any time with a reset() function. The playback may be either synchronous or asynchronous. The main difference between the two lies in the handling of playback via timing. Asynchronous playback is sent to the DAC immediately after a frame is processed. Synchronous playback is set to a timing loop, allowing more stable playback. Synchronous is primarily used for media playback due to the expectations of quality for the user. When we implement our own version of MediaPlayer, similar input and output methods will be used.
If asynchronous playback is used, the program will be relying on the speed of the processor and the interrupts from the Android system services to maintain the speed and quality of playback. This will likely negatively impact the consistency of playback. A synchronous system will enforce a clock on the playback, enabling the consistency needed for high quality playback of media. A more rigorous definition of the frames that will be used will be developed.
A very exciting opportunity presents itself with this project. A library with greatly extended functionality can be a great resource for future projects from future classes, projects, other developers, or even the Android Market. Writing our own version of MediaPlayer is an effective demonstration of a real time system on the Android Mobile platform.