I would like to modify the SpeakHere to record the file in a compressed format, and Apple released a tech note recently in order to do that but I cannot get it to work despite following instructions to the letter.
Also be careful the // make sure the audio session is active before asking for properties comment means you need to move some initialization code from the recOrStop method to the initwithnibname part - i did that.
has anyone had success modifying the example to record in an
IMA/ADPCM (aka IMA4) - kAudioFormatAppleIMA4 or similar?
Technical Q&A QA1615 - "Audio Queue - Recording to a compressed audio format."
proposed change:
SpeakHere - initWithURL: in AudioRecorder.m:
Code:
- (id) initWithURL: fileURL {
NSLog (@"initializing a recorder object.");
self = [super init];
if (self != nil) {
// define the audio stream basic description for the file to record into
// record audio at the current hardware sample rate
// make sure the audio session is active before asking for properties
UInt32 propertySize = sizeof(audioFormat.mSampleRate);
AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareSampleRate,
&propertySize,
&audioFormat.mSampleRate);
audioFormat.mFormatID = kAudioFormatAppleIMA4; // record using IMA4 codec
audioFormat.mChannelsPerFrame = 1;
AudioQueueNewInput(&audioFormat, ... );
...
}
return self;
}