Does Android supports recording in u-law format. I can see PCM-16 and
PCM-8bit raw format.
If not, what can be done like adding header separately?

On Oct 7, 4:37 pm, Mrid <mrid....@gmail.com> wrote:
> Thank you Mark for the reply.
> I am here uptil now.
>
>                         int bufferSize =
> AudioRecord.getMinBufferSize(8000,
> AudioFormat.CHANNEL_CONFIGURATION_MONO,
> AudioFormat.ENCODING_PCM_16BIT);
>                         AudioRecord recorder = new
> AudioRecord(MediaRecorder.AudioSource.MIC, 8000,
> AudioFormat.CHANNEL_CONFIGURATION_MONO,
> AudioFormat.ENCODING_PCM_16BIT,bufferSize*4);
>                         recorder.startRecording();
>                         al.length(4000);
>
>                         byte[] tempBuffer = new byte[bufferSize];
>                         bufferRead = recorder.read(tempBuffer, 0, bufferSize);
>
>                         for (int idxBuffer = 0; idxBuffer < bufferRead; 
> ++idxBuffer) {
>                                 Log.i(""+idxBuffer, ""+tempBuffer[idxBuffer]);
>                         }
>                         recorder.stop();
>                         return tempBuffer;
>
> which is uptil step 7 in my above post. I dont know how to proceed
> from here. I tried to pass this byte array on to the server (which
> accepts above format), and the server responded me with incorrect
> format error.
> Do you have any idea how to proceed from here?
>
> On Oct 7, 2:56 pm, OldSkoolMark <m...@sublimeslime.com> wrote:
>
>
>
> > The current Android audio API's are rather spotty in terms of what
> > they provide. You'll have to write your own .wav converter at the very
> > least.
>
> > On Oct 7, 2:09 pm, Mrid <mrid....@gmail.com> wrote:
>
> > > can anyone please help me on this ?
>
> > > On Oct 6, 3:37 pm, Mrid <mrid....@gmail.com> wrote:
>
> > > > Hi All,
>
> > > > wanted to know is there any alternative ofjavax.sound.sampled package
> > > > specially AudioSystem and TargetDataLine class. Here is the sample
> > > > code in java I am referring to :
>
> > > >                 1       AudioFormat af = new
> > > > AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 8000.0F, 16, 1, 2,
> > > > 8000.0F, false);
> > > >                 2       DataLine.Info info = new
> > > > DataLine.Info(TargetDataLine.class, af);
> > > >                 3       TargetDataLine line = (TargetDataLine) 
> > > > AudioSystem.getLine(info);
> > > >                 4       line.open(af, 800);
> > > >                 5       SoundRecorder recorder = new 
> > > > SoundRecorder(line, this,
> > > > seconds);                          //  this class records the sound
> > > > and returns recording in byte array
> > > >                 6       recorder.start();
> > > >                 7       recorder.join();
> > > >                 8
> > > >                 9       // Write with headers
> > > >                 10      ByteArrayInputStream soundbytes = new
> > > > ByteArrayInputStream(recorder.getRecording());
> > > >                 11      ByteArrayOutputStream byteswithheaders = new
> > > > ByteArrayOutputStream();
> > > >                 12      AudioSystem.write(new 
> > > > AudioInputStream(soundbytes, af,
> > > > soundbytes.available() / 2), AudioFileFormat.Type.WAVE,
> > > > byteswithheaders);
> > > >                 13      return byteswithheaders.toByteArray();
>
> > > > So far I am able to record the data in format specified in step 1. and
> > > > convert it into byte array.
> > > > My doubts:
> > > > ->I recorded sound without using Dataline class, will that make any
> > > > difference
> > > > ->Which class should I use in Android, instead of step 12.
> > > > -> or some one has any other idea??

-- 
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

Reply via email to