A
Akhil
Hi there!
One of my application has a client and server. The client Captures the sound and sends to server which stores it in a file. I am able to play the data but when I write my data in file & play in Winamp it says... "Invalid File Format" Here is my sample code of Client & Server
// Client
targetDataLine.start();
ByteArrayOutputStream out= new ByteArrayOutputStream();
numBytesRead=0;
while(stopRecord ==false)
{
numBytesRead = targetDataLine.read(data,0,data.length);
out.write(data,0,numBytesRead);
}
targetDataLine.stop();
// Server
while((cnt = soket.getInputStream().read(tempBuffer,0,tempBuffer.length)) != -1)
{
if(cnt > 0)
{
out.write(tempBuffer,0,cnt);//What do I do with this now?
//This is to play it at speaker...
sourceDataLine.write(tempBuffer, 0, cnt);
}
}
I must be thankful 2 u if u can throw-in ur suggestions at my inbox ( (e-mail address removed) )
One of my application has a client and server. The client Captures the sound and sends to server which stores it in a file. I am able to play the data but when I write my data in file & play in Winamp it says... "Invalid File Format" Here is my sample code of Client & Server
// Client
targetDataLine.start();
ByteArrayOutputStream out= new ByteArrayOutputStream();
numBytesRead=0;
while(stopRecord ==false)
{
numBytesRead = targetDataLine.read(data,0,data.length);
out.write(data,0,numBytesRead);
}
targetDataLine.stop();
// Server
while((cnt = soket.getInputStream().read(tempBuffer,0,tempBuffer.length)) != -1)
{
if(cnt > 0)
{
out.write(tempBuffer,0,cnt);//What do I do with this now?
//This is to play it at speaker...
sourceDataLine.write(tempBuffer, 0, cnt);
}
}
I must be thankful 2 u if u can throw-in ur suggestions at my inbox ( (e-mail address removed) )