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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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,
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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,
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
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
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
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
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
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
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,
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
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
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
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
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
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
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:
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
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
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.
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
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
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
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) {
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
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
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,
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
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)
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
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
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
62 matches
Mail list logo