Making recording from AVAudioEngine?

Hi,


I'd like to install a tap in my AVAudioEngine and have it output the audio to a file, preferably in a compressed format.


What's the best way to do this? I see a lot of classes in AVFoundation that deal with audio files but it's difficult to figure out the best way to accomplish what I want.


Thanks,

Frank