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
8
votes
3 answers

Streaming MP3 audio via socket communication using OpenSL ES on Android

I'm trying to stream an MP3 from an Android phone to another Android phone using WiFi via an access point. The problem is that OpenSL ES appears to only support PCM audio buffers as the source (unless using a URI). Rather than decoding a potentially…
honeal
  • 1,459
  • 1
  • 18
  • 19
8
votes
2 answers

Use AudioTrack with AudioManager setSpeakerphoneOn

I am using AudioTrack to play the sound I recieve through UDP sockets. I am getting a lot of noise along with the sound so I decided to use AudioManager. But AudioManager changes sound routing beyond the bounds of the application. Below is the code…
SoH
  • 2,180
  • 2
  • 24
  • 53
8
votes
1 answer

AudioTrack - how to know when a sound begins/ends?

I am using Audio track to play a different sounds, in stream mode. I would like to know if there is a way to know when each sound beings/ends playing. I create the audio track like this: AudioTrack tmpAudioTrack = new AudioTrack( …
mikemeli
  • 725
  • 11
  • 24
7
votes
2 answers

How to play left and right channel separately with AudioTrack?

First, I need to generate 2 sine wave tones on the fly which are of same frequency, but opposite phases and play those back separately into right and left channel in stereo mode on Android. The playback needs to be perfectly in sync so that the…
rar
  • 71
  • 1
  • 1
  • 2
7
votes
2 answers

AudioTrack Android playing sounds from raw folder

Is it possible to play wav files with AudioTrack from the resources folder raw? It tried many ways to reference the raw files in my Android project, but I got a lot of exceptions. This is what I have now, but when I press the button, no sound…
pawlinsky
  • 420
  • 1
  • 6
  • 18
7
votes
4 answers

How to change audio tempo and pitch individuality using ffmpeg?

I have managed to play audio files using ffmpeg and AudioTrack class in my android project. I can change the speed of audio using AudioTrack class setRate method. But it also change the pitch of audio, I want to change only Tempo of audio but I…
Vipul Purohit
  • 9,807
  • 6
  • 53
  • 76
6
votes
1 answer

ExoPlayer get available audio tracks and switch between them

I have an android application which streams videos with ExoPlayer. I want to add language support to the streams. What languages the stream will have, must be taken from the stream's metadata. In ExoPlayer library I found the way to get list of the…
oto
  • 383
  • 4
  • 18
6
votes
1 answer

AudioTrack buffer underrun when streaming from bluetooth socket

I am testing the concept of an Android application that allows you to stream Bluetooth over RFCOMM (from PC to phone). I am able to transfer audio from my computer to the phone no problem and start streaming the audio. The problem is that the audio…
KShak
  • 61
  • 3
6
votes
3 answers

AudioTrack release

I am wondering if I need to call release on an audio track? For example, in my following code I instantiate a AudioTrack instance in a method, and do not call release on it (because that stops play). What are the repercussions of this? public void…
Scorb
  • 1,654
  • 13
  • 70
  • 144
6
votes
0 answers

Android Java Save Audiorecord / Audiotrack to a file

I have a short code that streams the recorded audio in realtime to the speakers if the user push the start button. After he pushes the stop button, the buffered audio should be saved in a mp3 file. The file was created but it is empty. If I try to…
user3033136
  • 129
  • 15
6
votes
1 answer

How do I use the new MediaCodec getInputBuffer(int index)

I have an example that I am working from for decoding mp3 audio with MediaCodec for playing using MediaPlayer and AudioTrack. The example is using getInputBuffers() which is now depricated in API 21+. The new getInputBuffer(int index) returns one…
6
votes
1 answer

Unable to retrieve AudioTrack pointer for write()

I am trying to implement AudioTrack to retrieve audio in my android device for incoming call from IAX but facing exception after some while . private void writeBuff(short[] buf) { try { if (this.track == null) { …
6
votes
0 answers

AudioTrack flush() causing static

I'm using an AudioTrack instance to play music. When the user changes songs or seeks within the song I want to flush the buffer before playing the new data. The documentation for stop() seems to guide me towards doing something…
PEZ
  • 16,821
  • 7
  • 45
  • 66
6
votes
1 answer

Android: How to get the current active audio session IDs

I need to get the current Active audio session IDs to attach some audio effects on them. This session is not necessarily created by my process. Is there any interface provided by audioTrack or something else to realize this functionality?
jenny
  • 93
  • 1
  • 6
6
votes
2 answers

Play Audio (mp3, ogg) from sd card with AudioTrack

I want to play audio file from SD card with AudioTrack. I've tried with this code: int minBufferSize = AudioTrack.getMinBufferSize(8000, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT); …
asish
  • 4,767
  • 4
  • 29
  • 49
1 2
3
27 28