For all the examples we have to copy and paste the sounds resources in a fmod/ folder on the SD card root directory; then use:

[code:1oegcv98]result = FMOD_EventSystem_SetMediaPath(gEventSystem, "/sdcard/fmod/");

I would like to know if it’s possible to use the function with a relative path, [b:1oegcv98]without copying manually[/b:1oegcv98] from computer to SD card.
My sound resources are in a folder (assets) and are uploaded with the application on sdcard (don’t know where), and I can’t copy them manually in a specific folder.

How can I specify the relative path of a folder? (like res/)

Thanks for help. :)

  • You must to post comments

Perhaps things have changed, but I was under the impression any assets associated with the project were globbed together and only accessible via a resource API. The only other alternative being reading from the SDCard which obviously requires copying the files. I don’t think it is possible to have loose files inside an Android package and reference them relatively.

  • You must to post comments

Indeed I managed it by copying interesting resources from assets to internal storage, then I was able to provide the entire path to fmod.
If anybody wants to know how to do that, just ask.

Thanks for the answer!

  • You must to post comments

Hi nblondel, could you please share the Java code that copies APK-bundled assets to the /sdcard/ filesystem? I looked into writing a "read callback" on the native C side to pull data from a pointer passed from the Java side (via a JNI byte stream type), but it is too complicated for my current simple experiments. Eventually, it would be nice if the FMOD Android distribution included this feature though.
Kind regards, Daniel

Note that there is a similar question here:


  • You must to post comments

Hi, sorry for my very late anwser.
I managed it with Java code then with Cpp, here are the steps:

[b:l2p4tplw]1) Choose the internal or external storage[/b:l2p4tplw]

[code:l2p4tplw]String PATH = getFilesDir().getAbsolutePath(); //internal path or
String PATH = getExternalFilesDir(null).getAbsolutePath(); //external[/code:l2p4tplw]

I first looked if there was enough memory left in the internal storage, and if not, looked into the external one (if any mounted):

[code:l2p4tplw]StatFs stats = new StatFs(PATH);
long AvailableSize = (long)stats.getAvailableBlocks() * (long)stats.getBlockSize();[/code:l2p4tplw]

PS: You can look for Environment.getExternalStorageState(); having information about mounted SDCard

[b:l2p4tplw]2) Creating the new file[/b:l2p4tplw]

[code:l2p4tplw]File destinationFile = new File(PATH, DEST_FILE);
//DEST_FILE is a String with the name of the file you want to create (can be a folder like "Folder/Folder2/File")

File parent = destinationFile.getParentFile();
if (!parent.exists()) {

AssetManager am = getAssets();[/code:l2p4tplw]

[b:l2p4tplw]3) Copying from assets to new file created[/b:l2p4tplw]

[code:l2p4tplw]InputStream in = am.open(ASSETS_FILE); //Path to the file in the assets, can also be a folder like in step 2

FileOutputStream f = new FileOutputStream(destinationFile);
byte[] buffer = new byte[1024];
int len1 = 0;
while ((len1 = in.read(buffer, 0, 1024)) > 0) {
f.write(buffer, 0, len1); //There is more simple method to copy but this one works fine


[b:l2p4tplw]4) Let FMOD know what path we use with:[/b:l2p4tplw]


Which is:

[code:l2p4tplw]void Java_org_org_application_ActivityName_nativeSetMediaPath(JNIEnv* env, jobject thiz, jstring Path)
char mediaPath[256];
const char* utf_string;

utf_string = env->GetStringUTFChars(Path, NULL);
if (utf_string == NULL) {

strcpy(mediaPath, utf_string);
env->ReleaseStringUTFChars(squidsPath, utf_string);

SoundManager::setSoundPath(mediaPath); //SoundManager is my cpp class using FMOD


In my C++ class, i’ve got:

[code:l2p4tplw]FMOD_EVENTSYSTEM *gEventSystem;
static char SoundPath[256];[/code:l2p4tplw]

And the static method which is called by my native function is:

[code:l2p4tplw]static void setSoundPath(const char pPath[]) {
strcpy(SoundPath, pPath);

THEN I could use the Fmod event method

[code:l2p4tplw]_eventSystem ->setMediaPath(SoundManager::SoundPath);[/code:l2p4tplw]

I hope this is clear, just ask me if you need more precision about something (i’ll check this topic more often)

  • You must to post comments

I’m new to Android development, so this may be a dumb question, but…

Is this thread (and the fmod examples) implying that, unless you do the above workarounds, the only way to use FMOD on android to play sound files is for the user to copy the files to the hardware’s sd card? That can’t be, can it? I have to assume that the biggest use-case for FMOD licensees is for playing audio that’s authored for, and built into, their app.

For example, my application is a game that needs to play sound effects, and just like the original poster, my calls to createSound are failing with "file not found".

Is the above workaround the only way to use developer authored audio files?

  • You must to post comments

You can choose to copy files to the SD card and load by path, or pass data from the Android asset manager into FMOD by pointer. Alternatively you can override FMOD file callbacks and read directly into FMOD buffers.

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.