Wednesday, February 3, 2010

No Low Level Audio in Android SDK

After a lengthy search of the Web, I've learned that low level audio support for Android is still in the works. As of now there is only a Java API for audio recording and playback, the lowest of which are the AudioRecord and AudioTrack classes. The AudioRecord class lets you get raw data from the microphone, and the AudioTrack class lets you stream raw PCM data for playback. The latency from Java to the hardware is unacceptable for many types of music, sound, and game applications. The lack of low level features like synchronous play is very painful for what I'm wanting to do.

There are a number of threads as well as an issue report addressing this problem. The current version of the Android NDK does not have an audio API. There are hints that the next NDK version will have some audio support, but who knows when that will be available. 

Without low level audio support and no synchronous play API, there seems to be only two options for playing two sounds synchronously: 1) play them at the same time and hope for the best, or 2) mix the sounds in the software before playing them. Option 2 sounds more reliable, but can it be done in real time? I may need to use the NDK to implement the mixing in C, which would involve sending the data through a JNI round trip.


Friday, January 22, 2010

The Nexus One

I've had the Nexus One for a week now, and the experience has been mostly good. I've never owned a smartphone before, so of course I am happy to be able to do more than just call people and calculate tips.

I don't have a data plan, because I spend most of the day covered in Wi-Fi, and I don't want to pay the money for it. T-Mobile I think has made a good move in allowing cheaper month-to-month plans without subsidized phones.

My biggest beef with Android + Nexus is that on certain websites like Google Reader or the mobile version of WordPress, the text size is way too small and it is impossible to increase it. You cannot increase it through the text size settings for the browser, because apparently those pages ignore that setting. You cannot zoom in, because apparently that has been disallowed. There are threads in the support forums about this, but no solution.

One minor difficulty about owning a smartphone like this is sifting through all the apps to find the good ones. Apps for Android or for the iPhone follow Sturgeon's Law pretty well. There is a simple rating system that helps a little bit, but you still have to spend some time researching. It's hard to see which apps are the most popular when you search for something specific. They're all listed in a big long egalitarian list. If you just want a simple app that allows you to take little notes, you'll find a hundred apps that claim to solve this problem, and maybe only two of them are worth installing. Not only do you have to look at the rating, but you have to sift through the comments. The comments are only about one step above YouTube comments, which is to say they are mostly uninformative drivel. Sometimes I'll click on the developer's website to see if it's nice or well maintained. Since I'm a software guy, I have a deep understanding of what kind of ugly underbelly a lot of software can have, and my trust is not easily won. Browsing through a mobile application store is like sifting through a junkyard.

One big problem is that app developers apparently have no qualms with requiring access to users' personal data. I was about to install a simple little timer app before I saw that it required access to my location, settings, email, and phone data. Why do people put up with this?

Overall the Nexus is very cool, and I have wasted a lot of time with this newfound ability to read blogs in bed. Now I have to see if I can get it to do my bidding.