Hi, i’m creating an android ambient sound wrapper engine using fmod. All is working good so far but i can’t seem to figure out a good and efficient way to achieve seamless looping with user-given content. I’ll explain:
my app needs to take any kind of sound from a user, which means it will probably not be a good looping sound (with unknown duration too), so i wanted to create a sort of crossfade/seamless loop system, and the way i was doing it before (i was using android mediaPlayer) was just creating 2 instances of the same sound — when one instance was about to end, it faded out and the secondary faded in. Of course that’s a waste of resources, so i’m curious if fmod offered a good way to do this. At the moment I’m trying to create 2 channels that use the same sound in memory and using fadepoints (i’ll probably change the volume in an update method since fadepoints are linear which is not what i want). Thanks
Anyone please? At the moment i have to create 2 streams so the problem is basically the same. I need to play many sounds together and to make them crossfade with themselves like this i need 2 of the same sounds streaming at the same time and i don’t think that’s good. Especially when i need to support 15 concurrent sound. (That would mean 30 concurrent streams if they were all crossfading)
Still stuck on this
If resource management is really tight, it would be best to ensure that the asset being used can already seemlessly loop on itself and use it as an asynchronous instrument. You can keep it triggered either with a sustain point or a loop region.
Just so you know, FMOD will only load assets into memory when they are triggered. So even if you use two separate instruments of the same asset to fade into each other, it would unload the last instrument once it is no longer triggered.
I apologize but i don’t think i’m understanding this… I don’t know what you mean by instruments, did you mean channels?.. I’m only using the FMOD core API and as i said the sounds will be user given, which means it will probably not be a good looping sound (with unknown duration too)… I’m not using FMOD studio, nor the users. Just the fmod core API…
At the moment my solution of using 2 streams of the same sound and crossfading them is working, it’s just not good for performance i think, since for 15 sounds if they are all crossfading there could be 30 streams playing concurrently in that crossfading timespan …
I see, in that case you do have the most optimal solution. There isn’t anything in the FMOD API that allows you to crossfade a sound in on itself. You can use the Profiler to check on the performance but 30 streams at once should be fine, depending on the size of the audio files used.
Understood… Thank you very much then… I’ll see what i can do.