
I recently released some updates for my Android music application (“Musical”) and decided to post some screenshots and semi-technical explanations.
The pitch pipe (pictured on the right) lets you play any starting pitch (from C4 to C5) either by holding your finger on the screen or by blowing into the bottom of the phone. Because Android does not support true live audio analysis the play-by-blowing feature is limited and the volume by breath control is at very low resolution and with a bit of delay (it is only using a periodic sampling of input amplitude). Android also does not allow live generation of audio (playing audio from a memory stream), so the pitch pipe works by stringing together and looping “prerecorded” sine waves of various frequencies.

The piano (pictured above) is multi-octave (although the bottom octave does not work–Android’s midi synthesizer will not play notes that low) and can be played with your fingers. It is not multitouch, as Android on the G1 does not currently support multitouch (although the hardware technically supports it, it is disabled and there is no public API). Switching octaves is accomplished by dragging the keyboard or the “current window” in the upper mini-keyboard. Notes vary based on how long they are held down (longer hold = longer note) and although multiple keys cannot be pressed at once, multiple notes can be playing at once (it is polyphonic). The piano “activity” (a screen in Android) plays the notes via SoundPool (an unsupported, unstable, and mostly undocument sound API–but the only one with a fast enough response time) and plays a series of premade midi files using Android’s built-in synthesizer (as there is no way to directly access the synthesizer in code to play a specific note). Because it uses SoundPool, it is currently rather unstable and sometimes locks up and crashes (the audio stack overloads). Hopefully when the next version of the SDK comes out, Google will provide a finalized SoundPool and better support for generating live sounds.
To download the latest version, just search for “Musical” in the Android Market on your G1.