[android-developers] Re: AudioTrack

2013-09-11 Thread Nobu Games
From the documentation of AudioTrackhttp://developer.android.com/reference/android/media/AudioTrack.html : It allows streaming *PCM audio buffers* to the audio hardware for playback. PCM is basically uncompressed audio data. MP3 is compressed audio that's why you hear noise. You have two

Re: [android-developers] Re: AudioTrack

2013-09-11 Thread Yamusani Vinay
But how to decode mp3 file to pcm programatically On Wed, Sep 11, 2013 at 5:53 PM, Nobu Games dev.nobu.ga...@gmail.comwrote: From the documentation of AudioTrackhttp://developer.android.com/reference/android/media/AudioTrack.html : It allows streaming *PCM audio buffers* to the audio

[android-developers] Re: AudioTrack: thread safety of operations?

2012-09-07 Thread Tamás Kovács
Anyone? (to the last but one question, even) Thanks in advance On Sep 7, 2:55 am, Tamás Kovács falcon.firebre...@gmail.com wrote: And what about e.g. setStereoVolume() ? It sounds a bit strange that the current write() operation must finish before setStereoVolume() can be called, but if you

[android-developers] Re: AudioTrack: thread safety of operations?

2012-09-06 Thread Lew
Tamás Kovács wrote: The documentation says that AudioTrack.write() is thread-safe in terms of stop(). What about the other operations? As far as I can see, e.g. play() and pause() should also be callable from another thread. write() is blocking, so it does not make much sense to call

[android-developers] Re: AudioTrack: thread safety of operations?

2012-09-06 Thread Tamás Kovács
OK, thanks. So you're basically saying that if I want to call e.g. pause()+flush() on an AudioTrack, I need to guarantee that write() is atomic in terms of my pause() and flush() call, right? To be brief, (per the docs), only a stop() call is allowed to execute while a write() is in progress. Is

[android-developers] Re: AudioTrack: thread safety of operations?

2012-09-06 Thread Tamás Kovács
And what about e.g. setStereoVolume() ? It sounds a bit strange that the current write() operation must finish before setStereoVolume() can be called, but if you say so. On Sep 7, 2:44 am, Tamás Kovács falcon.firebre...@gmail.com wrote: OK, thanks. So you're basically saying that if I want to

[android-developers] Re: AudioTrack class only plays the first half of sound track

2012-02-20 Thread dara kok
additional observation: a system call to GG_EXPLICIT is made before the audio stop playing. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this

[android-developers] Re: AudioTrack in MediaController

2012-02-08 Thread Doug
On Feb 8, 8:01 am, Raneez rane...@gmail.com wrote: I used mediaplayer to play audio files using the MediaController..its easy to show mediacontroller from the MediaPlayer.OnPrepared(MediaPlayer mp) method when the file is ready for playback. But I need to use AudioTrack as player for Wav

[android-developers] Re: AudioTrack to play actual stereo (left, right channel separately)?

2012-01-10 Thread niko20
You dont need a separate buffer for right and left. Stereo audio is interleaved. To ouput stereo you just fill the buffer with left-right- left-right On Jan 8, 4:36 pm, rar raigom...@gmail.com wrote: Hi, I'm trying to figure out if it is at all possible to get AudioTrack to play actual

[android-developers] Re: AudioTrack to play actual stereo (left, right channel separately)?

2012-01-10 Thread rar
Thanks for your help, niko20. Stereo working well now. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to

[android-developers] Re: AudioTrack: changing audio while playing

2011-08-03 Thread Doug
You probably just need to google for libraries that process PCM data to apply effects. What you're asking is not specific to Android, since AudioTrack and AudioRecord just deal with raw PCM data. Doug On Aug 2, 6:17 am, nicoletto nicobales...@gmail.com wrote: Hi there, I've spent days already

Re: [android-developers] Re: AudioTrack help - pause after mute

2011-06-18 Thread Stefan Alder
Below is the gist of what I'm trying. This works sometimes, but other times I get a glitch when trying to play-- the glitch appears to be anywhere from a few ms to 20 ms or so of the PCM data (possibly from what it previously played, or was about to play before paused), and immediately precedes

[android-developers] Re: AudioTrack help - pause after mute

2011-06-17 Thread Doug
Are you using stream or static mode? With stream, you need to feed the AudioTrack a stream of zeroes to get it to silence without clicking. I don't think that you can pause in stream mode, but I might be wrong. Doug On Jun 15, 5:27 pm, Stefan Alder twigbra...@gmail.com wrote: I need to pause

Re: [android-developers] Re: AudioTrack help - pause after mute

2011-06-17 Thread Stefan Alder
Doug, I'm using MODE_STATIC as the latency is too high with MODE_STREAM. On Fri, Jun 17, 2011 at 10:38 AM, Doug beafd...@gmail.com wrote: Are you using stream or static mode?  With stream, you need to feed the AudioTrack a stream of zeroes to get it to silence without clicking.  I don't think

[android-developers] Re: AudioTrack flush() does not work

2010-08-26 Thread niko20
You'll have to create a new instance of the AudioTrack I think. Flush doesn't erase data, it simply finishes writing out any data that was in the internal buffers. -B On Aug 26, 4:08 pm, sasq jonas.minnb...@gmail.com wrote: I am calling stop(), flush(), start() on my audiotrack when changning

[android-developers] Re: AudioTrack flush() does not work

2010-08-26 Thread sasq
Actually, flush() is for discarding unplayed data. It's not clear at all from the documentation but if you read the source it becomes clearer. Anyway, I found a workaround - a call to Thread.sleep() after flushing forces the flush to take effect. play() directly after flush() seems to cancel the

[android-developers] Re: AudioTrack in streaming mode

2010-04-05 Thread ani
You can use audiomanager apis to do what you are trying to do... -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to

[android-developers] Re: AudioTrack in streaming mode

2010-04-05 Thread Simone
Allright, I'll give it a try, thanks Simone On 5 Apr, 08:43, ani anish198519851...@gmail.com wrote: You can use audiomanager apis to do what you are trying to do... -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group,

[android-developers] Re: AudioTrack lag

2010-02-21 Thread ani
Things like ring buffers are still the same idea, but I won't explain how they're the same, because it would make the explanation more confusing. Just hold onto the core idea -- the receiver and sender of data each have their own buffers. Heartfelt thanks for this great explanation. I am a

[android-developers] Re: AudioTrack lag

2010-02-21 Thread Bob Kerns
I haven't read the code (not even the Java side). I can only guess that in streaming mode it allocates a buffer it manages as a ring buffer, or something like that. But I'd expect that to only happen at startup. Any delays in write() calls I'd expect to be simply waiting for room to copy the

[android-developers] Re: AudioTrack lag

2010-02-20 Thread Bob Kerns
Well, I say again that blocking/non-blocking really has nothing to do with how quickly you can respond. When you queue data up to be played, whether via a blocking call, or a non-blocking call, at some point, you no longer have the ability to abort. The distance in the pipeline between that

[android-developers] Re: AudioTrack lag

2010-02-19 Thread Bob Kerns
When you stream buffered data, you have a minimum of two buffers -- at least conceptually. (You can implement it somewhat differently, but it boils down to the same thing the way I look at it). You fill up one buffer, and give it off to the system or the hardware or another thread. While it is

[android-developers] Re: AudioTrack lag

2010-02-19 Thread Bob Kerns
Why do you have to call allocate/release? Why not just allocate enough for your purposes, and suballocate within? I can definitely see that it'd be a pain to maintain both blocking and non-blocking versions of your code. Even the cognitive shift would be a pain. But aside from that, my

Re: [android-developers] Re: AudioTrack lag

2010-02-19 Thread Steve Lhomme
On Fri, Feb 19, 2010 at 7:15 PM, Bob Kerns r...@acm.org wrote: Why do you have to call allocate/release? Why not just allocate enough for your purposes, and suballocate within? Because I first assumed the AudioTrack would be non blocking (from past experience). And so I thought that the buffer

[android-developers] Re: AudioTrack lag

2010-02-18 Thread ani
we would really appreciate if you can explain both buffers?Which buffers are you referring here. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from

[android-developers] Re: AudioTrack lag

2010-02-18 Thread ani
we would really appreciate if you can explain both buffers?Which buffers are you referring here. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from

[android-developers] Re: AudioTrack lag

2010-02-18 Thread ani
we would really appreciate if you can explain both buffers?Which buffers are you referring here. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from

[android-developers] Re: AudioTrack lag

2010-02-18 Thread ani
we would really appreciate if you can explain both buffers?Which buffers are you referring here. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from

[android-developers] Re: AudioTrack lag

2010-02-17 Thread Bob Kerns
The 70 ms here isn't due to the blocking nature, but due to the buffer size. With a 2.5 ms buffer size, you'd be able to stop the sound in 5ms even when both buffers were full. It really has nothing to do with blocking/non-blocking, which simply has to do with who has to do the blocking and

Re: [android-developers] Re: AudioTrack lag

2010-02-17 Thread Steve Lhomme
I already use a separate thread to feed the audio chunks. For efficiency it's writing many chunks at once before going to sleep. It works well on all the platforms I mentioned because they all support non-blocking calls, in fact I'm not sure any of them support blocking calls at all. As for

[android-developers] Re: AudioTrack lag

2010-02-17 Thread niko20
What is the name of your program again? Because just hearing that you are calling the AudioTrack from inside the NDK makes me NOT want to every grab a copy of your program. The headers aren't stable and it will break in the future (high risk anyway). There's no need to do that anyway, you can

Re: [android-developers] Re: AudioTrack lag

2010-02-17 Thread Steve Lhomme
Our program is CorePlayer and is well known for being a great audio/video player for mobile platforms. As the title of the thread says, I use AudioTrack which is a *java* API. Wether I call it from JNI or within dalvik doesn't make any difference. On Wed, Feb 17, 2010 at 10:10 PM, niko20

[android-developers] Re: AudioTrack lag

2010-02-16 Thread Bob Kerns
From your description, it sounds like everything is happening just as designed, and as it should, and that the only problem is that you feel your program isn't complicated enough. Is that a fair assessment? You get the right result. Your code spends most of its time waiting for the hardware,

Re: [android-developers] Re: AudioTrack lag

2010-02-16 Thread Steve Lhomme
First of all, it's written nowhere that the AudioTrack is a blocking system. Second, when there are 2x the hardware minimum size buffered there is no reason why adding that amount should result in audio artifact. So wether it feels nice or not, that API is not working as advertised. Now about

Re: [android-developers] Re: AudioTrack lag

2010-02-16 Thread Steve Lhomme
2010/2/17 Steve Lhomme rob...@gmail.com: First of all, it's written nowhere that the AudioTrack is a blocking system. My bad, I just read http://developer.android.com/reference/android/media/AudioTrack.html again. And it indeeds says that the streaming mode is blocking. In Streaming mode, the

[android-developers] Re: AudioTrack - Clicking Proplem

2010-01-24 Thread ani
You can dump the buffers in audioflinger and play it in some raw pcm player and find out if you are not giving the PCM data properly or there is some problem with playing back. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this

[android-developers] Re: AudioTrack - Clicking Sound

2010-01-04 Thread Business Talk
After, repeated effort at sound synthesis I have decided to go back to pre=generated sounds. It's much too computationally expensive. My question is; does AudioTrack use pure pcm of it uses wave. I have this clicking sound and I think it's because I am using wave and the wave is pcm plus same

[android-developers] Re: AudioTrack stop/release

2009-12-29 Thread Business Talk
Thanks Olivier, It is very helpful Olivier, I am just curious about MP3 players, They are able to stop playing with a very small latency. It seems like they would have to repeatedly write into a very small buffer. Do you think that is the case? My scenario is very similar to the MP3 players. I

[android-developers] Re: AudioTrack stop/release

2009-12-28 Thread rageman
What is the size of your stream buffer? And what is the size of the NotificationPeriod buffer? On 25 Dec, 14:00, Business Talk roman.businesst...@gmail.com wrote: I keep posting this message hoping that maybe somebody from google (media group in particular) monitors the group.  I need to stop

[android-developers] Re: AudioTrack - Doesn't stop playing as requested.

2009-12-23 Thread Business Talk
Thanks Fabricio, Unfortunately, It doesn't work either. Good Luck On Dec 22, 9:27 am, Fabricio fabricio.tuo...@gmail.com wrote: Not been very familiar with it but maybe you could pause it and then proced to stop and release. Salutes. Fabricio Tuosto On Tue, Dec 22, 2009 at 11:22,

[android-developers] Re: AudioTrack - Clicking Sound

2009-12-21 Thread Business Talk
Mark, Yours is a golden tip. In a long run using files is out of the question, considering the size of the application it would generate. Your approach is definitely the way to go. I just have no experience in the sound synthesis, Specifically synthesizing instrument sounds. Do you have any

[android-developers] Re: AudioTrack stop/release

2009-12-19 Thread Business Talk
Thanks Niko, tried everything, including flushing, nothing works. On Dec 16, 3:38 pm, niko20 nikolatesl...@yahoo.com wrote: Hi, try calling flush() just before stop, release. Otherwise I don't know - it's why the size of buffer you choose is important, big enough to not gap out, but small

[android-developers] Re: AudioTrack - Clicking Sound

2009-12-16 Thread MarkNZ
Do you need to use files? I have been generating audio at run time using the java math sine function to create an array of short, then playing it with audio track. Perfomance has been fine, I have been testing on an HTC tattoo. The only problem I have found is when I record the the data being

[android-developers] Re: AudioTrack cutting audio short.

2009-12-16 Thread niko20
Hi, Have you seen any error messages in logcat? Did you make sure to call getMinBufferSize() before you load the Audiotrack, to make sure you are allocating the correct amount of buffer? -niko On Dec 15, 7:36 pm, MarkNZ mbutler...@gmail.com wrote: Hi, I am trying to play a 0.1s tone using

[android-developers] Re: AudioTrack cutting audio short.

2009-12-16 Thread niko20
Also, be aware that in STREAM mode that sounds won't play until the buffer is full. If your buffer is bigger than your sound then you have to write out zero's to finish filling it. In Stream mode you can certainly write before calling play(), but nothing will play until that buffer is full. I

[android-developers] Re: AudioTrack stop/release

2009-12-16 Thread niko20
Hi, try calling flush() just before stop, release. Otherwise I don't know - it's why the size of buffer you choose is important, big enough to not gap out, but small enough to be responsive. -niko On Dec 15, 11:33 pm, Business Talk roman.businesst...@gmail.com wrote: It doesn't seems as if the

[android-developers] Re: AudioTrack cutting audio short.

2009-12-16 Thread MarkNZ
Thanks for your reply, I set the buffer to be exactly twice the length of the array of shorts, and ensure that it is still greater than the min buffer size, but this doesn't seem to change anything. Logcat doesn't contain any errors ... On Dec 17, 9:35 am, niko20 nikolatesl...@yahoo.com wrote:

[android-developers] Re: AudioTrack cutting audio short.

2009-12-16 Thread niko20
So you are saying it doesn't work if the buffer is exactly the same size as the data you are writing? Also double check your data sizes, you are writing shorts so make sure if the buffersize is to be expressed in shorts or in bytes. One last thing, java is big endian, try to check that the buffer

[android-developers] Re: AudioTrack - Clicking Sound

2009-12-15 Thread niko20
Hi, I use AudioTrack for several projects and haven't had a problem. However, as I was learning to use it, I had lots of small issues related to: 1. Not filling the buffer correctly as you think - double check your code. Even if you are missing one PCM sample you will get a click. 2. If using

[android-developers] Re: AudioTrack - Clicking Sound

2009-12-15 Thread Business Talk
Niko, I have redone all the test pcm files using the Audiocity and the click is still there. Maybe it’s the driver. I have my development environment on a virtual server. I am creating the track in a static mode so there should not be any gaps. since it’s one track per pcm. I will keep digging.

[android-developers] Re: AudioTrack

2009-12-14 Thread niko20
You create two AudioTrack instances, then in each you pass a playback listener object, I don't see why you can to multiples at once.. -niko On Dec 14, 7:27 am, Business Talk roman.businesst...@gmail.com wrote: Is the AudioTrack fundamentally designed to be a singleton? Methods on the

[android-developers] Re: AudioTrack

2009-12-14 Thread Business Talk
I was just testing the capabilities at this stage. I wanted to see if it can be done at all. There are many applications I can think of that require such capability. On Dec 14, 4:00 pm, niko20 nikolatesl...@yahoo.com wrote: You create two AudioTrack instances, then in each you pass a playback

[android-developers] Re: AudioTrack::start called from thread

2009-12-08 Thread niko20
Hi, There is no limitation on running AudioTrack in a thread, I do it all the time, it must be something else going on. One thing you may want to try is to create the AudioTrack object and start() it in the same thread. Perhaps it doesn't like being created in a different thread than start() is

[android-developers] Re: AudioTrack::start called from thread

2009-12-08 Thread niko20
Actually if you look through the source code to AudioTrack, it looks like so: void AudioTrack::start() { spAudioTrackThread t = mAudioTrackThread; LOGV(start); if (t != 0) { if (t-exitPending()) { if (t-requestExitAndWait() == WOULD_BLOCK) {

[android-developers] Re: AudioTrack::start called from thread

2009-12-08 Thread Business Talk
Thanks, I do create the AudioTrack object in a different thread. As a matter of fact I create a new thread for every new pcm I play using the AudioTrack . I will try to use a single thread and see how it goes. Right now I am ising a single AudioTrack to play the sounds. is it possible to create a

[android-developers] Re: AudioTrack sanity test

2009-12-04 Thread Kevin
I am pushing for better audio support in the NDK in Android Bug 3434. http://code.google.com/p/android/issues/detail?id=3434 Kevin -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to

[android-developers] Re: AudioTrack usage with streaming data in native code

2009-11-16 Thread Stoffe
Hi! It all depends on the frequency you set. For 8000 Hz 8 bit PCM, 160 should be good and for 16 bit you should provide the double e.g 320. This is for mono so make sure that you are using the same settings at both ends. //Stoffe On Nov 10, 11:00 pm, Bytes toyvenu.t...@gmail.com wrote: Hi,

[android-developers] Re: AudioTrack usage with streaming data in native code

2009-11-10 Thread Lee Duncan
HElp!! Is there anyone know how many size of data i need to fill into AudioTrack write()? Please Help Big Thanks!! 2009/11/9 DuncanLee aqaqaq...@gmail.com Dear All, I connect one streaming application voice output to android AudioTrack in native code layer (C

[android-developers] Re: AudioTrack usage with streaming data in native code

2009-11-10 Thread Bytes
Hi, Why can't you try AudioTrack's write() function ? On Nov 9, 6:51 am, DuncanLee aqaqaq...@gmail.com wrote: Dear All,    I connect onestreamingapplication voice output to androidAudioTrackin native code layer (C code). But I can heard voice loop. if i put each frame(160bytes)

[android-developers] Re: AudioTrack sanity test

2009-10-05 Thread niko20
Hi BD, I would go the NDK route for generating your sound, but for now you will have to pass the data back to the java layer to play it, I dont think the Audio APIs are the NDK yet. Yes you have noticed you can't play too many at once with AudioTrack. This is a phone CPU speed issue. You can

[android-developers] Re: AudioTrack question

2009-10-01 Thread Tim Newsham
On Sep 29, 11:06 am, Tim Newsham tim.news...@gmail.com wrote: How do the position marker notifications work?  They seem to be measured in frames, what is a frame?  Where can I find documentation on frames? No reply so I'll answer my own question for those playing along at home: A frame seems

[android-developers] Re: AudioTrack question

2009-10-01 Thread niko20
I dont think you can write non-blocking. It's actually an advantage since you can just create a thread that keeps pumping data into the buffer and waits for the write to complete. -niko On Oct 1, 9:56 pm, Tim Newsham tim.news...@gmail.com wrote: On Sep 29, 11:06 am, Tim Newsham