AVAudioRecorder 支持哪些录音格式?

发布于 2024-11-27 01:13:25 字数 1878 浏览 0 评论 0原文

我在 http://developer.apple.com/library/ios/#documentation/MusicAudio/Reference/CoreAudioDataTypesRef/Reference/reference.html#//apple_ref/doc/uid/TP40004488

音频数据格式标识符 音频数据格式的标识符,在 AudioStreamBasicDescription 结构中使用。

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 = '时间',

kAudioFormatMIDIStream = 'midi',

kAudioFormatParameterValueStream = 'apvs',

kAudioFormatAppleLossless = 'alac'

kAudioFormatMPEG4AAC_HE = 'aach',

kAudioFormatMPEG4AAC_LD = 'aacl'

, kAudioFormatMPEG4AAC_ELD = 'aace',

kAudioFormatMPEG4AAC_HE_V2 = 'aacp',

kAudioFormatMPEG4AAC_Spatial = 'aacs',

kAudioFormatAMR = 'samr',

kAudioFormatAudible = 'AUDB',

kAudioFormatiLBC = 'ilbc',

kAudioFormatDVIIntelIMA = 0x6D730011,

kAudioFormatMicrosoftGSM = 0x6D730031,

kAudioFormatAES3 = 'aes3'

但是,我不认为我们可以使用提到的所有格式(例如mp3)。

谁能帮助我了解使用 AVAudioRecorder 录制声音所支持的格式?

谢谢。

I have found a list of the different values (Audio Data Format) at http://developer.apple.com/library/ios/#documentation/MusicAudio/Reference/CoreAudioDataTypesRef/Reference/reference.html#//apple_ref/doc/uid/TP40004488

Audio Data Format Identifiers
Identifiers for audio data formats, used in the AudioStreamBasicDescription structure.

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_HE_V2 = 'aacp',

kAudioFormatMPEG4AAC_Spatial = 'aacs',

kAudioFormatAMR = 'samr',

kAudioFormatAudible = 'AUDB',

kAudioFormatiLBC = 'ilbc',

kAudioFormatDVIIntelIMA = 0x6D730011,

kAudioFormatMicrosoftGSM = 0x6D730031,

kAudioFormatAES3 = 'aes3'

However, I dont think we can use all the formats mentioned (e.g. mp3).

Can anyone help me out with the formats that are supported for recording sound using AVAudioRecorder ?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

愁以何悠 2024-12-04 01:13:25

根据苹果文档 Apple Core 音频格式规范 1.0< /a> 它现在应该支持 mp3 虽然我还没有测试它,这是他们支持的当前枚举:

enum {
    kAudioFormatLinearPCM      = 'lpcm',
    kAudioFormatAppleIMA4      = 'ima4',
    kAudioFormatMPEG4AAC       = 'aac ',
    kAudioFormatMACE3          = 'MAC3',
    kAudioFormatMACE6          = 'MAC6',
    kAudioFormatULaw           = 'ulaw',
    kAudioFormatALaw           = 'alaw',
    kAudioFormatMPEGLayer1     = '.mp1',
    kAudioFormatMPEGLayer2     = '.mp2',
    kAudioFormatMPEGLayer3     = '.mp3',
    kAudioFormatAppleLossless  = 'alac'
};

As per apple docs Apple Core Audio Format Specification 1.0 it should now support mp3 although I haven't tested it, this is the current enumeration they support:

enum {
    kAudioFormatLinearPCM      = 'lpcm',
    kAudioFormatAppleIMA4      = 'ima4',
    kAudioFormatMPEG4AAC       = 'aac ',
    kAudioFormatMACE3          = 'MAC3',
    kAudioFormatMACE6          = 'MAC6',
    kAudioFormatULaw           = 'ulaw',
    kAudioFormatALaw           = 'alaw',
    kAudioFormatMPEGLayer1     = '.mp1',
    kAudioFormatMPEGLayer2     = '.mp2',
    kAudioFormatMPEGLayer3     = '.mp3',
    kAudioFormatAppleLossless  = 'alac'
};
心奴独伤 2024-12-04 01:13:25

上面列出的只是

mFormatID 字段当前定义的值

不支持记录。

使用 AVAudioRecorder 格式(带采样率)进行了测试:

"MPEG4AAC (8000, 11025, 22050, 32000, 44100, 48000)",
"AppleLossless (8000, 11025, 22050, 32000, 44100, 48000)",
"MPEG4AAC_HE (32000, 44100, 48000)",
"MPEG4AAC_LD (22050, 32000, 44100, 48000)",
"MPEG4AAC_ELD (22050, 32000, 44100, 48000)",
"MPEG4AAC_ELD_SBR (22050, 32000, 44100, 48000)",
"MPEG4AAC_ELD_V2 (22050, 32000, 44100, 48000)"

示例:

[[AVAudioRecorder alloc] initWithURL:outputFileURL
                            settings:@{
                                       AVFormatIDKey : @(kAudioFormatMPEG4AAC),
                                       AVSampleRateKey : @(44100.0),
                                       AVNumberOfChannelsKey : @(2)
                                       }
                               error:&error];


支持的音频文件格式

List above just

currently defined values for the mFormatID field

not supported for recording.

There are tested with AVAudioRecorder formats (with sample rates):

"MPEG4AAC (8000, 11025, 22050, 32000, 44100, 48000)",
"AppleLossless (8000, 11025, 22050, 32000, 44100, 48000)",
"MPEG4AAC_HE (32000, 44100, 48000)",
"MPEG4AAC_LD (22050, 32000, 44100, 48000)",
"MPEG4AAC_ELD (22050, 32000, 44100, 48000)",
"MPEG4AAC_ELD_SBR (22050, 32000, 44100, 48000)",
"MPEG4AAC_ELD_V2 (22050, 32000, 44100, 48000)"

Example:

[[AVAudioRecorder alloc] initWithURL:outputFileURL
                            settings:@{
                                       AVFormatIDKey : @(kAudioFormatMPEG4AAC),
                                       AVSampleRateKey : @(44100.0),
                                       AVNumberOfChannelsKey : @(2)
                                       }
                               error:&error];

also
Supported Audio file formats

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文