我正在创建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)
});
}