My requirement is to create a .wav file, and I had an existing code with ADPCM encoder already written. It was getting data in linear PCM and converting it to ADPCM and creating a wave header for the file.
Now, I have modified the code, and I am getting the data directly into Apple ADPCM format, whose specific values are given below. How can I create a wave header for this file so I can play this file on any player. Right now, I am getting the file size correct, but it is not playing the data, neither full length, nor without crackling sound. Please suggest me any breakthroughs how can I debug the code, so I can get the exact problem. Currently it seems to be a problem of wave header to me.
ADPCM Specifications used: *mSampleRate:* 44100
mFormatID: kAudioFormatAppleIMA4
mFormatFlags: 0
mChannelsPerFrame: 2
mBitsPerChannel: 0
mFramesPerPacket: 64
mBytesPerPacket: 68 (= mChannelsPerFrame * 34)
Wave Header Specifications used: *samplesPerSecond:* 44100
channels: 2
status: 0x0011U
blockAlign: channels * 256
bitsPerSample: 4
formatExtension: 2
samplesPerBLock: lsx_ima_samples_in((size_t) 0, (size_t) wavHeader.wChannels, (size_t) wavHeader.wBlockAlign, (size_t) 0);
samplesWritten: self.audioLength/wavHeader.wSamplesPerBlock
fmtSize: 2 + wavHeader.wExtSize;
Any kind of help is highly appreciated.