views:

51

answers:

1

Does anyone know how to modify the code Speak Here from Apple. I need to modify it to record streaming audio using Matt Gemmell AudioStreamer classes but somehow I can't find how to select the recording source...

Could you help?

A: 

I haven't done this but I have used Matt's AudioStreamer class quite a bit and that's really project you want to extend - not SpeakHere. (The streaming audio part is the most complex part of this).

What you would do is first setup your file for writing and then in AudioStreamer.m there are two places where the network data buffer is copied to the audio queue buffer - both are noted with this // copy data to the audio queue buffer. After those lines add the logic to write to the file (using AudioFileWritePackets). I would guess that the file write is fast enough to do this right here, immediately. If not (if the audio playback skips or breaks up) then you'd want to set up a circular buffer for file writing, copy the bytes and call the AudioFileWritePackets from a background thread.

John Fricker
Thanks john, I'll try it and give you some feedbacks
okayasu