# How to Add Audio Play to my app in Android Studio

**URL:** <https://forum.magicleap.cloud/t/how-to-add-audio-play-to-my-app-in-android-studio/4843>\
**Category:** Native Development\
**Tags:** development\
**Created:** [December 19, 2024, 8:28pm UTC](https://forum.magicleap.cloud/t/how-to-add-audio-play-to-my-app-in-android-studio/4843 "2024-12-19T20:28:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xinyu](https://avatars.discourse-cdn.com/v4/letter/x/67e7ee/32.png) [@Xinyu](https://forum.magicleap.cloud/u/Xinyu)\
**Post date:** [December 19, 2024, 8:28pm UTC](https://forum.magicleap.cloud/t/how-to-add-audio-play-to-my-app-in-android-studio/4843/1 "2024-12-19T20:28:21Z")

</div>

I am developing an app using native development in Android Studio, and I would like to add functionality for streaming WAV files. Specifically, WAV files are generated in real-time and need to be played sequentially on the Magic Leap 2 device. I have referred to the audio-input sample app from the C API folder of ML SDK, but I am not very familiar with the functions used in it, as well as how to store and manage the audio data. I am seeking guidance on the C++ code that handles audio playback on the device, or if there are more detailed resources or documentation on audio playback, that would be very helpful.

**ML2 OS version** : latest  
**MLSDK version** : latest  
**Host OS** : Windows

---

<div class="post-metadata">

**Author:** ![kbabilinski](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/kbabilinski/32/19_2.png) [@kbabilinski](https://forum.magicleap.cloud/u/kbabilinski)\
**Post date:** [December 19, 2024, 9:00pm UTC](https://forum.magicleap.cloud/t/how-to-add-audio-play-to-my-app-in-android-studio/4843/2 "2024-12-19T21:00:52Z")

</div>

Since the Magic Leap 2 supports audio playback using the standard Android 10 audio APIs, you can implement your functionality using Android’s native `AudioTrack` class for streaming and playing WAV files.

Here are some useful links to resources and documentation that can help you with your project:

> **[AudioTrack  |  Android Developers](https://developer.android.com/reference/android/media/AudioTrack)**

> **[Get started with the NDK  |  Android NDK  |  Android...](https://developer.android.com/ndk/guides)**

> **[GitHub - google/oboe: Oboe is a C++ library that makes it easy to build...](https://github.com/google/oboe)**
>
> Oboe is a C++ library that makes it easy to build high-performance audio apps on Android.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/1X/bd9b737a4d45ea243aa7eb177d60a773b806899a.svg) [@system](https://forum.magicleap.cloud/u/system)\
**Post date:** [January 7, 2025, 8:29am UTC](https://forum.magicleap.cloud/t/how-to-add-audio-play-to-my-app-in-android-studio/4843/3 "2025-01-07T08:29:16Z")

</div>

This topic was automatically closed after 18 days. New replies are no longer allowed.
