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

How to use AudioTrack.getTimestamp() on Android to calculate latency?

I see many resources recommending that AudioTrack.getTimestamp() be used on modern Android versions to calculate audio latency for audio/video sync. For…
tmm1
  • 2,025
  • 1
  • 20
  • 35
3
votes
1 answer

How to Set Sample Rate on Text to Speech - Android

In the output of my text to Speech, I need to set Sampling rate about to 32000 Hz with Pitch - 1 and SpeechRate - 0.2 (which I already did). But I can't set Sample Rate. tts = new TextToSpeech(getApplicationContext(), new…
Panchal Deep
  • 247
  • 3
  • 13
3
votes
1 answer

Android: AudioTrack is not working properly

I want to make an activity with a ListView that plays different sound effects when list item is clicked. I tested this feature with MediaPlayer and SoundPool and both work fine. I implemented AudioTrack but when I click an item from the ListView,…
Wasabi.Mayo
  • 169
  • 1
  • 13
3
votes
3 answers

AudioTrack - AudioTack not playing fully recorded audio

I have having an issue where when I recorded an audio, and I clicked on the "Play Back" button, it only plays for about 3 secs and not the fully recorded audio. I have tried increasing the buffer size but it crashes my app instead. Anyone could…
user1730935
  • 311
  • 3
  • 15
3
votes
0 answers

How to record a part of voice when it playing

I have a hard issue about audio recording in android. I used AudioTrack to play my sound when I speak to my phone. I want to record a part in my voice if i press button record. For example, I will speak within 10 seconds. However, I only want to…
Jame
  • 3,746
  • 6
  • 52
  • 101
3
votes
0 answers

Creating a Simple Audio Synth for Android using Audiotrack?

I'm trying to understand the AudioTrack class in Android, and I want to learn how to properly modulate the sound wave I'm generating. I'm using an async task class to run the wave in the background of the UI and I'm able to generate sound. I can…
Lighterletter
  • 209
  • 2
  • 13
3
votes
2 answers

Audio Playback Failed - E/android.media.AudioTrack﹕ Front channels must be present in multichannel configurations

I have not used the audio recording classes of android much before, so i dont really have much knowledge in the area. I have written a little app that will record audio in the background, and then play in back, all in the PCM format (i am doing some…
Fishingfon
  • 1,034
  • 3
  • 19
  • 33
3
votes
0 answers

Tarsos dsp Android AudioTrack plays static or too fast

This problem has been frustrating me for a while. I'm trying to use Tarsos DSP to perform some basic signal processing on a project I'm working on for Android. The audio comes from a standard WAV file that is 44.1k, 16bit stereo. When I set up…
3
votes
0 answers

java.lang.IllegalStateException: Unable to retrieve AudioTrack pointer for write()

I get the following error: java.lang.IllegalStateException: Unable to retrieve AudioTrack pointer for write() and am trying this: // Get the minimum buffer size required for the successful creation of an AudioRecord object. bufferSizeInBytes =…
Diego
  • 4,011
  • 10
  • 50
  • 76
3
votes
1 answer

how to add Audio track to a Video mp4 file android?

I wanted to add audio to a mp4 file,that video doesn't have any audio ,will be added by user selected audio ,How can i achive this?
rKrishna
  • 1,399
  • 12
  • 22
3
votes
2 answers

Android: Audiotrack to play sine wave generates buzzing noise

I've been trying to make this small piece of code work for the past hours. It is meant to be a minimal working AudioTrack example, since I have found that many examples are quiet complicated. private void playSound() { // AudioTrack definition …
Iodestar
  • 198
  • 2
  • 13
3
votes
1 answer

How can I manually change the gain level of an Android AudioTrack stream using a scalar?

I'm using the Android AudioTrack object to stream a 16bit mono PCM file. My code reads a double from a DataInputStream, converts it to 8 bytes, and then saves that 8 bytes to a buffer to be written to the AudioTrack. This works fine. But now, I'm…
3
votes
2 answers

How to convert byte[] to float[] and back in Java?

I'm reading data from .wav files through InputStream, and read() returns bytes. A sound processing library I use, only accepts float[] to process. After it it done it gives me a float[] back. Now I need to write to the Android's AudioTrack in byte…
user717572
  • 3,626
  • 7
  • 35
  • 60
3
votes
1 answer

android Audio Record not playing the whole PCM file

I have my PCM file recorded using. try { DataOutputStream dos = new DataOutputStream( new BufferedOutputStream( new FileOutputStream(recordingFile))); int bufferSize =…
ceosilvajr
  • 185
  • 1
  • 2
  • 10
3
votes
2 answers

How to get volume of AudioTrack in Android?

I can set volume of audioTrack by using track.setStereoVolume(a,b); But i couldn't find a method to to get the volume, either like getStereoVolume() or setOnVolumeChangedHandler(...) How can i track the volume level?
frankish
  • 6,738
  • 9
  • 49
  • 100