File file =
this.fileName;int
audioLength = (int)(file.length()); byte[] audio = new byte[audiolength]; try {InputStream is =
new FileInputStream(file);BufferedInputStream bis =
new BufferedInputStream(is);DataInputStream dis =
new DataInputStream(bis); // Read the file into the bufferint i = 0;
while (dis.available() > 0) {
audio[i] = dis.readByte();
i++;
}
// Close the input streams.
dis.close();
AudioTrack audioTrack = new AudioTrack(AudioManager.STREAM_MUSIC,
8000,
AudioFormat.
CHANNEL_CONFIGURATION_MONO,AudioFormat.
ENCODING_PCM_16BIT,audioLength,
AudioTrack.
MODE_STREAM);audioTrack.play();
str = audioTrack.write(music, 0, audioLength);
}
catch (Throwable t) {Log.e(
"AudioOutput","Failed");}