views:

10

answers:

0

i am using AudioStreamer and recording the streaming MP3 packets to a file(by creating with AudioFileCreateWithURL), file writing is fine but when playing recorded file it plays noise only for few seconds. i think this is because of wrong AudioStreamBasicDescription provided to file i am using for record and play..

thanks in advance.

- (void)setupAudioFormat:(AudioStreamBasicDescription*)format 
{
    format->mSampleRate = 8000.0;
    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;
}