Search code examples
androidaudiosoundpoolaudiotrack

Android mixing raw sounds. Source is java arrays not files or recourses


I have audio data in uncompressed raw format as java arrays. short[] or byte[] I wish to play them in Android.

SoundPool looks like what I need but I can't find way to load data from memory. It loads from files only and I am not sure how do I specify format that it is raw data.


Solution

  • The AudioTrack class has write(...) methods which accept byte[] or short[] as the source parameters. It's the only Android sound class I know of that does.