Other Echo cancelation wrapper paid

Addo

Well-Known Member
Licensed User
Longtime User
Well after struggling for almost 2 years to find a way to eliminate echo in audiostreamer with too many fails. Which seems there is no built in way to avoid echo. When i look at other apps that uses webrtc etc which eliminate echo very well and after too many searches i found that the only way to use a wrapper that works with each audio frames. As the author of this library tried to make a wrapper for such purpose, and seems this wrapped isnt compatible with audiostreamer. Since its required parameters are in short not bytes.

I am ready to pay for a working wrapper that able to filter each audio frame of audiostreamer and eliminate the echo from it. If anyone are able or already have such working wrapper i will be happy to buy it..
 

Jmu5667

Well-Known Member
Licensed User
Longtime User
Hello

Play with these. Make sure the audio stream is initialized first.

B4X:
Private audioStream             As AudioStreamer

Sub SetEchoCanceler
    
    Dim AEC As JavaObject
    
    Try
        AEC.InitializeStatic("android/media/audiofx/AcousticEchoCanceler".Replace("/", "."))
        If AEC.RunMethod("isAvailable", Null) = True Then
            Dim r As Reflector
            r.Target = audioStream            
            Dim AudioRecord As JavaObject = r.GetField("audioRecord")
            AEC.RunMethod("create", Array(AudioRecord.RunMethod("getAudioSessionId", Null)))
            log("SetEchoCanceler, AEC set")
        Else
            log("SetEchoCanceler, AEC not available")
        End If
    Catch
        log("SetEchoCanceler, SetEchoCanceler not available")
    End Try
    
End Sub

Sub SetGainControl
    
    Dim AGC As JavaObject
    
    Try
        AGC.InitializeStatic("android/media/audiofx/AutomaticGainControl".Replace("/", "."))
        If AGC.RunMethod("isAvailable", Null) = True Then
            Dim r As Reflector
            r.Target = audioStream
            
            Dim AudioRecord As JavaObject = r.GetField("audioRecord")
            AGC.RunMethod("create", Array(AudioRecord.RunMethod("getAudioSessionId", Null)))
            Log("AGC set")
        Else
            Log("AGC not available")
        End If
    Catch
        log("SetGainControl, AutomaticGainControl not available")
    End Try
End Sub

Sub SetNoiseSuppressor
    
    Dim ANS As JavaObject
    
    Try 
        ANS.InitializeStatic("android/media/audiofx/NoiseSuppressor".Replace("/", "."))
        If ANS.RunMethod("isAvailable", Null) = True Then
            Dim r As Reflector
            r.Target = audioStream
            
            Dim AudioRecord As JavaObject = r.GetField("audioRecord")
            ANS.RunMethod("create", Array(AudioRecord.RunMethod("getAudioSessionId", Null)))
            log("svc_data::SetNoiseSuppressor, NoiseSuppressor set")
        Else
            log("svc_data::SetNoiseSuppressor, NoiseSuppressor not available")
        End If
    Catch
        log("svc_data::SetNoiseSuppressor, NoiseSuppressor not available")
    End Try
    
End Sub

Hope it helps.

John
 

abbas abedi

Member
Well after struggling for almost 2 years to find a way to eliminate echo in audiostreamer with too many fails. Which seems there is no built in way to avoid echo. When i look at other apps that uses webrtc etc which eliminate echo very well and after too many searches i found that the only way to use a wrapper that works with each audio frames. As the author of this library tried to make a wrapper for such purpose, and seems this wrapped isnt compatible with audiostreamer. Since its required parameters are in short not bytes.

I am ready to pay for a working wrapper that able to filter each audio frame of audiostreamer and eliminate the echo from it. If anyone are able or already have such working wrapper i will be happy to buy it..
thanks john

hi addo

Play with these. Make sure the audio stream is initialized first.
B4X:
    Dim AudioSessionID As Int = R.RunMethod("getAudioSessionId")
    
    Dim NoiseSuppressor As JavaObject
    NoiseSuppressor.InitializeStatic("android.media.audiofx.NoiseSuppressor")
    If NoiseSuppressor.RunMethod("isAvailable",Null) Then NoiseSuppressor.RunMethod("create",Array(AudioSessionID))
    
    Dim AutomaticGainControl As JavaObject
    AutomaticGainControl.InitializeStatic("android.media.audiofx.AutomaticGainControl")
    If AutomaticGainControl.RunMethod("isAvailable",Null) Then AutomaticGainControl.RunMethod("create",Array(AudioSessionID))
    
    Dim AcousticEchoCanceler As JavaObject
    AcousticEchoCanceler.InitializeStatic("android.media.audiofx.AcousticEchoCanceler")
    If AcousticEchoCanceler.RunMethod("isAvailable",Null) Then AcousticEchoCanceler.RunMethod("create",Array(AudioSessionID))

Hope it helps.
 
Top