This extension provides four voice filters to users: echo, reverb, flanger and pitch shift. The user can customize values for each one of them to achieve different results.
This extension only requires three basic steps:
Import the VoiceFilters extension to your project
Create an AgoraRtcEngine kit
instance, initialize it and enable the extension
Create a SynervozVoiceFilter
instance to control the voice filters.
The development environment has to meet the following requirements:
Android
iOS
Android
Add the VoiceFiltersAgoraExtension.aar
to your project
Import the following
import com.synervoz.voicefilters.SynervozVoiceFilter
import com.synervoz.voicefilters.AgoraExtensionPropertyInterface
import com.synervoz.voicefilters.SynervozVoiceFilterExtensionManager
import com.synervoz.voicefilters.VoiceEffectsComponentConfiguration
Create an instance of RtcEngine
by initializing it with RtcEngineConfig()
val config = RtcEngineConfig()
config.addExtension(SynervozVoiceFilterExtensionManager.EXTENSION_NAME)
mRtcEngine = RtcEngine.create(config)
To enable the extension, call RtcEngine’s function enableExtension
mRtcEngine.enableExtension(SynervozVoiceFilterExtensionManager.EXTENSION_VENDOR_NAME, SynervozVoiceFilterExtensionManager.EXTENSION_AUDIO_FILTER_NAME, true)
Create an instance of the SynervozVoiceFilter
class.
Implement the AgoraExtensionPropertyInterface
as following
synervozVoiceFilter.agoraExtensionPropertyInterface = AgoraExtensionPropertyInterface { vendorName, filterName, propertyName, propertyValue -> mRtcEngine.setExtensionProperty(vendorName, filterName, propertyName, propertyValue) }
To enable reverb (all filters have default values)
synervozVoiceFilter.reverbVoiceConfig = VoiceEffectsComponentConfiguration.ReverbVoiceEffectConfiguration().apply {
dry = 1.0f
wet = 1.0f
mix = 1.0f
width = 1.0f
damp = 0.5f
roomSize = 1.0f
preDelay = 100.0f
lowCut = 5.0f
}
synervozVoiceFilter.enableReverb(reverbEnabled)
iOS
Add the VoiceFiltersAgoraExtension.framework
to your project
Create an instance of AgoraRtcEngineKit
and initialize it.
To enable the extension, call AgoraRtcEngineKit's function enableExtensionWithVendor
Import SynervozVoiceFilter
class
//Objective-C
#import <VoiceFiltersAgoraExtension/SynervozVoiceFilter.h>
//Swift
import VoiceFiltersAgoraExtension
Create an instance of SynervozVoiceFilter
class.
To enable the echo voice filter and change its configuration
//Objective-C
EchoVoiceEffectConfiguration echoConfig;
echoConfig.mix = 1.0f;
[voiceFilter setEchoConfiguration:echoConfig inEngine:self.agoraKit];
[voiceFilter enableEcho:YES inEngine:self.agoraKit];
//Swift
EchoVoiceEffectConfiguration
echoConfig = EchoVoiceEffectConfiguration(mix: 1.0)
voiceFilter.setEcho(echoConfig, inEngine: agoraKit)
voiceFilter.enableEcho(true, inEngine: agoraKit)
To enable the pitch shift filter and change its configuration
//Objective-C
PitchShiftVoiceEffectConfiguration pitchShiftConfig;
pitchShiftConfig.shift = 500;
[voiceFilter setPitchShiftConfiguration:pitchShiftConfig inEngine:self.agoraKit];
[voiceFilter enablePitchShift:YES inEngine:self.agoraKit];
//Swift
PitchShiftVoiceEffectConfiguration
pitchShiftConfig = PitchShiftVoiceEffectConfiguration(shift: 500)
voiceFilter.setPitchShiftConfiguration(pitchShiftConfig, inEngine: agoraKit)
voiceFilter.enablePitchShift(true, inEngine: agoraKit)
To enable the reverb filter and change its configuration
//Objective-C
ReverbVoiceEffectConfiguration reverbConfig;
reverbConfig.damp = 1.0f;
reverbConfig.dry = 1.0f;
reverbConfig.lowCut = 5.0f;
reverbConfig.mix = 0.7f;
reverbConfig.preDelay = 100.0f;
reverbConfig.roomSize = 1.0f;
reverbConfig.wet = 1.0f;
reverbConfig.width = 1.0f;
[voiceFilter setReverbConfiguration:reverbConfig inEngine:self.agoraKit];
[voiceFilter enableReverb:YES inEngine:self.agoraKit];
//Swift
ReverbVoiceEffectConfiguration reverbConfig = ReverbVoiceEffectConfiguration(
dry: 1.0,
wet: 1.0,
mix: 1.0,
width: 1.0,
damp: 1.0,
roomSize: 1.0,
preDelay: 100.0,
lowCut: 200.0
)
voiceFilter.setReverbConfiguration(reverbConfig, inEngine: agoraKit)
voiceFilter.enableReverb(true, inEngine: agoraKit)
To enable the flanger filter and change its configuration
//Objective-C
FlangerVoiceEffectConfiguration flangerConfig;
flangerConfig.bpm = 80.0f;
flangerConfig.depth = 1.0f;
flangerConfig.lfoBeats = 30.0f;
flangerConfig.stereo = true;
flangerConfig.wet = 1.0f;
[voiceFilter setFlangerConfiguration:flangerConfig inEngine:self.agoraKit];
[voiceFilter enableFlanger:sender.isSelected inEngine:self.agoraKit];
//Swift
FlangerVoiceEffectConfiguration flangerConfig = FlangerVoiceEffectConfiguration(
wet: 1.0,
depth: 1.0,
lfoBeats: 30.0,
bpm: 100.0,
stereo: true
)
voiceFilter.setFlangerConfiguration(flangerConfig, inEngine: agoraKit)
voiceFilter.enableFlanger(true, inEngine: agoraKit)
iOS/Android
SynervozVoiceFilter
: The helper class that allows you to control the voice filters and their configuration. With this class you can enable or disable each filter, change their configuration using the configuration structs and reset the values to default. EchoVoiceEffectConfiguration
: Holds the echo filter configuration values. ReverbVoiceEffectConfiguration
: Holds the reverb filter configuration values. FlangerVoiceEffectConfiguration
: Holds the flanger filter configuration values.PitchShiftVoiceEffectConfiguration
: Holds the pitch shift configuration values.