superpoweredSDK/Low-Latency-Android-iOS-Linux-Windows-tvOS-macOS-Interactive-Audio-Platform

How to get MIC input and listen to the provided input at the same time from headphones/speakers on Android

shanalishams opened this issue · 7 comments

How to get MIC input and listen to the provided input at the same time from headphones/speakers on Android

I am using following configuration for initializing the audio engine

image

You need to focus on the audio processing callback. One of its arguments is the input buffer, it will contain the microphone input. Another argument is the output buffer. If you simply copy the input buffer's contents into the output buffer, you will hear it back.

In Android, this audio-processing callback has only an output buffer argument and no input argument so how I will copy the input buffer's content into the output buffer as there is no input buffer. Please look at the picture below to understand

image

And I am using the Volumn utility to capture mic audio like the following screenshot.

image

but still I am not able to hear back the sound from the mic

audioIO is both the input buffer and the output buffer on Android.
In your code you copy "audio" into "stereoBuffer", so your result is in "stereoBuffer", not "audio".

Following is my full code snippet can you please tell me what wrong I am doing in the code please???

image

I am again copying the content of the stereo buffer to audio at the end. But I am not able to hear back my sound from the mic through the speakers.

I need to deliver a feature in development because of this issue I am stuck :(

Your code snippet looks good. Maybe you forgot some basic Android stuff, such as asking for microphone permission in Java? Also check the manifest.

I was missing the microphone permission in the app once I enabled the microphone permission I was able to get my voice back from the speakers hence my issue is resolved. Thank you for actively coordinating with me on this.