[android-developers] Re: Audio Playback while Recording... ------- attemp playback while recording, cheat it! ----- error

2009-11-04 Thread Moto
Can you just do the following?

byte []buf = new byte[1024];
int read = 0;

ar = new AudioRecord();
at = new AudioTrack();

do {
//Read from mic
read = ar.read(buf);

//Send to speaker
at.write(buf,0,read);

} while(...);


-Moto

On Oct 22, 5:00 am, Vishal vishal.andr...@gmail.com wrote:
 Thanks Roman,

 But my scenario is quiet different from what is discussed in that
 blog. I am trying to capture audio from mic directly in pcm format
 using AudioRecord interface and also at the same time trying to play
 the pcm samples (from different source) to the speaker using the
 AudioTrack interface. That is when I am getting this error  ---
 attemp playback while recording, cheat it! -  .

 Please let me know if you find any other thread?
 Thanks,
 Vishal Gaonkar

 On Oct 17, 2:26 am, Roman ( T-Mobile USA) roman.baumgaert...@t-

 mobile.com wrote:
  I am assuming when you record your audio stream, the file is blocked
  from playback.

  Check out the following blog which talks about video streaming and
  deals with a similar problem

 http://blog.pocketjourney.com/2008/04/04/tutorial-custom-media-stream...

  --
  Roman Baumgaertner
  Sr. SW Engineer-OSDC
  ·T· · ·Mobile· stick together
  The views, opinions and statements in this email are those of the
  author solely in their individual capacity, and do not necessarily
  represent those of T-Mobile USA, Inc.

  On Oct 16, 5:20 am, Vishal vishal.andr...@gmail.com wrote:

   Hello,

   I have a Java application where in I am trying to read Audio samples
   from the mic into a buffer and then write the samples back to speaker
   from a buffer for playing.

   I have used AudioRecord and AudioTrack interfaces. Below are my
   configurations for the Record and Track object creation. AudioTrack(0,
   8000, 2, 2, playBufSize, 1); AudioRecord(1, 8000, 2, 2, recBufSize);
   Using AudioRecord interface I am able to read the samples from mic
   continiously (8000 sampling rate and 640 samples per read). In the
   similar way I am also able to write some pcm samples to the speaker
   from a buffer and play it continuously using the AudioTrack interface
   (without record).

   But when I try to do both record and play simultaneously I am able to
   only record audio from mic but I am not able to play any samples to
   speaker. I am getting this error  --- attemp playback while
   recording, cheat it! -   in the log cat.

   I have given the following permissions
   android.permission.RECORD_AUDIO and
   android.permission.MODIFY_AUDIO_SETTINGS in the Manifest file. I
   didn't find any special permission to play the audio.

   Is there anything else that I need to enable?

   Thanks in advance,
   Vishal

-- 
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: Audio Playback while Recording... ------- attemp playback while recording, cheat it! ----- error

2009-10-22 Thread Vishal

Thanks Roman,

But my scenario is quiet different from what is discussed in that
blog. I am trying to capture audio from mic directly in pcm format
using AudioRecord interface and also at the same time trying to play
the pcm samples (from different source) to the speaker using the
AudioTrack interface. That is when I am getting this error  ---
attemp playback while recording, cheat it! -  .

Please let me know if you find any other thread?
Thanks,
Vishal Gaonkar

On Oct 17, 2:26 am, Roman ( T-Mobile USA) roman.baumgaert...@t-
mobile.com wrote:
 I am assuming when you record your audio stream, the file is blocked
 from playback.

 Check out the following blog which talks about video streaming and
 deals with a similar problem

 http://blog.pocketjourney.com/2008/04/04/tutorial-custom-media-stream...

 --
 Roman Baumgaertner
 Sr. SW Engineer-OSDC
 ·T· · ·Mobile· stick together
 The views, opinions and statements in this email are those of the
 author solely in their individual capacity, and do not necessarily
 represent those of T-Mobile USA, Inc.

 On Oct 16, 5:20 am, Vishal vishal.andr...@gmail.com wrote:

  Hello,

  I have a Java application where in I am trying to read Audio samples
  from the mic into a buffer and then write the samples back to speaker
  from a buffer for playing.

  I have used AudioRecord and AudioTrack interfaces. Below are my
  configurations for the Record and Track object creation. AudioTrack(0,
  8000, 2, 2, playBufSize, 1); AudioRecord(1, 8000, 2, 2, recBufSize);
  Using AudioRecord interface I am able to read the samples from mic
  continiously (8000 sampling rate and 640 samples per read). In the
  similar way I am also able to write some pcm samples to the speaker
  from a buffer and play it continuously using the AudioTrack interface
  (without record).

  But when I try to do both record and play simultaneously I am able to
  only record audio from mic but I am not able to play any samples to
  speaker. I am getting this error  --- attemp playback while
  recording, cheat it! -   in the log cat.

  I have given the following permissions
  android.permission.RECORD_AUDIO and
  android.permission.MODIFY_AUDIO_SETTINGS in the Manifest file. I
  didn't find any special permission to play the audio.

  Is there anything else that I need to enable?

  Thanks in advance,
  Vishal
--~--~-~--~~~---~--~~
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: Audio Playback while Recording... ------- attemp playback while recording, cheat it! ----- error

2009-10-22 Thread Vishal

Thanks Roman,

But my scenario is quiet different from what is discussed in that
blog. I am trying to capture audio from mic directly in pcm format
using AudioRecord interface and also at the same time trying to play
the pcm samples (from different source) to the speaker using the
AudioTrack interface. That is when I am getting this error  ---
attemp playback while recording, cheat it! -  .

Please let me know if you find any other thread?
Thanks,
Vishal Gaonkar

On Oct 17, 2:26 am, Roman ( T-Mobile USA) roman.baumgaert...@t-
mobile.com wrote:
 I am assuming when you record your audio stream, the file is blocked
 from playback.

 Check out the following blog which talks about video streaming and
 deals with a similar problem

 http://blog.pocketjourney.com/2008/04/04/tutorial-custom-media-stream...

 --
 Roman Baumgaertner
 Sr. SW Engineer-OSDC
 ·T· · ·Mobile· stick together
 The views, opinions and statements in this email are those of the
 author solely in their individual capacity, and do not necessarily
 represent those of T-Mobile USA, Inc.

 On Oct 16, 5:20 am, Vishal vishal.andr...@gmail.com wrote:

  Hello,

  I have a Java application where in I am trying to read Audio samples
  from the mic into a buffer and then write the samples back to speaker
  from a buffer for playing.

  I have used AudioRecord and AudioTrack interfaces. Below are my
  configurations for the Record and Track object creation. AudioTrack(0,
  8000, 2, 2, playBufSize, 1); AudioRecord(1, 8000, 2, 2, recBufSize);
  Using AudioRecord interface I am able to read the samples from mic
  continiously (8000 sampling rate and 640 samples per read). In the
  similar way I am also able to write some pcm samples to the speaker
  from a buffer and play it continuously using the AudioTrack interface
  (without record).

  But when I try to do both record and play simultaneously I am able to
  only record audio from mic but I am not able to play any samples to
  speaker. I am getting this error  --- attemp playback while
  recording, cheat it! -   in the log cat.

  I have given the following permissions
  android.permission.RECORD_AUDIO and
  android.permission.MODIFY_AUDIO_SETTINGS in the Manifest file. I
  didn't find any special permission to play the audio.

  Is there anything else that I need to enable?

  Thanks in advance,
  Vishal
--~--~-~--~~~---~--~~
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: Audio Playback while Recording... ------- attemp playback while recording, cheat it! ----- error

2009-10-22 Thread Vishal

Thanks Roman,

But my scenario is quiet different from what is discussed in that
blog. I am trying to capture audio from mic directly in pcm format
using AudioRecord interface and also at the same time trying to play
the pcm samples (from different source) to the speaker using the
AudioTrack interface. That is when I am getting this error  ---
attemp playback while recording, cheat it! -  .

Please let me know if you find any other thread?
Thanks,
Vishal Gaonkar

On Oct 17, 2:26 am, Roman ( T-Mobile USA) roman.baumgaert...@t-
mobile.com wrote:
 I am assuming when you record your audio stream, the file is blocked
 from playback.

 Check out the following blog which talks about video streaming and
 deals with a similar problem

 http://blog.pocketjourney.com/2008/04/04/tutorial-custom-media-stream...

 --
 Roman Baumgaertner
 Sr. SW Engineer-OSDC
 ·T· · ·Mobile· stick together
 The views, opinions and statements in this email are those of the
 author solely in their individual capacity, and do not necessarily
 represent those of T-Mobile USA, Inc.

 On Oct 16, 5:20 am, Vishal vishal.andr...@gmail.com wrote:

  Hello,

  I have a Java application where in I am trying to read Audio samples
  from the mic into a buffer and then write the samples back to speaker
  from a buffer for playing.

  I have used AudioRecord and AudioTrack interfaces. Below are my
  configurations for the Record and Track object creation. AudioTrack(0,
  8000, 2, 2, playBufSize, 1); AudioRecord(1, 8000, 2, 2, recBufSize);
  Using AudioRecord interface I am able to read the samples from mic
  continiously (8000 sampling rate and 640 samples per read). In the
  similar way I am also able to write some pcm samples to the speaker
  from a buffer and play it continuously using the AudioTrack interface
  (without record).

  But when I try to do both record and play simultaneously I am able to
  only record audio from mic but I am not able to play any samples to
  speaker. I am getting this error  --- attemp playback while
  recording, cheat it! -   in the log cat.

  I have given the following permissions
  android.permission.RECORD_AUDIO and
  android.permission.MODIFY_AUDIO_SETTINGS in the Manifest file. I
  didn't find any special permission to play the audio.

  Is there anything else that I need to enable?

  Thanks in advance,
  Vishal
--~--~-~--~~~---~--~~
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: Audio Playback while Recording... ------- attemp playback while recording, cheat it! ----- error

2009-10-16 Thread Roman ( T-Mobile USA)

I am assuming when you record your audio stream, the file is blocked
from playback.

Check out the following blog which talks about video streaming and
deals with a similar problem

http://blog.pocketjourney.com/2008/04/04/tutorial-custom-media-streaming-for-androids-mediaplayer/

--
Roman Baumgaertner
Sr. SW Engineer-OSDC
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.

On Oct 16, 5:20 am, Vishal vishal.andr...@gmail.com wrote:
 Hello,

 I have a Java application where in I am trying to read Audio samples
 from the mic into a buffer and then write the samples back to speaker
 from a buffer for playing.

 I have used AudioRecord and AudioTrack interfaces. Below are my
 configurations for the Record and Track object creation. AudioTrack(0,
 8000, 2, 2, playBufSize, 1); AudioRecord(1, 8000, 2, 2, recBufSize);
 Using AudioRecord interface I am able to read the samples from mic
 continiously (8000 sampling rate and 640 samples per read). In the
 similar way I am also able to write some pcm samples to the speaker
 from a buffer and play it continuously using the AudioTrack interface
 (without record).

 But when I try to do both record and play simultaneously I am able to
 only record audio from mic but I am not able to play any samples to
 speaker. I am getting this error  --- attemp playback while
 recording, cheat it! -   in the log cat.

 I have given the following permissions
 android.permission.RECORD_AUDIO and
 android.permission.MODIFY_AUDIO_SETTINGS in the Manifest file. I
 didn't find any special permission to play the audio.

 Is there anything else that I need to enable?

 Thanks in advance,
 Vishal
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---