Update: there's a nice looking library that I recently discovered here.
When I did this previously, I branched the code from the SoundCloud implementation (which was originally branched from the open source Android camera app) on GitHub, but it looks like there was a library released in August last year that you could use.
Link to it here