I am using nearly the similar configuration for some audio recording
and play back than you.


Try to check whether you get some better audio quality when you use
AudioManager.STREAM_MUSIC instead of STREAM_SYSTEM.



--
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 Nov 2, 12:35 am, raghu <[email protected]> wrote:
> hi,
>    android audio issue
>    using mic i am recording the audio and i am playing it, but the
> voice quality is not good
>    and some kaar kaar ... sound is there
>    why the voice quality is not good  ?
>    why is that kaar kaar sound ?
>
>    help required
>
>    i have set the permission in .xml file also
>  android.permission.INTERNET,
> android.permission.MODIFY_AUDIO_SETTINGS,
> android.permission.RECORD_AUDIO, android.permission.WRITE_SETTINGS
>
>    below is the code i am using to record the audio and play it  is
> there any wrong in the code :
>
>     public void onCreate(Bundle savedInstanceState)
>     {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.main);
>
>         byte[] Buffer = new byte [80000] ;
>
>         int Size = 320 ;
>         int BuffLen = 1 ;
>         int     SizeSoFar = 0 ;
>         int MinBuffSize ;
>         int Written = 0 ;
>         int temp = 0 ;
>
>         AudioRecord audioRecord = new AudioRecord
> (MediaRecorder.AudioSource.MIC, 8000,
> AudioFormat.CHANNEL_CONFIGURATION_MONO,
>                                         AudioFormat.ENCODING_PCM_16BIT, 4096) 
> ;
>         audioRecord.startRecording () ;
>
>         MinBuffSize = AudioRecord.getMinBufferSize(8000,2,2);
>
>         Log.i ("--PRINT--", "minimum buf size : " + MinBuffSize) ;
>
>         AudioTrack track = new AudioTrack (AudioManager.STREAM_SYSTEM,
> 8000, AudioFormat.CHANNEL_CONFIGURATION_MONO ,
> AudioFormat.ENCODING_PCM_16BIT,
>                         4096, AudioTrack.MODE_STREAM) ;
>
>         track.play() ;
>
>         while (BuffLen != 0)
>         {
>                 while (temp == 0)
>                 {
>                         SizeSoFar += audioRecord.read (Buffer, SizeSoFar, 
> Size) ;
>                         temp = 1 ;
>                 }
>
>                 temp = 0 ;
>                 SizeSoFar = 0 ;
>                 Written = track.write (Buffer, 0, Size) ;
>                 try
>                 {
>                         Thread.sleep (5) ;
>                 }
>                 catch (InterruptedException e)
>                 {
>                         // TODO Auto-generated catch block
>                         e.printStackTrace() ;
>                 }
>         }
>         audioRecord.stop() ;
>         track.stop() ;
>     }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to