2

I've searched supported format audio files but I've found below formats only.

kAudioFormatLinearPCM               = 'lpcm',
kAudioFormatAC3                     = 'ac-3',
kAudioFormat60958AC3                = 'cac3',
kAudioFormatAppleIMA4               = 'ima4',
kAudioFormatMPEG4AAC                = 'aac ',
kAudioFormatMPEG4CELP               = 'celp',
kAudioFormatMPEG4HVXC               = 'hvxc',
kAudioFormatMPEG4TwinVQ             = 'twvq',
kAudioFormatMACE3                   = 'MAC3',
kAudioFormatMACE6                   = 'MAC6',
kAudioFormatULaw                    = 'ulaw',
kAudioFormatALaw                    = 'alaw',
kAudioFormatQDesign                 = 'QDMC',
kAudioFormatQDesign2                = 'QDM2',
kAudioFormatQUALCOMM                = 'Qclp',
kAudioFormatMPEGLayer1              = '.mp1',
kAudioFormatMPEGLayer2              = '.mp2',
kAudioFormatMPEGLayer3              = '.mp3',
kAudioFormatTimeCode                = 'time',
kAudioFormatMIDIStream              = 'midi',
kAudioFormatParameterValueStream    = 'apvs',
kAudioFormatAppleLossless           = 'alac',
kAudioFormatMPEG4AAC_HE             = 'aach',
kAudioFormatMPEG4AAC_LD             = 'aacl',
kAudioFormatMPEG4AAC_ELD            = 'aace',
kAudioFormatMPEG4AAC_ELD_SBR        = 'aacf',
kAudioFormatMPEG4AAC_ELD_V2         = 'aacg',    
kAudioFormatMPEG4AAC_HE_V2          = 'aacp',
kAudioFormatMPEG4AAC_Spatial        = 'aacs',
kAudioFormatAMR                     = 'samr',
kAudioFormatAudible                 = 'AUDB',
kAudioFormatiLBC                    = 'ilbc',
kAudioFormatDVIIntelIMA             = 0x6D730011,
kAudioFormatMicrosoftGSM            = 0x6D730031,
kAudioFormatAES3                    = 'aes3'

I want to record audio file in format of speex, because It's just enough to record speech. Is it possible with core audio framework?

Ref: I've found this lib. But It is too complicating process. I want to use simple control with AVAudioPlayer or AVAudioRecorder.

Mani
  • 17,549
  • 13
  • 79
  • 100
  • 1
    You will have to use the library you found since Apple did not include the `speex` audio codec. – rckoenes Mar 31 '14 at 12:13
  • thank you @rckoenes. I can record with `aac`, `ilbc`.. etc. format. But when we record with `speex`, size is too low. So Only I'm trying to find out. – Mani Mar 31 '14 at 12:16

2 Answers2

2

I once had an experience where I had to record audio with mp3 format on the iPhone. As you can see, it is not listed in your list. I ended up using LinearPCM and then converting it to mp3. I think this pattern is the only one you need. No standard methods will help you here, as well as I'm concerned.

Recording in any other format than aac is a lot of pain on the iOS.

Community
  • 1
  • 1
Sergey Grischyov
  • 11,995
  • 20
  • 81
  • 120
  • thank you friend. I can record with aac. I take it into account, But I need to reduce size because this is speech file. `aac` file is 5 times larger than `speex` and `ilbc` format. So only I try to find out this. Any way +1 for you :) – Mani Mar 31 '14 at 12:18
  • @Mani Well, recording with arc takes about 45 megabytes for 30 minutes. And don't forget you can actually reduce the quality oа audio recording for low or set your own custom bit rate. Try it out to reduce the size. – Sergey Grischyov Mar 31 '14 at 12:20
  • Ya. I already reduce to min Sample bit rate and min audio bit rate, that's why I get that (just 5 time than). Otherwise I'll get too large file. – Mani Mar 31 '14 at 12:22
1

I've used OGG Vorbis for audio playing which is same as OGG Speex.. for this i used a library available here on IDZAQAudioPlayer

For OGG Speex audio Recording, I once used this library OGGSpeex

If u need further info for implementing it or anything else feel free to ask..

To Really reduce the size of audio recording you can use AudioFormat : MPEG4AAC which creates a 135KB file for 60 seconds recording..

Sure.. Code for AAC Recording

    NSMutableDictionary *recordSetting = [[NSMutableDictionary alloc] init];
    [recordSetting setValue:[NSNumber numberWithInt:kAudioFormatMPEG4AAC] forKey:AVFormatIDKey];
    [recordSetting setValue:[NSNumber numberWithFloat:8000.0] forKey:AVSampleRateKey];
    [recordSetting setValue:[NSNumber numberWithInt: 1] forKey:AVNumberOfChannelsKey];
    [recordSetting setValue:[NSNumber numberWithInt:AVAudioQualityLow] forKey:AVEncoderAudioQualityKey];

    AVAudioRecorder *recorder = [[AVAudioRecorder alloc] initWithURL:outputFileURL settings:recordSetting error:nil];
    recorder.delegate = self;
    recorder.meteringEnabled = YES;
    [recorder prepareToRecord];
Ahmed Z.
  • 2,329
  • 23
  • 52
  • Could you post setting for AAC? I'm using AAC setting, but It's size 200KB for 60 seconds? – Mani Mar 31 '14 at 13:26