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