本文介绍了适合录制语音的AVAudioRecorder设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用AVAudioRecorder添加语音备忘录功能,我需要知道录音机录制语音的最佳设置。

I am adding a voice memo capability using AVAudioRecorder and I need to know the best settings for the recorder for recording voice.

不幸的是,我对音频一无所知,甚至不确定google的条款。

Unfortunately, I know nothing about audio to the extent I am not even sure what terms to google for.

目前,我正在使用以下内容从某处复制以进行测试:

Currently, I am using the following which I copied from somewhere for testing purposes:

recorderSettingsDict=[[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithInt:kAudioFormatAppleIMA4],AVFormatIDKey,
                        [NSNumber numberWithInt:44100.0],AVSampleRateKey,
                        [NSNumber numberWithInt: 2],AVNumberOfChannelsKey,
                        [NSNumber numberWithInt:16],AVLinearPCMBitDepthKey,
                        [NSNumber numberWithBool:NO],AVLinearPCMIsBigEndianKey,
                        [NSNumber numberWithBool:NO],AVLinearPCMIsFloatKey,
                        nil];

或:

defaultSettings =     {
    AVFormatIDKey = 1768775988;
    AVLinearPCMBitDepthKey = 16;
    AVLinearPCMIsBigEndianKey = 0;
    AVLinearPCMIsFloatKey = 0;
    AVNumberOfChannelsKey = 2;
    AVSampleRateKey = 44100;
};

这有效但我不知道它在质量,速度,文件方面是否适合语音大小等。

This works but I don't know if it's optimal for voice in terms of quality, speed, file size etc.

但我不知道哪些用于语音。

The AVAudioRecorder Class Reference list many settings constants but I have no clue which ones to use for voice.

Baring,如果有人知道一个好的AudioFormats for Dummy资源,我也会这样做。 (注意:我已经浏览过Apple Docs并且他们假设我没有数字音频知识库。)

Baring that, if someone knows of a good "AudioFormats for Dummy's" resource I will take that as well. (Note:I've been through the Apple Docs and they assume a knowledge base in digital audio that I do not posses.)

推荐答案

您需要阅读标题为在iPhone OS中使用声音的部分,以及。 (编辑:这些链接已过时,iPhone OS中的使用声音已经从当前的应用程序编程指南中进行了编辑,但已更新并移动。)

You'll want to read the iPhone Application Programming Guide section titled Using Sound in iPhone OS, and the Audio Queue Services Programming Guide. ( These links are outdated, the Using Sound in iPhone OS has been edited out of the current Application Programming Guide, but the Audio Queue Services Programming Guide is updated and moved.)

人类声音中的大多数声音都在人类听觉的中间范围内。即使以非常低的数据速率进行数字化,也很容易理解录制的语音。你可以踩踏所有的录音,但仍然有一个有用的文件。因此,您对这些录音的最终用途将指导您对这些设置的决定。

Most sounds in human voices are in the middle range of human hearing. Recorded speech is easily understood even when digitized with very low data rates. You can stomp all over a voice recording, yet still have a useful file. Therefore, your ultimate use for these recordings will guide your decisions on these settings.

首先,您需要选择音频格式。您的选择将取决于录制后您想要对音频执行的操作。您目前的选择是IMA4。也许你会想要一个不同的格式,但IMA4是iPhone的不错选择。这是一种快速的编码方案,因此它对于有限的iPhone处理器来说不会太费力,而且它提供4:1压缩,因此不会占用太多的存储空间。根据您选择的格式,您需要进行进一步的设置。

First you need to choose the audio format. Your choice will be determined by what you want to do with the audio after you record it. Your current choice is IMA4. Maybe you'll want a different format, but IMA4 is a good choice for the iPhone. It's a fast encoding scheme, so it won't be too taxing for the limited iPhone processor, and it supplies 4:1 compression, so it won't take up too much storage space. Depending upon the format you choose, you'll want to make further settings.

您当前的采样率(44.1 kHz)与CD音频的标准相同。除非您正在进行高保真录制,否则您不需要这么高的速率,但您不想使用任意速率。大多数音频软件只能在32 kHz,24 kHz,16 kHz或12 kHz等特定步骤中了解速率。

Your current sample rate, 44.1 kHz, is the same as the standard for CD audio. Unless you're after a high fidelity recording, you don't need this high of a rate, but you don't want to use arbitrary rates. Most audio software can only understand rates at specific steps like 32 kHz, 24 kHz, 16 kHz, or 12 kHz.

对于立体声,您的通道数设置为2 。除非您使用额外的硬件,iPhone只有一个麦克风,1个单声道应该足够。这会将您的数据需求减半。

Your number of channels is set to 2, for stereo. Unless your using additional hardware, the iPhone only has one microphone, and 1 mono channel should be sufficient. This cuts your data needs in half.

您使用的三种线性PCM设置似乎只适用于线性PCM格式录制。我认为它们对您的代码没有任何影响,因为您使用的是IMA4格式。我不清楚IMA4格式是否足以告诉您需要进行哪些设置,因此如果您决定继续使用该设置,则必须进行一些额外的研究。

The three Linear PCM settings you are using seem to be just for Linear PCM format recordings. I think they have no effect in your code, since you are using the IMA4 format. I don't know the IMA4 format well enough to tell you which settings you'll need to make, so you'll have to do some additional research if you decide to continue using that setting.

这篇关于适合录制语音的AVAudioRecorder设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-16 02:42
查看更多