Microphone Input in running App on Magic Leap 2

I am currently developing an AI chat and voice conversation application by using Convai plugin for the Magic Leap 2 platform.

I have encountered an issue where the microphone input is not being properly captured when running the app on Magic Leap 2. I am specifically aiming to utilize the microphone input for interactive voice conversations within the app.

Could you please provide guidance on how to enable and access the microphone input from Magic Leap 2 within the app? Are there specific configurations or APIs that I need to implement to ensure proper microphone functionality?

Any assistance or information you can provide regarding this matter would be greatly appreciated.

Thank you for your time and support.

You can obtain microphone input from the Magic Leap the same way you would obtain audio on and Android device.This is by adding and then requesting the necessary permissions. This is done by modifying the AndroidManifest.xml file to include the and then doing a permissions request in UE to make sure the user authorized the application to record the microphone.

Next you can choose if you would like to use a plugin or native Android API or blueprints.

Here are some specific steps for enabling microphone input using the ML Audio plugin that is included in the ML UE 5.3 sdk.

Ensure that you've enabled the Magic Leap Audio plugin-

In Project Settings -> Plugins -> Magic Leap Audio, enable ML Audio Capture and the ML Audio Mixer-

Under Project Settings -> Platforms -> Android -> Advanced APK Packaging, add
com.magicleap.permission.VOICE_INPUT
android.permission.RECORD_AUDIO
to Extra Permissions and check "Add permissions to support Voice chat (RECORD_AUDIO)"-

Ensure that you request (and ideally check) the following permissions at runtime-

At this point, microphone input should work. Here is an example blueprint script that will record from the microphone while the ML2 controller trigger is pressed and then playback the recording when the trigger is released, using the standard AudioCapture component targeting the MasterSubmixDefault submix (so you'll hear an echo as you record)-

Hope that helps!

Best,
Adam

1 Like