Currently on MicDroid there are certain phones which just do not work properly, (you know who you are... Samsung Galaxy S!) which is quite irritating. Aside from the fact that they cause my app not to work, it's horribly irritating since it means I probably have to go and find a real phone to test on. The fact that I'm currently an unemployed student aside, $500 for a new phone is just plain expensive!
In any case, this week I received an interesting email from the Peter Kirn of the pd for Android project. Running MicDroid on the newly released Droid X also seems to have had audio problems, specifically crackling and static in the audio stream. According to Peter Brinkmann of the Pd for Android project, this is caused by the call to AudioRecord.read(byte[], int, int) blocking (!) on the Droid X. His workaround is basically to run calls to the the AudioRecord.read function in a separate thread, and use a second buffer, swapping every other read. From this thread, the rest of the program can then poll() the thread's queue for sound data. Oddly enough it doesn't appear that the Nexus One or any of the other previous phones I've tested on suffer from this particular blocking issue. This is going to be a real problem later on, since there appears to be no requirement that all phones must support recording at a certain sample rate and format. Even worse is the problem which the Droid X presents. There is NO guarantee that any of the calls in the API will function the same way on all phones, which can lead to phone-specific hacks and workarounds, and generally unmaintainable code. It also requires developers to either query a database of some sort containing phone-specific workarounds (doesn't exist!), or have to buy the phones and figure it out themselves. (expensive!) At $500 a pop, this might be just the thing phone manufacturers want, but for the small time developer, it adds quite a lot to the cost of development.
This all brings me back to the problem the Galaxy S exhibits. I've read the logs from quite a few models, and it appears there's a buffer overrun somewhere internally. Unfortunately I don't have any clues as to what causes this overrun. My best guess currently is that some of the recording settings are not set properly, despite the phone telling me it is. It's a shame I cannot seem to find Galaxy S recording specs (sample rate, PCM format, etc) supported.