Android seamless audio contour

I am trying to easily loop an audio file. I used MP3, which I found that MP3 could not automatically navigate due to silent input to the file.

Now tried the following code using OGG and WAV. Sound loops, but there is a slight (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 seamlessly repeat in Audacity.

Can anybody help

+4
source share
1 answer

Best (if you stick with the API) is SoundPool.

http://developer.android.com/reference/android/media/SoundPool.html

+1
source

Source: https://habr.com/ru/post/1386190/


All Articles