Questions tagged [audiotrack]

AudioTrack class in standard Android API for playing back raw Audio.

AudioTrack class in standard Android API for playing back raw Audio.

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

419 questions
13
votes
2 answers

What should be reasons to use OpenSL ES instead of AudioTrack in Android?

Currently I'm using AudioTrack passing to it audio data from native layer to play. It seems I can use OpenSL ES in the native layer instead of AudioTrack in Java. What are the supposed advantages OpenSL ES gives as opposed to AudioTrack?
Alexander Kulyakhtin
  • 47,782
  • 38
  • 107
  • 158
13
votes
2 answers

Frames to milliseconds conversion in android

In Android the getPlaybackHeadPosition() method of AudioTrack class returns the playback head position expressed in frames ,what is its equivalent value in milli seconds?
Raneez Ahmed
  • 3,808
  • 3
  • 35
  • 58
11
votes
1 answer

Android MediaCodec not decoding all input buffers

In Android 4.4.2, I am using MediaCodec to decode mp3 files. I'm using queueInputBuffer() to queue an input mp3 encoded frames and dequeueOutputBuffer() to get the decoded frames. But decoder gives decoded output from 8th frame onwards ( based on…
nmxprime
  • 1,506
  • 3
  • 25
  • 52
11
votes
2 answers

Using a buffer with Android AudioTrack

I'm trying to figure how I would use a buffer with AudioTrack to effectively stream music. I know you can queue audio using the write method but once the audio is queued how do you tell how much is left vs. how much has been used/played? Sorry if…
William Seemann
  • 3,440
  • 10
  • 44
  • 78
10
votes
1 answer

Calculate FFT from audio file

Before, I asked question about Get frequency wav audio using FFT and Complex class , There, I need to calculate FFT value from AudioRecord input --> from microphone , I somehow managed to get the FFT value... Now I need to calculate FFT value from…
raisa_
  • 594
  • 2
  • 10
  • 28
10
votes
4 answers

How do you determine the audio latency (AudioTrack) on Android?

I have an app in which I use an AudioTrack in streaming mode to play dynamically generated audio. The app doesn't have to respond instantaneously to inputs, so the latency issues don't bother me for that side of the program. The problem is that I…
jnpdx
  • 45,847
  • 6
  • 64
  • 94
10
votes
3 answers

AudioTrack: play() called on uninitialized AudioTrack

I'm experimenting with AudioTrack class. Basically, my app has to generate a sound when the user touches a specific object on screen. I've used this example as a guide. My app seems to work as it should but usually after touching the screen for…
droid8421
  • 895
  • 1
  • 13
  • 26
9
votes
2 answers

SoundPool "AudioFlinger could not create track, status: -12"

I have an Android app with single button. When the button is clicked, the app starts playing (looping) sound loaded with SoundPool. When the button is clicked again, the sound is stopped, and then started again. But the problem is that the sound is…
TuomasK
  • 502
  • 3
  • 11
9
votes
4 answers

How to play InputStream of an audio file that's not within a url or storage?

Background I've succeeded uploading an audio file (3gp) into Google-Drive. Now I want to be able to play the file within the app. The Google Drive API only allows to get the input stream of the file that's stored there. The problem All MediaPlayer…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
9
votes
2 answers

Android AudioTrack does not play all samples

I'm using AudioTrack to play a sequence of sine waves, but when I run it on my HTC M9, it plays only part of the samples, and how long it will play is random. e. g. I have 20 tones to play, but it only plays like 2 to 17.5 tones of them. And yes it…
Romulus Urakagi Ts'ai
  • 3,699
  • 10
  • 42
  • 68
9
votes
2 answers

Android : Playing MP3 files with AudioTrack using ffmpeg

I have integrated ffmpeg lib in my project and I can also get the information of media files. But now i have to play mp3 files using AudioTrack class in android using ffmpeg lib. For this I have to pass byte buffer to AudioTrack but I dont know how…
Vipul Purohit
  • 9,807
  • 6
  • 53
  • 76
8
votes
1 answer

Memory leak of AudioTrack

I encountered a severe problem of memory leak when AudioTrack and MediaSync are used together. It seems to me, the problem is that AudioTrack doesn't release some native resources. As a result, the app can be run only several times, after that,…
Anton
  • 560
  • 6
  • 21
8
votes
0 answers

Android AudioTrack.onPlaybackPositionUpdateListener not always firing on time

I have noticed that AudioTrack.setPlaybackPositionUpdateListener() sometimes does not seem to work as intended (at least in Android Studio emulators from API 19-22). I've made a little test program that has a button that when pressed, starts feeding…
Nerdy Bunz
  • 6,040
  • 10
  • 41
  • 100
8
votes
2 answers

AudioManager is introducing delay in the setMode(MODE_IN_COMMUNICATION)

I am trying to play sound on speaker even if headphones are on, BUT if there is music playing in background, I want the music to be played on headphones until the sound is played. So I am taking the next steps: Before I play sound, I gain…
8
votes
3 answers

Android audio programming nightmare - soundpool, audiotrack arrghh?

I've built a simple music sequencer Android app that plays multiple audio files. Originally I was using SoundPool to play mp3 files and it worked perfectly on 2.3.4 with an old HTC Droid Incredible. Then I tested it on a Galaxy Nexus running 4.3 and…
fxfuture
  • 1,910
  • 3
  • 26
  • 40
1
2
3
27 28