Playing Streaming Sampled Audio try { // From file AudioInputStream stream = AudioSystem.getAudioInputStream( new File("audiofile")); // From URL stream = AudioSystem.getAudioInputStream( new URL("http://hostname/audiofile")); // At present, ALAW and ULAW encodings must be // converted // to PCM_SIGNED before it can be played. AudioFormat format = stream.getFormat(); if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) { format = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, format.getSampleRate(), format.getSampleSizeInBits()*2, format.getChannels(), format.getFrameSize()*2, format.getFrameRate(), true); // big endian stream = AudioSystem.getAudioInputStream( format, stream); } SourceDataLine.Info info = new DataLine.Info( //The next two lines should be in one line SourceDataLine.class, stream.getFormat(), //The next two lines should be in one line ((int)stream.getFrameLength( )*format.getFrameSize())); //The next two lines should be in one line SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info); line.open(stream.getFormat()); line.start(); int numRead = 0; byte[] buf = new byte[line.getBufferSize()]; //The next two lines should be in one line while ((numRead = stream.read(buf, 0, buf.length)) >= 0) { int offset = 0; while (offset < numRead) { offset += line.write(buf, offset, numRead-offset); } } line.drain(); line.stop(); } catch (MalformedURLException e) { } catch (IOException e) { } catch (LineUnavailableException e) { } catch (UnsupportedAudioFileException e) { }