igorski / MWEngine

Audio engine and DSP library for Android, written in C++ providing low latency performance within a musical context, while providing a Java/Kotlin API. Supports both OpenSL and AAudio.
MIT License
257 stars 45 forks source link

Mic sound is very low in few devices #167

Closed YogarajRamesh closed 1 year ago

YogarajRamesh commented 2 years ago

Hi @igorski I am using same mic to test multiple device. In few devices voices is very low/inaudible, In other devices voice is loud and clear. is there anyway to increase the voice for those few device.

I already set inputChannel volume to 1.0f

Thanks in advance

YogarajRamesh commented 2 years ago

Hi @igorski By any chance is there way to amplify the input voice other than setVolume to input channel?

Thanks in advance

igorski commented 1 year ago

Hi @YogarajRamesh

Sadly Android OS does not allow directly setting the microphone volume. What you can do is add some UI to your application where the user can adjust their microphone volume if they notice it is too low.

By adding the Gain processor to the input channels processing chain, you can introduce amplification of the input signal without introducing any sound shaping side effects that change the sound timbre. You can link your UI control to the setAmount( float value)-method of the Gain processor.

Gain gainProcessor = new Gain();
AudioChannel inputChannel = _engineRef.getInputChannel();
inputChannel.getProcessingChain().addProcessor( gainProcessor );
gainProcessor.setAmount( ...floating point value in 0 to 20 range );
YogarajRamesh commented 1 year ago

Hi @igorski, Thanks for your response

error: cannot find symbol Gain gainProcessor ; ^ symbol: class Gain location: class MWEngineActivity

Thanks in advance

igorski commented 1 year ago

It was added in 05b76c07130e1923580cd3e1784bb4c7a583a5ea so you need a fairly recent build of the library.

YogarajRamesh commented 1 year ago

Hi @igorski Thanks for your time

Its working great Thank you so much:)