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
52
votes
1 answer

ExoPlayer AudioTrack Stuttering

I have my own implementation of TrackRenderer for an mp3 decoder, that I integrated. When a lollipop device goes to standby and comes back, it's not always repeatable but the audio starts to stutter until I force stop the application. In the…
Daniel Nuriel
  • 521
  • 3
  • 3
40
votes
5 answers

AudioTrack, SoundPool or MediaPlayer, which should I use?

Should I use AudioTrack, SoundPool or MediaPlayer if I need to be able to: play multiple audio files, with different duration, like 5 to 30 seconds. set the volume independently for right / left channel. apply sound effects, like reverb /…
Fede
  • 1,656
  • 4
  • 24
  • 42
30
votes
1 answer

AudioTrack samplerate inconsistencies

Using AudioTrack for playback, I sometimes need to resample audio that do not conform to the sample rates supported by AudioTrack. In doing so, I need to determine the maximum sample rate supported by AudioTrack, under the current device, under the…
initramfs
  • 8,275
  • 2
  • 36
  • 58
25
votes
3 answers

AUDIO_OUTPUT_FLAG_FAST denied by client

I'm getting this AudioTrack warning AUDIO_OUTPUT_FLAG_FAST denied by client in my Android app for a button I'm subclassing. I can hear a click when tapping on the button so is this anything to worry about? Note: I'm not getting the mismatching…
Snowcrash
  • 80,579
  • 89
  • 266
  • 376
21
votes
1 answer

How to addTrack in MediaStream in WebRTC

I'm using webrtc to communicate between to peers. I wan't to add new track to old generated stream, as I wan't to give functionality to users to switch their microphones during audio communications. The code I'm using is, Let "pc" be the…
Akshay Rathore
  • 819
  • 1
  • 9
  • 23
21
votes
4 answers

Immediate Audio Input & Output Android

In my Android App, I would like to take in some audio from the mic of the smartphone and play it immediately, live, like a microphone, with no lag. I am currently thinking of using AudioRecord and AudioTrack classes (from what I have read), but I'm…
Adifyr
  • 2,649
  • 7
  • 41
  • 62
20
votes
2 answers

PCM Raw Bytes [] To Audio on Android

I currently have a PCM audio in the form of a byte array. The format is signed 16 bit little endian. I would like to convert this to some playable format on the Android, preferably version 3.2 or higher. Does anyone have suggestions on how this can…
ShannonS
  • 354
  • 1
  • 4
  • 13
19
votes
3 answers

Play looping audio using AudioTrack

I have a feature I want to transition over to use Androids AudioTrack instead of MediaPlayer, due to a few well known bugs with MediaPlayer, such as the small gap that appears between looping tracks. I've been recommended to use AudioTrack but…
Orbit
  • 2,985
  • 9
  • 49
  • 106
17
votes
4 answers

AudioTrack restarting even after it is stopped

I created a simple application that generates a square wave of given frequency and plays it using AudioTrack in STREAM mode (STREAM_MUSIC). Everything seems to be working fine and the sound plays okay, however when the stream is finished I get…
Chris Koston
  • 975
  • 2
  • 9
  • 22
17
votes
4 answers

How to convert .pcm file to .wav or .mp3?

I am currently developing an Android Application that has audio recording and playing. I am new to dealing with audio and I'm having some trouble with encoding and formats. I am able to record and play the audio in my application, but when…
filipebarretto
  • 1,842
  • 1
  • 13
  • 27
17
votes
2 answers

Android : How to change Playback Rate of music using OpenSL ES

I am working on a music player in which I need to change tempo (playback speed of music) without changing the pitch. I'm not able to find any native android class to do so. I tried SoundPool but it doesn't work with large music files and it also…
Vipul Purohit
  • 9,807
  • 6
  • 53
  • 76
16
votes
2 answers

SoundPool error: no more track names available

I'm having troubles with the soundpool class. Here it goes: In my game app (music app btw) I need to reproduce at least 32 short sounds at the same time, so I declare my soundpool like that: private SoundPool sp; sp = new SoundPool(128,…
Carles
  • 451
  • 5
  • 16
15
votes
2 answers

How to tell when AudioTrack object has finished playing?

I'm trying to play a PCM file in Android using the AudioTrack class. I can get the file to play just fine, but I cannot reliably tell when playback has finished. AudioTrack.getPlayState says playback has stopped when it hasn't finished playing. I'm…
TalkieTalk
  • 151
  • 1
  • 4
15
votes
2 answers

Audio streaming via TCP socket on Android

I am streaming mic input from a C Server via socket. I know the stream works because it does with a C client and I am getting the right values on my Android client. I am streaming a 1024 floatarray. One float are 4 bytes. So I got a incoming stream…
tritop
  • 1,655
  • 2
  • 18
  • 30
13
votes
2 answers

Issue encoding and decoding an audio recording to G711 ( PCMU - uLaw) format

There isn't too much info about apply this codec when we need to streaming audio. Without apply the codec, my code work like a charm establishing a communication between 2 devices but I need encode/decode in that format because I will need streaming…
Juan Pedro Martinez
  • 1,924
  • 1
  • 15
  • 24
1
2 3
27 28