Re: [android-developers] Re: android 1.5: How do we use the AudioTrack class?

2010-03-29 Thread dillirao malipeddi
Arijasoft developed android online radio SDK

using this AOR SDK you can play shoutcast/icecast ( mp3/aac) radio streams
on android

for more details look in to
http://demos.arijasoft.com/Arija_Android_Dev/aorsdkrelease.php

http://demos.arijasoft.com/Arija_Android_Dev/aorsdkrelease.phpThanks

On Thu, Jun 25, 2009 at 8:27 PM, sasq jonas.minnb...@gmail.com wrote:


 I get this to work fine through something like

audioTrack.setPositionNotificationPeriod(bufSize/8);
audioTrack.setPlaybackPositionUpdateListener(this);

...

public void onPeriodicNotification(AudioTrack track) {
int frames = track.getPositionNotificationPeriod();
track.write(samples, 0, frames*2);
}

 However - the callback is *Not* called from the thread that created
 the AudioTrack (as it says in the documentation) but from the UI
 thread, so you have to make sure you never write so you fill the
 buffer or the UI thread will block.



 On May 5, 10:45 am, blindfold seeingwithso...@gmail.com wrote:
  On May 1, 6:43 pm, Jean-Michel jmtr...@gmail.com wrote: Blindfold,
 
  Yes, with the marker set at 1000 I would now *sometimes* get the
  onMarkerReached() callback, but extremely rarely (maybe once in a
  hundred one-second 8-bit mono PCM sample playbacks on my ADP, which is
  why I had not even noticed it at first). It may depend on parameter
  settings, sample length, CPU load, whatever, but for my use it is
  totally unreliable and useless. At least it proves that my coding was
  not totally wrong, or else the callback would *never* have been
  invoked. :-)
 
  I think we need some feedback from the Android Team about how
  onMarkerReached() is supposed to behave or under what conditions it
  works. Some undocumented statement order that one has to adhere to?
  Timing assumptions? By contrast, MediaPlayer's OnCompletionListener()
  works just fine for me.
 
  Thanks

 --~--~-~--~~~---~--~~
 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-unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en
 -~--~~~~--~~--~--~---




-- 
Thank you,
Dilli Rao. M
www.arijasoft.com

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words REMOVE ME as the subject.


[android-developers] Re: android 1.5: How do we use the AudioTrack class?

2009-06-25 Thread sasq

I get this to work fine through something like

audioTrack.setPositionNotificationPeriod(bufSize/8);
audioTrack.setPlaybackPositionUpdateListener(this);

...

public void onPeriodicNotification(AudioTrack track) {
int frames = track.getPositionNotificationPeriod();
track.write(samples, 0, frames*2);
}

However - the callback is *Not* called from the thread that created
the AudioTrack (as it says in the documentation) but from the UI
thread, so you have to make sure you never write so you fill the
buffer or the UI thread will block.



On May 5, 10:45 am, blindfold seeingwithso...@gmail.com wrote:
 On May 1, 6:43 pm, Jean-Michel jmtr...@gmail.com wrote: Blindfold,

 Yes, with the marker set at 1000 I would now *sometimes* get the
 onMarkerReached() callback, but extremely rarely (maybe once in a
 hundred one-second 8-bit mono PCM sample playbacks on my ADP, which is
 why I had not even noticed it at first). It may depend on parameter
 settings, sample length, CPU load, whatever, but for my use it is
 totally unreliable and useless. At least it proves that my coding was
 not totally wrong, or else the callback would *never* have been
 invoked. :-)

 I think we need some feedback from the Android Team about how
 onMarkerReached() is supposed to behave or under what conditions it
 works. Some undocumented statement order that one has to adhere to?
 Timing assumptions? By contrast, MediaPlayer's OnCompletionListener()
 works just fine for me.

 Thanks

--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: android 1.5: How do we use the AudioTrack class?

2009-05-05 Thread blindfold



On May 1, 6:43 pm, Jean-Michel jmtr...@gmail.com wrote:
 Blindfold,
Yes, with the marker set at 1000 I would now *sometimes* get the
onMarkerReached() callback, but extremely rarely (maybe once in a
hundred one-second 8-bit mono PCM sample playbacks on my ADP, which is
why I had not even noticed it at first). It may depend on parameter
settings, sample length, CPU load, whatever, but for my use it is
totally unreliable and useless. At least it proves that my coding was
not totally wrong, or else the callback would *never* have been
invoked. :-)

I think we need some feedback from the Android Team about how
onMarkerReached() is supposed to behave or under what conditions it
works. Some undocumented statement order that one has to adhere to?
Timing assumptions? By contrast, MediaPlayer's OnCompletionListener()
works just fine for me.

Thanks

 I can get onMarkerReached() called for a STATICAudioTrackinstance. A
 few things you might want to try:
 - the marker position must be set in frames, not bytes. So make sure
 you're not giving a marker position that's not beyond your content.
 For instance if your content is stereo/8bit, you must divide the size
 by two, by four for stereo/16bit, to go from data size to frame count.
 - try setting a really low value for your marker position, like 10, to
 see if it gets called.
 - if all that still doesn't work, I'd start checking in which thread
 the callback is supposed to be called. By default it's in the same
 thread as the one in which you created yourAudioTrackinstance. If
 you want it to be called from a different thread, use
 setPlaybackPositionUpdateListener(listener, handler) where you pass
 the handler of the thread you want to use.
 Hope this helps.

--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: android 1.5: How do we use the AudioTrack class?

2009-05-03 Thread blindfold

No success stories on onMarkerReached() from others, so I've now
submitted a bug report http://code.google.com/p/android/issues/detail?id=2563

Regards

On May 1, 12:37 pm, blindfold seeingwithso...@gmail.com wrote:
 Should I file a bug report for Cupcake's onMarkerReached() 
 inAudioTrackplayback? The only workaround I currently have for
 onMarkerReached() never getting invoked is to explicitly poll
 getPlaybackHeadPosition(), while taking into account extra margins for
 sample rates 11025 and 22050 because there the getPlaybackHeadPosition
 () does not quite reach the expected end values - as described in my
 previous post.

 Regards

 On Apr 30, 10:02 pm, blindfold seeingwithso...@gmail.com wrote:

  Has anybody had any success with OnPlaybackPositionUpdateListener? I'm
  successfully playing one-second PCM sound clips withAudioTrackin
  MODE_STATIC mode (although the playback often appears truncated), but
  no matter what I do, onMarkerReached() is never called. I set
  setNotificationMarkerPosition() to a position a bit less than my
  sample count. I do not have any such problems with its MediaPlayer
  counterpart setOnCompletionListener(). I simply want onMarkerReached()
  to run when myAudioTrackinstance has finished playing, but the
  getPlayState() remains PLAYSTATE_PLAYING after myAudioTrackhas
  finished sounding. What might be wrong? What does it take to get
 AudioTrackto run onMarkerReached() at the end of the data? Any
  concrete sample code for this that works?

  Another strange thing is that at the end of a one second sound at
  sample rate 16000, getPlaybackHeadPosition() returns 16000 as
  expected, but for a sample rate of 22050 getPlaybackHeadPosition()
  becomes consistently 22016, for a sample rate of 11025
  getPlaybackHeadPosition() becomes 11008, while for a sample rate of
  8000 the getPlaybackHeadPosition() returns consistently 8000 again.
  Are the discrepancies for sample rates of 11025 and 22050 due to
  rounding inaccuracies in theAudioTracksample rate divider?

  Thanks


--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: android 1.5: How do we use the AudioTrack class?

2009-05-03 Thread Jean-Michel

Blindfold,
I can get onMarkerReached() called for a STATIC AudioTrack instance. A
few things you might want to try:
- the marker position must be set in frames, not bytes. So make sure
you're not giving a marker position that's not beyond your content.
For instance if your content is stereo/8bit, you must divide the size
by two, by four for stereo/16bit, to go from data size to frame count.
- try setting a really low value for your marker position, like 10, to
see if it gets called.
- if all that still doesn't work, I'd start checking in which thread
the callback is supposed to be called. By default it's in the same
thread as the one in which you created your AudioTrack instance. If
you want it to be called from a different thread, use
setPlaybackPositionUpdateListener(listener, handler) where you pass
the handler of the thread you want to use.
Hope this helps.

On May 1, 3:37 am, blindfold seeingwithso...@gmail.com wrote:
 Should I file a bug report for Cupcake's onMarkerReached() 
 inAudioTrackplayback? The only workaround I currently have for
 onMarkerReached() never getting invoked is to explicitly poll
 getPlaybackHeadPosition(), while taking into account extra margins for
 sample rates 11025 and 22050 because there the getPlaybackHeadPosition
 () does not quite reach the expected end values - as described in my
 previous post.

 Regards

 On Apr 30, 10:02 pm, blindfold seeingwithso...@gmail.com wrote:

  Has anybody had any success with OnPlaybackPositionUpdateListener? I'm
  successfully playing one-second PCM sound clips withAudioTrackin
  MODE_STATIC mode (although the playback often appears truncated), but
  no matter what I do, onMarkerReached() is never called. I set
  setNotificationMarkerPosition() to a position a bit less than my
  sample count. I do not have any such problems with its MediaPlayer
  counterpart setOnCompletionListener(). I simply want onMarkerReached()
  to run when myAudioTrackinstance has finished playing, but the
  getPlayState() remains PLAYSTATE_PLAYING after myAudioTrackhas
  finished sounding. What might be wrong? What does it take to get
 AudioTrackto run onMarkerReached() at the end of the data? Any
  concrete sample code for this that works?

  Another strange thing is that at the end of a one second sound at
  sample rate 16000, getPlaybackHeadPosition() returns 16000 as
  expected, but for a sample rate of 22050 getPlaybackHeadPosition()
  becomes consistently 22016, for a sample rate of 11025
  getPlaybackHeadPosition() becomes 11008, while for a sample rate of
  8000 the getPlaybackHeadPosition() returns consistently 8000 again.
  Are the discrepancies for sample rates of 11025 and 22050 due to
  rounding inaccuracies in theAudioTracksample rate divider?

  Thanks

--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: android 1.5: How do we use the AudioTrack class?

2009-05-01 Thread blindfold

Should I file a bug report for Cupcake's onMarkerReached() in
AudioTrack playback? The only workaround I currently have for
onMarkerReached() never getting invoked is to explicitly poll
getPlaybackHeadPosition(), while taking into account extra margins for
sample rates 11025 and 22050 because there the getPlaybackHeadPosition
() does not quite reach the expected end values - as described in my
previous post.

Regards

On Apr 30, 10:02 pm, blindfold seeingwithso...@gmail.com wrote:
 Has anybody had any success with OnPlaybackPositionUpdateListener? I'm
 successfully playing one-second PCM sound clips with AudioTrack in
 MODE_STATIC mode (although the playback often appears truncated), but
 no matter what I do, onMarkerReached() is never called. I set
 setNotificationMarkerPosition() to a position a bit less than my
 sample count. I do not have any such problems with its MediaPlayer
 counterpart setOnCompletionListener(). I simply want onMarkerReached()
 to run when my AudioTrack instance has finished playing, but the
 getPlayState() remains PLAYSTATE_PLAYING after my AudioTrack has
 finished sounding. What might be wrong? What does it take to get
 AudioTrack to run onMarkerReached() at the end of the data? Any
 concrete sample code for this that works?

 Another strange thing is that at the end of a one second sound at
 sample rate 16000, getPlaybackHeadPosition() returns 16000 as
 expected, but for a sample rate of 22050 getPlaybackHeadPosition()
 becomes consistently 22016, for a sample rate of 11025
 getPlaybackHeadPosition() becomes 11008, while for a sample rate of
 8000 the getPlaybackHeadPosition() returns consistently 8000 again.
 Are the discrepancies for sample rates of 11025 and 22050 due to
 rounding inaccuracies in the AudioTrack sample rate divider?

 Thanks
--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: android 1.5: How do we use the AudioTrack class?

2009-04-30 Thread blindfold

Has anybody had any success with OnPlaybackPositionUpdateListener? I'm
successfully playing one-second PCM sound clips with AudioTrack in
MODE_STATIC mode (although the playback often appears truncated), but
no matter what I do, onMarkerReached() is never called. I set
setNotificationMarkerPosition() to a position a bit less than my
sample count. I do not have any such problems with its MediaPlayer
counterpart setOnCompletionListener(). I simply want onMarkerReached()
to run when my AudioTrack instance has finished playing, but the
getPlayState() remains PLAYSTATE_PLAYING after my AudioTrack has
finished sounding. What might be wrong? What does it take to get
AudioTrack to run onMarkerReached() at the end of the data? Any
concrete sample code for this that works?

Another strange thing is that at the end of a one second sound at
sample rate 16000, getPlaybackHeadPosition() returns 16000 as
expected, but for a sample rate of 22050 getPlaybackHeadPosition()
becomes consistently 22016, for a sample rate of 11025
getPlaybackHeadPosition() becomes 11008, while for a sample rate of
8000 the getPlaybackHeadPosition() returns consistently 8000 again.
Are the discrepancies for sample rates of 11025 and 22050 due to
rounding inaccuracies in the AudioTrack sample rate divider?

Thanks

--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: android 1.5: How do we use the AudioTrack class?

2009-04-27 Thread niko20

Hi, the buffer won't play in stream mode until you have filled it all
the way the first time. So make sure you are writing at least 256K of
data in the first write call.

You can actually create the AudioTrack object, then say Play() and
write data to it after it's playing (in stream mode). Once the
buffer reaches the buffer size, it will start to play. Then just keep
the buffer full.

-niko




On Apr 23, 12:24 pm, Moto medicalsou...@gmail.com wrote:
 I'm currently initiating the AudioTrack() for MODE_STREAM.

 I load some bytes using the write() and I see that it is working but
 once hit the play() call nothing happens... what is the matter? should
 I do something else that is not obvious??  Any tips Google friends?

 My settings:
 streamType - STREAM_MUSIC
 sampleRateInHz - 44100
 channelConfig - CHANNEL_CONFIGURATION_STEREO
 audioFormat - ENCODING_PCM_16BIT
 bufferSizeInBytes - 256K        the total size (in bytes) of the buffer where
 audio data is read from for playback. mode - MODE_STREAM

 thanks!
 -Moto!

--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: android 1.5: How do we use the AudioTrack class?

2009-04-27 Thread Moto

Hey Niko thanks for your reply...

I'm not sure if I can stream mpeg or aacp streams it seems like
it's only PCM format... :(
--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: android 1.5: How do we use the AudioTrack class?

2009-04-26 Thread Moto

Help?
--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: android 1.5: How do we use the AudioTrack class?

2009-04-26 Thread MrSnowflake

You can play from a stream if you capture the stream in your program
and stream the audio to the mediaplayer. There is no direct support of
audio streams, execpt directly from server.
This sollution is somewhere in the docs...

On 26 apr, 18:27, Moto medicalsou...@gmail.com wrote:
 Help?
--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: android 1.5: How do we use the AudioTrack class?

2009-04-26 Thread Moto

Yeah,
currently that's my method... o well I thought something like the
AudioTrack would be nice... were you can select the type of audio to
decode not just PCM :(
--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: android 1.5: How do we use the AudioTrack class?

2009-04-23 Thread Moto

I thought you could continuously write data into the AudioTrack as
long as the buffer size specified at the creation of the AudioTrack
was not exceeded...  and you can call play() as long as there was
enough data to start playback...
--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: android 1.5: How do we use the AudioTrack class?

2009-04-23 Thread Moto

Ok at this point I only get white noise? do I need to set the decoder?
it's an MPEG stream could a AAC+ be now supporteD?

--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: android 1.5: How do we use the AudioTrack class?

2009-04-23 Thread Marco Nelissen
AudioTrack plays PCM data. The reason it sounds like noise is because that's
what mpeg sounds like when interpreted as PCM.


On Thu, Apr 23, 2009 at 3:44 PM, Moto medicalsou...@gmail.com wrote:


 Ok at this point I only get white noise? do I need to set the decoder?
 it's an MPEG stream could a AAC+ be now supporteD?

 


--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: android 1.5: How do we use the AudioTrack class?

2009-04-23 Thread Moto

lol yeah definitely true!  But for some reason I thought it would be
decoded into a playable format...

How do we play AAC+ formats and MPEG formats?
--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: android 1.5: How do we use the AudioTrack class?

2009-04-23 Thread Marco Nelissen
Use the MediaPlayer class.

On Thu, Apr 23, 2009 at 6:35 PM, Moto medicalsou...@gmail.com wrote:


 lol yeah definitely true!  But for some reason I thought it would be
 decoded into a playable format...

 How do we play AAC+ formats and MPEG formats?
 


--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: android 1.5: How do we use the AudioTrack class?

2009-04-23 Thread Moto

The issue is that you still can't stream from a radio station online
only an MP3 file from a server...

Romain Guy could you help?  ^.^

Thanks Marco!

--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: android 1.5: How do we use the AudioTrack class?

2009-04-23 Thread Moto

Up to now I feel very discouraged by the new libraries... Yes they are
doing many good things for Media but when it comes to streaming
internet radios this really sucks... or maybe I'm just not
understanding how to do this... :(

Please help...
--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---