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