0

According to the iOS Technology Overview the DVI/Intel IMA ADPCM format is supposedly supported. Specifically, there is a section that indicates:

iOS supports many industry-standard and Apple-specific audio formats, including the following:

AAC
Apple Lossless (ALAC)
A-law
IMA/ADPCM (IMA4)
Linear PCM
µ-law
DVI/Intel IMA ADPCM
Microsoft GSM 6.10
AES3-2003

However, in attempting to use the kAudioFormatDVIIntelIMA format key:

[[AVAudioSession sharedInstance]
     setCategory: AVAudioSessionCategoryRecord
     error: &error];

    NSDictionary *recordSettings = @{
        AVFormatIDKey : [NSNumber numberWithInt: kAudioFormatDVIIntelIMA],
        AVSampleRateKey : [NSNumber numberWithFloat: 8000.0],
        AVEncoderBitRateKey : [NSNumber numberWithInt:16],
        AVNumberOfChannelsKey : [NSNumber numberWithInt:1]
    };

    NSError *error;
    AVAudioRecorder *newRecorder =
    [[AVAudioRecorder alloc] initWithURL: soundFileURL
                                settings: recordSettings
                                   error: &error];

    NSLog(@"Recorder Errors: %@", [error description]);

I am getting the error:

Error Domain=NSOSStatusErrorDomain Code=1718449215 "The operation couldn’t be completed. (OSStatus error 1718449215.)

with kAudioFormatUnsupportedDataFormatError being 1718449215. So what gives?

(Note that if I change this to kAudioFormatAppleIMA4, the code above works fine. So it seems that only IMA4 ADPCM is supported, not the DVI/Intel IMA ADPCM).

Kicks
  • 51
  • 3
  • How are you initializing soundFileURL? – meggar Jan 14 '14 at 14:55
  • I'm just creating a file in the temp dir. This file gets created fine when I use kAudioFormatAppleIMA4. So I know that the URL is fine: `NSString *tempDir = NSTemporaryDirectory (); NSString *soundFilePath = [tempDir stringByAppendingString: @"sound.caf"]; NSURL *soundFileURL = [[NSURL alloc] initFileURLWithPath: soundFilePath];` – Kicks Jan 15 '14 at 06:35
  • ".caf" is not ADPCM, I think ".wav" or something else might work. – meggar Jan 15 '14 at 14:14
  • @Kicks. I got error 1718449215, too. How do you fix it? – yycking Jul 15 '19 at 01:47

0 Answers0