Real Time Sound Captureing J2ME

Posted by Abdul jalil on Stack Overflow See other posts from Stack Overflow or by Abdul jalil
Published on 2010-06-13T13:16:01Z Indexed on 2010/06/13 13:22 UTC
Read the original article Hit count: 242

Filed under:
|

i am capturing sound in J2me and send these bytes to remote system, i then play these bytes on remote system.five second voice is capture and send to remote system. i get the repeated sound again .i am making a sound messenger please help me where i am doing wrong i am using the follown code .
String remoteTimeServerAddress="192.168.137.179";
sc = (SocketConnection) Connector.open("socket://"+remoteTimeServerAddress+":13");
p = Manager.createPlayer("capture://audio?encoding=pcm&rate=11025&bits=16&channels=1");
p.realize();
RecordControl rc = (RecordControl)p.getControl("RecordControl");
ByteArrayOutputStream output = new ByteArrayOutputStream();
OutputStream outstream =sc.openOutputStream();
rc.setRecordStream(output);
rc.startRecord();
p.start();
int size=output.size();
int offset=0;
while(true)
{
Thread.currentThread().sleep(5000);
rc.commit();
output.flush();
size=output.size();
if(size>0)
{
recordedSoundArray=output.toByteArray();
outstream.write(recordedSoundArray,0,size);
}
output.reset();
rc.reset();
rc.setRecordStream(output);
rc.startRecord();

}

© Stack Overflow or respective owner

Related posts about java

Related posts about j2me