AudioTrack and LoudSpeaker

abdulla

Member
Licensed User
Longtime User
i am working on small program using audiotrack and audiorecord "Not audiorecorder" libraries,
to take the audio from the microphone and feed it through buffer to audiotrack
Buffer Live , the intention is to hear the voice from the microphone played live in the speaker , i have initialized the Audiotrack this way:

at.Initialize(at.STREAM_MUSIC,SampleRate,atChannelConfig,AudioFormat,buffersize,at.MODE_STREAM)

then i was able to hear just loud noise playing and my voice plays but in low volume, then i changed initializing the audiotrack replacing STREAM_MUSIC WITH STREAM_VOICE_CALL

this way :

at.Initialize(at.STREAM_VOICE_CALL,SampleRate,atChannelConfig,AudioFormat,buffersize,at.MODE_STREAM)

Now i got my voice playing real clear without any noise but playing on the speaker Not the loud speaker.

How can i have my voice played on the loud speaker , i know that when we receive phone call with android there is option on screen "speaker" which turns loud speaker On, how can i accomplish that for the AudioTrack,

i am using pcm_16 with 16 bit and the GetMinBufferSize to get set the buffer size to minimum

any help will be appreciated.

i can post the whole code if any body need to examine
 
Top