For anybody wanting to do low-level audio, I suggest checking out the AudioQueue page at the iphone dev wiki.

Audio out is pretty straightforward...open source programs that use this include NESApp, Garf, Piano, and many more.

Audio input via the internal microphone is not-so-straightforward. One has to establish a route to the internal mic first. Funiculus guitar tuner tricks AVRecorder into establishing a route for an already existing input Audio Queue.

What is unknown, however, is a way to do the routing directly. The MeCCA framework apparently has something to do with this, but direct calls to it don't seem to work. There is currently a VoIP program for the iPod Touch which doesn't need to route because apparently the default input route is the external microphone (and for some reason, the an iPhone with an external mic allegedly doesn't work the same). For the program to work correctly for the iphone, routing will probably need to be figured out. So if anyone is wanting a challenge...a frontier to explore...this would be a good one.