android - Why Can't I Play Raw Audio Bytes Using AudioTrack's Static Mode? - TagMerge
1Why Can't I Play Raw Audio Bytes Using AudioTrack's Static Mode?Why Can't I Play Raw Audio Bytes Using AudioTrack's Static Mode?

Why Can't I Play Raw Audio Bytes Using AudioTrack's Static Mode?

Asked 1 years ago
1
1 answers

It seems to me that you are using the same MY_CHOSEN_BUFFER_SIZE for 'streaming' and 'static' mode!? This might explain why it sounds short...

In order to use Audiotracks 'static-mode' you have to use the size of your Byte-Array (bigger will also work) as buffersize. The Audio will be treated as one big chunk of data.

See: AudioTrack.Builder

setBufferSizeInBytes()... "If using the AudioTrack in static mode (see AudioTrack#MODE_STATIC), this is the maximum size of the sound that will be played by this instance."

Source: link

Recent Questions on android

    Programming Languages