views:

56

answers:

0

I am writing program on iPhone, that records voice and transmit to the server in real-time. For recording voice I use AudioQueue and inside of

void AudioInputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer, const AudioTimeStamp *inStartTime, UInt32 inNumberPacketDescriptions, const AudioStreamPacketDescription *inPacketDescs){

the recorded data is receiving on

AudioQueueBufferRef inBuffer

buffer. In each time I write this buffer to server using socket as

[oStream write:inBuffer->mAudioData maxLength:inBuffer->mAudioDataByteSize];

Inside the server I write these data into tmp file. Once the recording process finished I use this temp file to make wave file (Putting a header) to check the validity of the received data. In this program I make appropriate wave header and append the temp data into trail.

Unfortunately, the created file is awesome. In iPhone I used following parameters to at recording.

format->mSampleRate = 16000;

format->mFormatID = kAudioFormatLinearPCM;

format->mFramesPerPacket = 1;

format->mChannelsPerFrame = 1;

format->mBytesPerFrame = 2;

format->mBytesPerPacket = 2;

format->mBitsPerChannel = 16;

format->mReserved = 0;

format->mFormatFlags = kLinearPCMFormatFlagIsBigEndian |kLinearPCMFormatFlagIsSignedInteger| kLinearPCMFormatFlagIsPacked;

Anybody can help me to figure out this matter.