I am trying to seamlessly loop an audio file. I was using MP3 which I discovered that MP3’s can’t loop seamlessly due to silent lead-in in the file.
Now tried the following code using OGG and WAV. Sound loops but there is a small (but noticeable) delay between:
AssetFileDescriptor descriptor;
descriptor = getAssets().openFd( "rain30s.ogg" );
mp.setDataSource( descriptor.getFileDescriptor(), descriptor.getStartOffset(), descriptor.getLength() );
descriptor.close();
mp.setLooping(true);
mp.prepare();
mp.start();
OGG and WAV repeat seamlessly in Audacity.
Can anybody help
Your best bet (when sticking to the API) would be a SoundPool.
http://developer.android.com/reference/android/media/SoundPool.html