Custom audio processing is generally used to remove interference in the voice. Since the SDK has processed the collected audio raw data with echo cancellation and noise suppression, usually, developers do not need to repeat the processing.
If the developer wants to implement special functions (such as voice change, bel canto, etc.) through custom processing after collecting audio data or before pulling remote audio data for rendering, they can refer to this document.
The data of custom audio processing is the audio data after 3A (AEC, AGC, ANS) processing of the original audio:
Before custom audio processing, please make sure:
Call the setCustomAudioProcessHandler method to set the audio custom processing object and implement the event callback. Audio data can be processed by directly processing the passed data in the callback.
[[ZegoExpressEngine sharedEngine] setCustomAudioProcessHandler:self];
-(void)onProcessCapturedAudioData:(unsigned char *)data dataLength:(unsigned int)dataLength param:(ZegoAudioFrameParam *)param {
}
-(void)onProcessRemoteAudioData:(unsigned char *)data dataLength:(unsigned int)dataLength param:(ZegoAudioFrameParam *)param streamID:(NSString *)streamID {
}
ZegoCustomAudioProcessConfig *config = [[ZegoCustomAudioProcessConfig alloc] init];
config.channel = ZegoAudioChannelMono;
config.sampleRate = ZegoAudioSampleRate16K;
config.samples = 0;
[[ZegoExpressEngine sharedEngine] enableCustomAudioCaptureProcessing:YES config:config];
[[ZegoExpressEngine sharedEngine] enableCustomAudioRemoteProcessing:YES config:config];