# Using MediaPlayer or SoundPool

**URL:** <https://discourse.processing.org/t/using-mediaplayer-or-soundpool/1080>\
**Category:** Processing for Android\
**Created:** [June 19, 2018, 2:12pm UTC](https://discourse.processing.org/t/using-mediaplayer-or-soundpool/1080 "2018-06-19T14:12:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CrispyCabot](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@CrispyCabot](https://discourse.processing.org/u/CrispyCabot)\
**Post date:** [June 19, 2018, 2:12pm UTC](https://discourse.processing.org/t/using-mediaplayer-or-soundpool/1080/1 "2018-06-19T14:12:28Z")

</div>

So for like the last couple hours I have been trying to figure out how to play an mp3 file in my app. Everything I have tried looking up has like a hundred lines of code and I don’t even know what it is doing. I have never tried using outside libraries before in processing so I think this could be causing some confusion for me too.  
The best that I’ve found that would maybe work is this:

```auto
MediaPlayer mp = new MediaPlayer();
mp.setDataSource("/mnt/sdcard/yourdirectory/youraudiofile.mp3");
mp.prepare();
mp.start();

```

which I found [here](https://stackoverflow.com/questions/16715003/simple-mediaplayer-play-mp3-from-file-path).

But from this, I don’t know what the file path would be to the mp3 file in the data folder.

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [June 19, 2018, 11:12pm UTC](https://discourse.processing.org/t/using-mediaplayer-or-soundpool/1080/2 "2018-06-19T23:12:20Z")

</div>

There are a couple of strategies as far as I understand, which I presented in a previous post of yours: [Tracking high score for android](https://discourse.processing.org/t/tracking-high-score-for-android/678/3)

If you place your mp3 file in the data folder, you should be able to do this:

`mp.setDataSource(dataPath("youraudiofile.mp3"));`

You can also use the assets manager. Or explore examples working with external storage options.

Here I have an example playing sound tested on Android: [A sound play exemplar please?](https://discourse.processing.org/t/a-sound-play-exemplar-please/416/5)

Notice that there might be some changes in Android Mode version 4.0.2 that Andres have implemented, as discussed [here])([https://github.com/processing/processing-android/issues/450#issuecomment-398517160](https://github.com/processing/processing-android/issues/450#issuecomment-398517160)).

Kf
