Voice Chat Applet
Hey all,
I want to develop a voice chat applet in Java. (similar to the one used in Yahoo chat rooms). I know basic Java, but I don't know where to start in developing an applet like this. I don't know what libraries or protocols I need to be focusing on. If anyone can offer me some advice or the steps necessary to create this applet, I would be very appreciative.
Thank you,
Khanathor
Yeah, you would deserve thanks if
1) I hadn't spent all day doing research.Sorry, but my mind-reading device wasn't working. So sorry that I couldn't tell that you had done that. Maybe it would have made a difference if you had done something like MENTIONING it in the first place.
2) Your search query wasn't even what I was
requesting assistance for.Oh, sorry again for not reading your mind as to what you were looking for other than a response for basically "I don't even know where to begin".
3) Your response didn't so clearly reflect your
arrogance.That's ok. Your post clearly reflected your lack of initiative and intelligence.
Similar Messages
-
hi all,
I am developing a Voice chat applet using java(JDK1.4,JMF). If i run my programs of transmitting voice and receiving voice from one machine to another machine(Without applet), its working fine.
When i am sending voice from my server machine, and receiving on someother machine by application, its working fine.
But if i am using my applet from some other machine(Other then server) its creating problems. Its showing some errors.
Can you suggest some solutions??
Thanks in advance.
Abhishekhi,
i also develop the voice chat application. can you send your source code to me. may be i can help you to solve your problems.
my email is [email protected] -
Problem in audio formate voice chatting applet
hi
i've just finished making voice chatting project but the voice sometimes sent with big noice and i can't her the user in the other side
i make it as applet opend from the web and the connection is successfully established , i use cloudegarden in my project
the audio formate i use pcm 44100 hz 16 bit sterio in the client
and 11025 hz 16 bit sterio in the server , i was have to make this formate because the others not working will with me(it throw exception)
thanks for ur concernHello,
could you please send me the source code.Even i'm working on a similar project. My id is [email protected]
Thanks
PN -
Whiteboard-Voice Chat archiving
Hi,
I am developing an application which uses 2 applets in a single jsp page one as a whiteboard where we can draw and another a voice chat cum text chat application.
I need to save both the drwaing and the chat content in the database and retreive and show it to user which contains the drawing and the voice chat content in sync.
How can this be done?Please advice me.
Thanks
RamHi,
Creator 2.0 does not have support to create Applet. You could use free tools like netbeans (http://www.netbeans.org) to create the applet and then import it in to Creator.
RK. -
Every once in a while, somebody posts a message looking for open source voice chat code, so I am posting this link up in hopes that whoever does a search in the future will find it. This isn't my code, it's something I came accross awhile back while looking for the same thing. It is an applet (also a non applet version). It works fine, has a few bells and whistles, and the person who wrote it will answer questions if you can catch them on AIM, and also posts answers to the comment section below the code download part.
This is the direct link:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=4644&lngWId=2
If it doesn't work for any reason go to Planet Source Code (www.planet-source-code.com), and type in "voice chat" in their search bar, with "java & javascript" selected in the language selection menu.
Have fun.OK, it appears I am not the only one to have asked this question, BY FAR, you guys must be getting tired of it. Sorry about that. I now searched the forum as I should have done before. I found:
http://java.sun.com/products/java-media/jmf/2.1.1/samples/samplecode.html
Is JMStudio what I should look at to learn it? Or is there a more basic voice chat program out there. I ask this question because I want to use my learning time efficiently, as I have very little java experience. -
How can i run java on the i mac to start the voice chat?
i have imac
and i have downloaded java
i want to open voice chat websites
e.g. www.63oon.comHello,
Not sure, but could it be this?
Java for OS X 2012-006: How to re-enable the Apple-provided Java SE 6 applet plug-in and Web Start functionality
http://support.apple.com/kb/HT5559 -
After a few days work, I have completed the mian voice chat program. I know there are so many people like me that wants that. I post these program. i will complete gui work later. and there is a problem in the program. if the speaking one do not speak for a while, the listening client will hear noise. Can some one help me.
package com.longshine.voice;
import java.io.*;
import java.net.*;
import java.util.*;
public class Server
// The ServerSocket we'll use for accepting new connections
private ServerSocket ss;
// A mapping from sockets to DataOutputStreams. This will
// help us avoid having to create a DataOutputStream each time
// we want to write to a stream.
private Hashtable outputStreams = new Hashtable();
final int bufSize = 16384;
//current speak_man
private int speakman=-1;
// Constructor and while-accept loop all in one.
public Server( int port ) throws IOException {
// All we have to do is listen
listen( port );
private void listen( int port ) throws IOException {
// Create the ServerSocket
ss = new ServerSocket( port );
// Tell the world we're ready to go
System.out.println( "Listening on "+ss );
// Keep accepting connections forever
while (true) {
// Grab the next incoming connection
Socket s = ss.accept();
// Tell the world we've got it
System.out.println( "Connection from "+s );
// Create a DataOutputStream for writing data to the
// other side
DataOutputStream dout = new DataOutputStream( s.getOutputStream() );
// Save this stream so we don't need to make it again
outputStreams.put( s, dout );
// Create a new thread for this connection, and then forget
// about it
new VoiceServer( this, s );
// Get an enumeration of all the OutputStreams, one for each client
// connected to us
Enumeration getOutputStreams() {
return outputStreams.elements();
// Send a message to all clients (utility routine)
void sendToAll( byte[] voice ,Socket socket) {
// We synchronize on this because another thread might be
// calling removeConnection() and this would screw us up
// as we tried to walk through the list
synchronized( outputStreams ) {
// For each client ...
for (Enumeration e = outputStreams.keys(); e.hasMoreElements(); ) {
// ... get the output stream ...
Socket tmp=(Socket)e.nextElement();
if(!tmp.equals(socket))
try {
DataOutputStream dout = new DataOutputStream(tmp.getOutputStream());
// ... and send the message
dout.write(voice,0,44096);
dout.flush();
} catch( IOException ie ) { System.out.println( ie ); }
// Remove a socket, and it's corresponding output stream, from our
// list. This is usually called by a connection thread that has
// discovered that the connectin to the client is dead.
void removeConnection( Socket s ) {
// Synchronize so we don't mess up sendToAll() while it walks
// down the list of all output streamsa
synchronized( outputStreams ) {
// Tell the world
System.out.println( "Removing connection to "+s );
// Remove it from our hashtable/list
outputStreams.remove( s );
// Make sure it's closed
try {
s.close();
} catch( IOException ie ) {
System.out.println( "Error closing "+s );
ie.printStackTrace();
// Main routine
// Usage: java Server <port>
static public void main( String args[] ) throws Exception {
// Get the port # from the command line
int port = Integer.parseInt( args[0] );
// Create a Server object, which will automatically begin
// accepting connections.
new Server( port );
package com.longshine.voice;
import java.net.*;
import java.io.*;
import java.sql.*;
import java.io.*;
import java.net.*;
public class VoiceServer extends Thread
// The Server that spawned us
private Server server;
final int bufSize = 16384;
// The Socket connected to our client
private Socket socket;
// Constructor.
public VoiceServer( Server server, Socket socket ) {
// Save the parameters
this.server = server;
this.socket = socket;
// Start up the thread
start();
// This runs in a separate thread when start() is called in the
// constructor.
public void run() {
try {
// Create a DataInputStream for communication; the client
// is using a DataOutputStream to write to us
DataInputStream din = new DataInputStream( socket.getInputStream() );
byte[] voice=new byte[44096];
// Over and over, forever ...
while (true) {
// ... read the next message ...
// int bytes = din.read(voice,0,44096);
int bytes = din.read(voice);
// ... and have the server send it to all clients
server.sendToAll(voice,socket);
} catch( EOFException ie ) {
// This doesn't need an error message
} catch( IOException ie ) {
// This does; tell the world!
ie.printStackTrace();
} finally {
// The connection is closed for one reason or another,
// so have the server dealing with it
server.removeConnection( socket );
package com.longshine.voice;
import java.io.*;
import java.net.*;
public class Client {
private String host="";
private String port="";
private Socket socket;
private DataOutputStream dout;
private DataInputStream din;
private Capture capture=null;
private Play play=null;
public Client(String host,String port) {
this.host=host;
this.port=port;
public void init()
try
socket = new Socket( host, Integer.parseInt(port));
din = new DataInputStream( socket.getInputStream() );
dout = new DataOutputStream( socket.getOutputStream());
capture=new Capture(dout);
play=new Play(din);
catch(Exception e)
e.printStackTrace();
public static void main(String[] args) {
Client client = new Client("172.18.220.176","5678");
client.init();
if(args[0].equalsIgnoreCase("say"))
client.capture.start();
if(args[0].equalsIgnoreCase("hear"))
client.play.start();
package com.longshine.voice;
import java.io.*;
import java.util.Vector;
import java.util.Enumeration;
import javax.sound.sampled.*;
import java.text.*;
import java.net.*;
public class Play implements Runnable {
SourceDataLine line;
Thread thread;
String errStr=null;
DataInputStream in=null;
AudioInputStream audioInputStream;
final int bufSize = 16384;
int duration=0;
public Play(DataInputStream in)
this.in=in;
public void start() {
errStr = null;
thread = new Thread(this);
thread.setName("Playback");
thread.start();
public void stop() {
thread = null;
private void shutDown(String message) {
if ((errStr = message) != null) {
System.err.println(errStr);
if (thread != null) {
thread = null;
public void createAudioInputStream() {
if (in != null ) {
try {
errStr = null;
java.io.BufferedInputStream oin = new java.io.BufferedInputStream(in);
audioInputStream = AudioSystem.getAudioInputStream(oin);
} catch (Exception ex) {
ex.printStackTrace();
} else {
public void run() {
// reload the file if loaded by file
if (in != null) {
// createAudioInputStream();
// make sure we have something to play
// if (audioInputStream == null) {
// shutDown("No loaded audio to play back");
// return;
// reset to the beginnning of the stream
// try {
// audioInputStream.reset();
// } catch (Exception e) {
// shutDown("Unable to reset the stream\n" + e);
// return;
// get an AudioInputStream of the desired format for playback
AudioFormat format = getFormat();
audioInputStream=new AudioInputStream(in, format, AudioSystem.NOT_SPECIFIED);
AudioInputStream playbackInputStream = AudioSystem.getAudioInputStream(format, audioInputStream);
if (playbackInputStream == null) {
shutDown("Unable to convert stream of format " + audioInputStream + " to format " + format);
return;
// define the required attributes for our line,
// and make sure a compatible line is supported.
DataLine.Info info = new DataLine.Info(SourceDataLine.class,
format);
if (!AudioSystem.isLineSupported(info)) {
shutDown("Line matching " + info + " not supported.");
return;
// get and open the source data line for playback.
try {
line = (SourceDataLine) AudioSystem.getLine(info);
line.open(format, bufSize);
} catch (LineUnavailableException ex) {
shutDown("Unable to open the line: " + ex);
return;
// play back the captured audio data
int frameSizeInBytes = format.getFrameSize();
int bufferLengthInFrames = line.getBufferSize() / 8;
int bufferLengthInBytes = bufferLengthInFrames * frameSizeInBytes;
byte[] data = new byte[bufferLengthInBytes];
int numBytesRead = 0;
// start the source data line
line.start();
while (thread != null) {
try {
if ((numBytesRead = playbackInputStream.read(data)) == -1) {
break;
int numBytesRemaining = numBytesRead;
while (numBytesRemaining > 0 ) {
numBytesRemaining -= line.write(data, 0, numBytesRemaining);
} catch (Exception e) {
shutDown("Error during playback: " + e);
break;
// we reached the end of the stream. let the data play out, then
// stop and close the line.
if (thread != null) {
line.drain();
line.stop();
line.close();
line = null;
shutDown(null);
public AudioFormat getFormat() {
AudioFormat.Encoding encoding = AudioFormat.Encoding.ULAW;
String encString = "linear";
float rate = Float.valueOf("44100").floatValue();
int sampleSize = 16;
String signedString = "signed";
boolean bigEndian = true;
int channels = 2;
if (encString.equals("linear")) {
if (signedString.equals("signed")) {
encoding = AudioFormat.Encoding.PCM_SIGNED;
} else {
encoding = AudioFormat.Encoding.PCM_UNSIGNED;
} else if (encString.equals("alaw")) {
encoding = AudioFormat.Encoding.ALAW;
return new AudioFormat(encoding, rate, sampleSize,
channels, (sampleSize/8)*channels, rate, bigEndian);
} // End class Playback
package com.longshine.voice;
import java.io.*;
import java.util.Vector;
import java.util.Enumeration;
import javax.sound.sampled.*;
import java.text.*;
import java.net.*;
public class Capture implements Runnable {
TargetDataLine line;
Thread thread;
String errStr=null;
DataOutputStream out=null;
AudioInputStream audioInputStream;
final int bufSize = 16384;
int duration=0;
public Capture(DataOutputStream out)
this.out=out;
public void start() {
errStr = null;
thread = new Thread(this);
thread.setName("Playback");
thread.start();
public void stop() {
thread = null;
private void shutDown(String message) {
if ((errStr = message) != null) {
System.out.println(errStr);
if (thread != null) {
thread = null;
public AudioFormat getFormat() {
AudioFormat.Encoding encoding = AudioFormat.Encoding.ULAW;
String encString = "linear";
float rate = Float.valueOf("44100").floatValue();
int sampleSize = 16;
String signedString = "signed";
boolean bigEndian = true;
int channels = 2;
if (encString.equals("linear")) {
if (signedString.equals("signed")) {
encoding = AudioFormat.Encoding.PCM_SIGNED;
} else {
encoding = AudioFormat.Encoding.PCM_UNSIGNED;
} else if (encString.equals("alaw")) {
encoding = AudioFormat.Encoding.ALAW;
return new AudioFormat(encoding, rate, sampleSize,
channels, (sampleSize/8)*channels, rate, bigEndian);
public void run() {
duration = 0;
audioInputStream = null;
// define the required attributes for our line,
// and make sure a compatible line is supported.
AudioFormat format = getFormat();
DataLine.Info info = new DataLine.Info(TargetDataLine.class,
format);
if (!AudioSystem.isLineSupported(info)) {
shutDown("Line matching " + info + " not supported.");
return;
// get and open the target data line for capture.
try {
line = (TargetDataLine) AudioSystem.getLine(info);
line.open(format, line.getBufferSize());
} catch (LineUnavailableException ex) {
shutDown("Unable to open the line: " + ex);
return;
} catch (SecurityException ex) {
shutDown(ex.toString());
return;
} catch (Exception ex) {
shutDown(ex.toString());
return;
// play back the captured audio data
int frameSizeInBytes = format.getFrameSize();
int bufferLengthInFrames = line.getBufferSize() / 8;
int bufferLengthInBytes = bufferLengthInFrames * frameSizeInBytes;
byte[] data = new byte[bufferLengthInBytes];
int numBytesRead;
line.start();
try
while (thread != null) {
if((numBytesRead = line.read(data, 0, bufferLengthInBytes)) == -1) {
break;
if(data.length>0)
out.write(data, 0, numBytesRead);
out.flush();
catch (Exception e)
e.printStackTrace();
// we reached the end of the stream. stop and close the line.
line.stop();
line.close();
line = null;
// stop and close the output stream
try {
out.flush();
out.close();
} catch (IOException ex) {
ex.printStackTrace();
} // End class CaptureAfter a few days work, I have completed the mian voice chat program. I know there are so many people like me that wants that. I post these program. i will complete gui work later. and there is a problem in the program. if the speaking one do not speak for a while, the listening client will hear noise. Can some one help me.
package com.longshine.voice;
import java.io.*;
import java.net.*;
import java.util.*;
public class Server
// The ServerSocket we'll use for accepting new connections
private ServerSocket ss;
// A mapping from sockets to DataOutputStreams. This will
// help us avoid having to create a DataOutputStream each time
// we want to write to a stream.
private Hashtable outputStreams = new Hashtable();
final int bufSize = 16384;
//current speak_man
private int speakman=-1;
// Constructor and while-accept loop all in one.
public Server( int port ) throws IOException {
// All we have to do is listen
listen( port );
private void listen( int port ) throws IOException {
// Create the ServerSocket
ss = new ServerSocket( port );
// Tell the world we're ready to go
System.out.println( "Listening on "+ss );
// Keep accepting connections forever
while (true) {
// Grab the next incoming connection
Socket s = ss.accept();
// Tell the world we've got it
System.out.println( "Connection from "+s );
// Create a DataOutputStream for writing data to the
// other side
DataOutputStream dout = new DataOutputStream( s.getOutputStream() );
// Save this stream so we don't need to make it again
outputStreams.put( s, dout );
// Create a new thread for this connection, and then forget
// about it
new VoiceServer( this, s );
// Get an enumeration of all the OutputStreams, one for each client
// connected to us
Enumeration getOutputStreams() {
return outputStreams.elements();
// Send a message to all clients (utility routine)
void sendToAll( byte[] voice ,Socket socket) {
// We synchronize on this because another thread might be
// calling removeConnection() and this would screw us up
// as we tried to walk through the list
synchronized( outputStreams ) {
// For each client ...
for (Enumeration e = outputStreams.keys(); e.hasMoreElements(); ) {
// ... get the output stream ...
Socket tmp=(Socket)e.nextElement();
if(!tmp.equals(socket))
try {
DataOutputStream dout = new DataOutputStream(tmp.getOutputStream());
// ... and send the message
dout.write(voice,0,44096);
dout.flush();
} catch( IOException ie ) { System.out.println( ie ); }
// Remove a socket, and it's corresponding output stream, from our
// list. This is usually called by a connection thread that has
// discovered that the connectin to the client is dead.
void removeConnection( Socket s ) {
// Synchronize so we don't mess up sendToAll() while it walks
// down the list of all output streamsa
synchronized( outputStreams ) {
// Tell the world
System.out.println( "Removing connection to "+s );
// Remove it from our hashtable/list
outputStreams.remove( s );
// Make sure it's closed
try {
s.close();
} catch( IOException ie ) {
System.out.println( "Error closing "+s );
ie.printStackTrace();
// Main routine
// Usage: java Server <port>
static public void main( String args[] ) throws Exception {
// Get the port # from the command line
int port = Integer.parseInt( args[0] );
// Create a Server object, which will automatically begin
// accepting connections.
new Server( port );
package com.longshine.voice;
import java.net.*;
import java.io.*;
import java.sql.*;
import java.io.*;
import java.net.*;
public class VoiceServer extends Thread
// The Server that spawned us
private Server server;
final int bufSize = 16384;
// The Socket connected to our client
private Socket socket;
// Constructor.
public VoiceServer( Server server, Socket socket ) {
// Save the parameters
this.server = server;
this.socket = socket;
// Start up the thread
start();
// This runs in a separate thread when start() is called in the
// constructor.
public void run() {
try {
// Create a DataInputStream for communication; the client
// is using a DataOutputStream to write to us
DataInputStream din = new DataInputStream( socket.getInputStream() );
byte[] voice=new byte[44096];
// Over and over, forever ...
while (true) {
// ... read the next message ...
// int bytes = din.read(voice,0,44096);
int bytes = din.read(voice);
// ... and have the server send it to all clients
server.sendToAll(voice,socket);
} catch( EOFException ie ) {
// This doesn't need an error message
} catch( IOException ie ) {
// This does; tell the world!
ie.printStackTrace();
} finally {
// The connection is closed for one reason or another,
// so have the server dealing with it
server.removeConnection( socket );
package com.longshine.voice;
import java.io.*;
import java.net.*;
public class Client {
private String host="";
private String port="";
private Socket socket;
private DataOutputStream dout;
private DataInputStream din;
private Capture capture=null;
private Play play=null;
public Client(String host,String port) {
this.host=host;
this.port=port;
public void init()
try
socket = new Socket( host, Integer.parseInt(port));
din = new DataInputStream( socket.getInputStream() );
dout = new DataOutputStream( socket.getOutputStream());
capture=new Capture(dout);
play=new Play(din);
catch(Exception e)
e.printStackTrace();
public static void main(String[] args) {
Client client = new Client("172.18.220.176","5678");
client.init();
if(args[0].equalsIgnoreCase("say"))
client.capture.start();
if(args[0].equalsIgnoreCase("hear"))
client.play.start();
package com.longshine.voice;
import java.io.*;
import java.util.Vector;
import java.util.Enumeration;
import javax.sound.sampled.*;
import java.text.*;
import java.net.*;
public class Play implements Runnable {
SourceDataLine line;
Thread thread;
String errStr=null;
DataInputStream in=null;
AudioInputStream audioInputStream;
final int bufSize = 16384;
int duration=0;
public Play(DataInputStream in)
this.in=in;
public void start() {
errStr = null;
thread = new Thread(this);
thread.setName("Playback");
thread.start();
public void stop() {
thread = null;
private void shutDown(String message) {
if ((errStr = message) != null) {
System.err.println(errStr);
if (thread != null) {
thread = null;
public void createAudioInputStream() {
if (in != null ) {
try {
errStr = null;
java.io.BufferedInputStream oin = new java.io.BufferedInputStream(in);
audioInputStream = AudioSystem.getAudioInputStream(oin);
} catch (Exception ex) {
ex.printStackTrace();
} else {
public void run() {
// reload the file if loaded by file
if (in != null) {
// createAudioInputStream();
// make sure we have something to play
// if (audioInputStream == null) {
// shutDown("No loaded audio to play back");
// return;
// reset to the beginnning of the stream
// try {
// audioInputStream.reset();
// } catch (Exception e) {
// shutDown("Unable to reset the stream\n" + e);
// return;
// get an AudioInputStream of the desired format for playback
AudioFormat format = getFormat();
audioInputStream=new AudioInputStream(in, format, AudioSystem.NOT_SPECIFIED);
AudioInputStream playbackInputStream = AudioSystem.getAudioInputStream(format, audioInputStream);
if (playbackInputStream == null) {
shutDown("Unable to convert stream of format " + audioInputStream + " to format " + format);
return;
// define the required attributes for our line,
// and make sure a compatible line is supported.
DataLine.Info info = new DataLine.Info(SourceDataLine.class,
format);
if (!AudioSystem.isLineSupported(info)) {
shutDown("Line matching " + info + " not supported.");
return;
// get and open the source data line for playback.
try {
line = (SourceDataLine) AudioSystem.getLine(info);
line.open(format, bufSize);
} catch (LineUnavailableException ex) {
shutDown("Unable to open the line: " + ex);
return;
// play back the captured audio data
int frameSizeInBytes = format.getFrameSize();
int bufferLengthInFrames = line.getBufferSize() / 8;
int bufferLengthInBytes = bufferLengthInFrames * frameSizeInBytes;
byte[] data = new byte[bufferLengthInBytes];
int numBytesRead = 0;
// start the source data line
line.start();
while (thread != null) {
try {
if ((numBytesRead = playbackInputStream.read(data)) == -1) {
break;
int numBytesRemaining = numBytesRead;
while (numBytesRemaining > 0 ) {
numBytesRemaining -= line.write(data, 0, numBytesRemaining);
} catch (Exception e) {
shutDown("Error during playback: " + e);
break;
// we reached the end of the stream. let the data play out, then
// stop and close the line.
if (thread != null) {
line.drain();
line.stop();
line.close();
line = null;
shutDown(null);
public AudioFormat getFormat() {
AudioFormat.Encoding encoding = AudioFormat.Encoding.ULAW;
String encString = "linear";
float rate = Float.valueOf("44100").floatValue();
int sampleSize = 16;
String signedString = "signed";
boolean bigEndian = true;
int channels = 2;
if (encString.equals("linear")) {
if (signedString.equals("signed")) {
encoding = AudioFormat.Encoding.PCM_SIGNED;
} else {
encoding = AudioFormat.Encoding.PCM_UNSIGNED;
} else if (encString.equals("alaw")) {
encoding = AudioFormat.Encoding.ALAW;
return new AudioFormat(encoding, rate, sampleSize,
channels, (sampleSize/8)*channels, rate, bigEndian);
} // End class Playback
package com.longshine.voice;
import java.io.*;
import java.util.Vector;
import java.util.Enumeration;
import javax.sound.sampled.*;
import java.text.*;
import java.net.*;
public class Capture implements Runnable {
TargetDataLine line;
Thread thread;
String errStr=null;
DataOutputStream out=null;
AudioInputStream audioInputStream;
final int bufSize = 16384;
int duration=0;
public Capture(DataOutputStream out)
this.out=out;
public void start() {
errStr = null;
thread = new Thread(this);
thread.setName("Playback");
thread.start();
public void stop() {
thread = null;
private void shutDown(String message) {
if ((errStr = message) != null) {
System.out.println(errStr);
if (thread != null) {
thread = null;
public AudioFormat getFormat() {
AudioFormat.Encoding encoding = AudioFormat.Encoding.ULAW;
String encString = "linear";
float rate = Float.valueOf("44100").floatValue();
int sampleSize = 16;
String signedString = "signed";
boolean bigEndian = true;
int channels = 2;
if (encString.equals("linear")) {
if (signedString.equals("signed")) {
encoding = AudioFormat.Encoding.PCM_SIGNED;
} else {
encoding = AudioFormat.Encoding.PCM_UNSIGNED;
} else if (encString.equals("alaw")) {
encoding = AudioFormat.Encoding.ALAW;
return new AudioFormat(encoding, rate, sampleSize,
channels, (sampleSize/8)*channels, rate, bigEndian);
public void run() {
duration = 0;
audioInputStream = null;
// define the required attributes for our line,
// and make sure a compatible line is supported.
AudioFormat format = getFormat();
DataLine.Info info = new DataLine.Info(TargetDataLine.class,
format);
if (!AudioSystem.isLineSupported(info)) {
shutDown("Line matching " + info + " not supported.");
return;
// get and open the target data line for capture.
try {
line = (TargetDataLine) AudioSystem.getLine(info);
line.open(format, line.getBufferSize());
} catch (LineUnavailableException ex) {
shutDown("Unable to open the line: " + ex);
return;
} catch (SecurityException ex) {
shutDown(ex.toString());
return;
} catch (Exception ex) {
shutDown(ex.toString());
return;
// play back the captured audio data
int frameSizeInBytes = format.getFrameSize();
int bufferLengthInFrames = line.getBufferSize() / 8;
int bufferLengthInBytes = bufferLengthInFrames * frameSizeInBytes;
byte[] data = new byte[bufferLengthInBytes];
int numBytesRead;
line.start();
try
while (thread != null) {
if((numBytesRead = line.read(data, 0, bufferLengthInBytes)) == -1) {
break;
if(data.length>0)
out.write(data, 0, numBytesRead);
out.flush();
catch (Exception e)
e.printStackTrace();
// we reached the end of the stream. stop and close the line.
line.stop();
line.close();
line = null;
// stop and close the output stream
try {
out.flush();
out.close();
} catch (IOException ex) {
ex.printStackTrace();
} // End class Capture -
Hey I'm looking for a specific voice chat application. I would like an app that would allow multiple users to join a chat room and talk via voice with each other on the iphone. I would like this app to also allow users on a PC to join into this voice chat with iphone users. I would also like to make the chat room private so only certain users can join the chat room. Is there an existing application that accomplishes this? I have searched around the internet and haven't found anything yet. Thanks.
Stebalien wrote:Cool! However, the key exchange system looks a little unwieldy; personally, I would give everyone a permanent "identity" key (preferably allow the user to a GPG key) and then use the socialist millionaire's protocol (SMP) to exchange these keys. Once the keys have been exchanged, they can be used to negotiate shared session keys. This way, once you talk to someone once, you don't need to keep manually sharing a key with them. The OTR library (libotr) does this very well but I don't know how usable it would be for this project (it's intended for layering encryption over existing IM protocols).
Really thanx for your interest, i refer to the main developer . Be free to come in #seren on irc.freenode.net , to talk directly with him and the community! -
How to design a chat applet?
Hello,
I have to design a chat applet in such a way that two users on different systems should be able to chat to each other after they login into a site. The applet should be able to save the transcript after the chat gets over (and that is considered to be done when one of the users logs out or closes the browser window).
How do I design such an applet? Should I use sockets to enable communication between the browsers? Is there any place where I can get source code for similar applets?
Regards,
Arun Jayaprakash.The pages have to be designed in ASP. The applet should only provide the functionality of a chat room with the specifications that I had mentioned in an earlier post.
Regards,
Arun Jayaprakash. -
Can't seem to enable voice chat anymore
hello folks
i just upgraded to an audigy but now when my friend and i try to initiate voice chat through x-fire and msn we can't hear each other at all, where we had no problems before...
i've got a p4 3.6ghz with gb of ram and i've disabled my onboard sound card in the bios.
i've also tested my mic and speakers through the audio tab in control panel in xp.
any ideas?actionthom,
In the Creative Mixer, in the REC panel, make sure you have Mircrophone selected. Move the slider to your volume preference. Click on the red "+" at the top and select 20dB boost. If you want your own speakers to play what you say into the mic, then in the Source panel, un-mute Microphone. Adjust that slider to your preference. It's usually a good idea to mute any other sources you don't want.
Also, in Control Panel, Sounds and MultiMedia (or something similar for your system), Audio tab, make sure your Audigy is selected as the preferred device for Playback, Recording, etc. If you have a "Use only preferred devices" box, check it.Message Edited by Katman on 0-30-2006 07:4 PM -
Java Chat applet won't send messages
So i got a brand new MacBook Air yesterday with Mac OS X 10.8.2 and installed Java 7 Update 9 from Oracle.
When using Safari 6 i run into a problem with a browser based Java chat applet.
First of all: Java and Javascript are actibated in Safari.
So I go to the chat's website and start the chat.
Java works fine at first and the chat starts.
People can send me private messages and i can type in a reply.
However I cannot send these replies. Neither in the private messages (applet) nor in the main chat (browser).
Any idea how to fix this issue?
(BTW: Java 7 was the first Java ever installed on my Air, so no going back to Apples Java 6)And Java 7 Update 10 did not solve the problem either.
Can anybody offer any ideas for a solution?
Help would be much appreciated. -
How to activate browser(to top) whenever chat applet recieves new message
This is problem with Chat applet. This chat applet is placed in a web page. It is working fine with all the messages recived. But my problem is , the page(if winow is minimized)) sholud activate to top of all applications whenever applet recieves a new message .
How can this be solved.
ThanksWell, you could try getting the parent window of the applet (use getParent() till you find a Window object) and call toFront, but I don't think there's anything you can do if it's minimized.
-
hello,
i developed a chat applet using JDK 1.3 .It is a swing applet.when i compile and run the applet ,it runs well inthe appletviewer.In IE ,it shows the following error "java.lang.ClassNotFoundException: javax.swing.JApplet".I think it needs java plugin.In JDK 1.3, javaplugin is already builtin.Then why it shows the above said error?.Kindly clarify the error.THIS IS VERY URGENT.i also have done that type of applicaton with messenger , if you use Only Applet
then client side browser have also java plugin in defult and suport Applet but
if you use JApplet then u should have to use java plugin which support Swing
at client side.
i come at this Forum some time, if you u have any problem then u can
contect me at [email protected]
OK ? -
Chat applet closes browser!!
I'm programming a chat applet using MulticastSockets
the connect button does something like this:
dest = new InetSocketAddress("228.5.6.7",4321);
try{
socket = new MulticastSocket(4321);
NetworkInterface netif = NetworkInterface.getByInetAddress(InetAddress.getLocalHost());
socket.joinGroup(dest, netif);
InetAddress address = InetAddress.getByName("228.5.6.7");
socket.joinGroup(address);
I also have a signed jar file so the client gives rights to the applet (so it can open the sockets)
It works on win2k and winXP but on win98 when the client clicks the connect button the browser closes itself. I don't know what kind of error could produce this.
Any ideas??In response to the original: Have you tried updated browsers on the 98 machine?
In response to everthing else:
If you were developing a chat application using php and javascript, I could understand using the http protocol, but if you're using an applet, why not just connect with a socket? And, for that matter, it seems fairly simple to make it peer-to-peer and just connect to whoever you want to send to.(just keep a hash of names and ip's)
The conversation is interesting though since I've thought about the feasability of creating a php/javascript client to jabber. As far as keeping the http connection open and polling, seems like you could specify some send rate from the server side(1 packet every other second isn't the end of the world) and re-poll whenever the client hasn't received a packet for a straight 3 seconds, or something like that...
The problem with php and javascript is that they really have funny threading and time limits(some that are server invoked), but I suppose this can be circumvented. There are loopholes. -
How does chat applet works?
how does chat applet works? What specific technologies should i learn to make a chat messaging work?
thanks in advance for ur help...Chat applets work on sockets. Normally there are two parts. One server and one or more clients. The clients connect to the server and any message sent by a client is then distributed by the server to all the other clients.
Sun's site is incredibly slow tonite so I'll give you a google link
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=chatserver+chatclient+java
Maybe you are looking for
-
IPod touch 4th gen not connecting to anything
I got an iPod touch 4th generation for my birthday yesterday, it was charging and working fine until a few hours ago, my computer and iTunes can't find it, the whole adapter doesn't work basically, I even tried connecting it to my adapter and it stil
-
Connection errors with Pioneer AVH P3100DVD Car Stereo after iOS4.1 Update
I just upgraded to iOS 4.1 and now my Pioneer AVH P3100DVD car stereo has a "skipping" problem like a record or CD with a scratch in it when connected to my iPhone 4. I've tried disconnecting the USB cable, restarting both my iPhone 4 as well as my c
-
Spry validation not working in latest FF or Chrome
Hello, A simple Spry validation script that we're using is not working in the latest editions of Firefox or Chrome. (However it is working in IE). Meaning, it doesn't validate the form elements as it's supposed to (like missing email address) except
-
my canon printer iP6000D has begun to print my spreadsheet words as what i would describe as "non-words" The numbers in the spreadsheet print as typed but the english words do not print as typed. For example: CELLS is printed out as & LLS. Another wo
-
NetBackup 3.4 Client is not starting up in Solaris 10
Hello All, I have a problem while connecting to NetBackup Client on Solaris 10. Here is a line from inetd.conf: bpcd stream tcp nowait root /usr/openv/netbackup/bin/bpcd bpcd However the inetd.conf is no longer directly used to configure inetd. Servi