如何在目标c中降低麦克风的输入质量?

时间:2018-03-10 09:04:42

标签: ios objective-c avfoundation pcm avaudioengine

我正在创建VoIP应用。我想减小音频文件的大小:AVAudioPCMFormatFloat32格式化。当我用免提和压缩录制音频时,更精简的PCM是好的并且尺寸减小但是当我用主麦克风压缩机录音时不会影响PCM文件大小!!

有没有办法降低录制音频的质量以减小尺寸?

此外,在使用AVfoundation:

-(void)setupAVRecorder {
    // Setting up audio engine for local recording and sounds

    localInput = localAudioEngine.inputNode;
    [localAudioEngine attachNode:localAudioPlayer];
    //        self.localInputFormat = self.localInput?.inputFormat(forBus: 0)

    localInputFormat = [[AVAudioFormat alloc]initWithCommonFormat:AVAudioPCMFormatFloat32 sampleRate:44100 channels:1 interleaved:false];
    [localAudioEngine connect:localAudioPlayer to:localAudioEngine.mainMixerNode format:localInputFormat];




       dispatch_sync(audioPlayerQueue, ^{
        peerInput = peerAudioEngine.inputNode;
        [peerAudioEngine attachNode:peerAudioPlayer];

        peerInputFormat = [[AVAudioFormat alloc]initWithCommonFormat:AVAudioPCMFormatFloat32 sampleRate:44100 channels:1 interleaved:false];
        [peerAudioEngine connect:peerAudioPlayer to:peerAudioEngine.mainMixerNode format:peerInputFormat];

        //            self.peerInputFormat = self.peerInput?.inputFormat(forBus: 1)

    });


}

0 个答案:

没有答案