How i can run audio file remotely ??

{color:#000080}*Hi for all*{color}
i have sound file in my local machine, and i want to run and start the file on remote machine, ( where the remote user just can hear the sound without storing file on it).
i tryed to do that, but faced some problems,
*{color:#0000ff}The main problem is the sound never heared in the remote machine.{color}*
Server program run try "lawha.wav"Audio file into client.+_
My attempts bellow;{color}
{color:#ff0000}*Server Code*{color}
import java.io.*;*
*import java.net.*;
import javax.sound.sampled.*;
public class Server{
ObjectOutputStream send;
ServerSocket socket ;
Socket in;
AudioInputStream audioInputStream;
public static void main( String[]args ){
new Server();
public Server(){
mThread m = new mThread();
m.start();
class mThread extends Thread{
public void run(){
try{
System.out.println("Server is running..");
socket = new ServerSocket(10000);
System.out.println("Server run on PORT : 12500");
while(true){
audioInputStream = AudioSystem.getAudioInputStream(new File("c:\\lawha.wav"));
System.out.println("channel for sound file is ready");
in = socket.accept();
System.out.println("Server accepts new client");
send = new ObjectOutputStream(in.getOutputStream());
System.out.println("transfer channel is ready now");
System.out.println("**************************************");
sendStream();
catch(Exception ex){ex.printStackTrace();}
}// End .. try catch
public synchronized void sendStream()throws Exception
byte[] buffer = new byte[100];
int size;
while( (size = audioInputStream .read(buffer,0,buffer.length)) != -1 ){
send.write(buffer, 0, size);
System.out.println("Server : send the bytes");
send.flush();
}}*{color:#ff0000}Client Code{color}*
import java.io.*;*
*import java.net.*;
import javax.sound.sampled.*;
public class Client
ObjectInputStream input;
Socket socket;
SourceDataLine sourceDataLine;
AudioFormat audioFormat;
AudioInputStream audioInputStream;
ByteArrayOutputStream byteArrayOutputStream = null;
byte[] buffer;
public static void main( String[]args ){
new Client();
public Client(){
try{
socket = new Socket("192.168.1.3", 10000);
input = new ObjectInputStream(socket.getInputStream());
ReciveStream rThread = new ReciveStream();
rThread.start();
catch(Exception ex){ex.printStackTrace();}
public class ReciveStream extends Thread{
public void run(){
try{
byte[] buffer = new byte[100];
audioFormat = getAudioFormat();
System.out.println("construc the format");
DataLine.Info dataLineInfo = new DataLine.Info(SourceDataLine.class,audioFormat);
System.out.println("data Line Information is ready now");
sourceDataLine = (SourceDataLine) AudioSystem.getLine( dataLineInfo);
sourceDataLine.open(audioFormat);
System.out.println("the source is opened");
sourceDataLine.start();
System.out.println("the source is started");
while(true){
input.read(buffer);
System.out.println("Client : recieve the bytes");
sourceDataLine.write(buffer, 0, buffer.length );
catch(SocketException ex){ex.printStackTrace();}
catch(IOException ex){ex.printStackTrace();}
catch(Exception ex){ex.printStackTrace();}
System.out.println("after Exception");
public AudioFormat getAudioFormat(){
float sampleRate = 44100.0f;
//8000,11025,16000,22050,44100
int sampleSizeInBits = 16;
//8,16
int channels = 2;
//1,2
boolean signed = true;
//true,false
boolean bigEndian = false;
//true,false
return new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, sampleRate, sampleSizeInBits, channels, 4, sampleRate, bigEndian);
}Edited by: SunJD on Apr 27, 2009 9:42 AM

kajbj wrote:
Why are you using ObjectInputStream and ObjectOutputStream?i just tried to use any Out/InputStream without any other considerations..
so what is your suggestions ??

Similar Messages

  • How I can run WRT54GSv5v6_v1.52.0_fw on windows XP

    I Have trouble to run this file on my Windows XP it says that is a .bin file  how I can run this file with?

    Not at all. This is the firmware file. You have to upload it to the router. Please see here for more instructions how to upgrade the firmware on your router.

  • How to delete unused audio files in a project?

    Hi guys,
    The question is fairly simple:
    How to delete unused audio files in a project?
    I can't manage to find the answer in the manual,... all I could find is how to delete audio outside used regions!
    But in the projects I use, I have loads of outtakes which I don't use in the project anymore, and now, I would like to delete them of the audio folder to save space on the HD.
    Can Logic select automatically the takes in the audio files folder which are not used in the project and delete them??
    Because there is hundreds of audio files per project, and +/- 50 projects, I just can't do it manually.
    Thanks,
    Fred

    Whoops! Yes, I knew that but a cow flew by... Sorry!
    The procedure I follow is to do what I described then Save as Project, creating a project folder. That way only the required audio is saved to the folder and I delete all temporary stuff. However, if you have folders with shared material, it's much harder and would require you to go through all your projects doing Save as Project before you could delete your old working folder.
    When doing day to day work, best practice is to create a new folder and only use Save as Project when you're working on stuff. Shared material (eg sample libraries etc) can go elsewhere and you can get Logic to copy those to the project folder automatically.
    Otherwise, Shift-Backspace in the Audio window, as you rightly say
    Pete

  • How to add an audio file to a link

    I am working on a project using IWeb and I am trying to figure out if it is possible and then, if it is how to add an audio file to a link. I would really be glad of your help as I am having problems meeting the requirements of the project if I don't make it work.
    Also, is it possible when having added a movie clip from quick time player to have the clip start as soon as the page is "opening", that is without pressing the play button?
    I am waiting in great suspense to see if anybody can help me out. If you have the answers to my questions, please send me an email at [email protected] - thank you so much :o)

    Hi Maiken
    Welcome to the discussion forums.
    All you need is open iWeb, select text or image, open inspector, go to link, check the "enable as a hyperlink" box, in "link to" there's a teardown menu where you select "a file" and select the file you want to link to.
    If you want to have it downloading look at [this|http://alyeska.altervista.org/en/iWeb_Downloads.html]
    For the second question:
    select the movie file in iWeb go to inspector, then to the last icon (showing the quicktime logo) and check the box that say "Autoplay".
    Regards,
    Cédric

  • How do I transfer audio files from my laptop to my iPod classic

    How do I transfer audio files from my laptop to my iPod

    Thank you for using the Apple Support Communities
    You can synchronize audio files from iTunes to your iPod.
    https://www.apple.com/support/ipodclassic/how-to/
    -Zeph

  • How we can open pdf files in epic browser in English

    how we can open pdf files in epic browser in English
    message is appearing in epic browser during opening pdf files in browser " The adobreader /acrobat reader is running cannot be used to view pdf files , please exit and try again "

    I already fixed it. I never exited out of Firefox before deleting the mime file. it works now.

  • How to write run.bat files

    Can anyone tell me how to write run.bat files to run java classes. Currently my run.bat file has the following two lines,
    c:\j2sdk1.4.1_02\bin\javac.exe *.java
    c:\j2sdk1.4.1_02\bin\java.exe questionnair
    But the class is not executed. Thanks in advance.

    you'll have to provide more details.
    Firstly, which package is the class a part of? and secondly, where on the filesystem is the root of the package?
    You might also benifit from placing the c:\j2sdk1.4.1_02\bin\ into the classpath.
    On a rainy day, check out the ANT tool, it will take care of all that crapola for you.
    newio

  • How does Airplay transfer audio file format to an Airport Express?

    Hi, everyone
    How does Airplay transfer audio file format to an Airport Express?
    Many from the Internet claim that iTunes encodes an AIFF file format into an Apple Lossless Audio Codec (ALAC) file format before sending signal to an Airport Express.
    Is that true?
    If so, would it still make sense for me to have AIFF files on my music server
    or should I have ALAC files instead?
    Please advise.
    Thank you.
    BR,
    George Lien

    Many from the Internet claim that iTunes encodes an AIFF file format into an Apple Lossless Audio Codec (ALAC) file format before sending signal to an Airport Express.
    Is that true?
    Yes. The AirPort Express Base Station (AX) works only with iTunes v4.6+ and is limited to music files that iTunes can read; ie, 16-bit data only. These data, though, can be in any file format that iTunes recognizes, from lossy MP3s at the low-quality end of the spectrum to Apple Lossless and lossless AIFF or WAV files at the high end. It is also important to note that the AX functions only at a 44.1kHz sample rate. When you play 32kHz or 48kHz data, iTunes sample-rate-converts the data in real time before sending it to the AX.
    iTunes uses a QuickTime CODEC to convert audio files to Apple Lossless, and then, uses AirPlay to send them to the AX. In turn, the AX uses built-in software that converts the Apple Lossless to an Encoded Digital Audio format. From there, digital audio is sent to a optical transceiver to convert the electrical signal to an optical one before sending it to the innermost part of the audio port. For analog, the AX has a built-in DAC to convert the Encoded Digital Audio to Analog which is sent to the same audio port.
    If so, would it still make sense for me to have AIFF files on my music server
    or should I have ALAC files instead?
    If you have audio files in both formats, I would elect just to keep the ALAC (.m4a) files on the music server.

  • How do you consolidate audio files in Premiere? (Make multiple audio files on a track one file)

    How do you consolidate audio files in Premiere? (Make multiple audio files on a track one file). Also, my client is having a hard time making an omf that Pro Tools can read. The files can not be found by Pro Tools. How do you make an omf that Pro Tools can read?

    Multichannel export;
    http://strypesinpost.com/2012/11/exporting-multichannel-quicktimes-in-premiere-pro/
    When you export the OMF, select Encapulate Files in the Settings window

  • HOW I CAN OPEN .VOB FILES

    HOW I CAN OPEN .VOB FILES FROM QUICK TIME TO CONVERT FOR IPOD VIDEO?

    .VOB files are MPEG-2 format. QuickTime can't play them without the help of the MPEG-2 Playback Component ($20) and can't export the audio when "converting".
    MPEG Streamclip 1.5.1 (free) can convert the audio and video to .mp4 format for iPod playback. It even has an iPod preset that changes all of the file settings to iPod specs.

  • I can't open any 60p .mov files in quicktime.  Footage was shot on a JVC GY HM150 which is supposed to record in native fcp format.  Any ideas how I can open these files successfully?

    I can't open any 60p .mov files in quicktime or FCP5.  Sometimes in QT the audio plays but not the video. Footage was shot on a JVC GY HM150 which is supposed to record in native fcp format.  Any ideas how I can open these files successfully?

    Get ClipWrap2 and convert to an editable format for your version of FCP5.
    Probably DVCProHD will work
    x

  • How I can watch *.avi files on OS9.2.2?

    Can anybody tell me, how I can watch *.avi files on OS9.2.2? I've installed plenty of codecs (DivX, 3ivx) for QuickTime, but have only video WITHOUT sound! Somebody says, that I need AC3... I've tryed install it too, but without result...
    My system: OS 9.2.2, QuickTime Pro v.6
    iMac G3 (OS X), Pismo with OS9    

    Take a look at the DivX Doctor 2 info on the 3ivx site. It has some info on AC3 audio, although I am not sure if it applies to OS 9.
    http://www.3ivx.com/divxdoctor/

  • Hello, I would like to know how I can open a file without downloading it? Thank you

    Hello, I would like to know how I can open a file without downloading it? Thank you

    matrix wrote in message
    news:[email protected]..
    > I tried that, attached is the vi.
    > My actual aim is to allow data to be plotted to the graph 4 24 hours,
    > after which, it should clear the chart and start at the beginning
    > agin.
    > Does this vi do this.
    No. The attached is the simplest way of modifying it to do as you want. I've
    sped things up a little to make it obvious.
    > Will the array be able to keep all the data, is there a way i can do
    > it without arrays, i.e. kind of dynamically, and therefore try to save
    > memory usage.
    You already are. You're making the arrays as you go along so only the memory
    needed for the data that's in the plot is in use at any one time. To do it
    without storing
    arrays at all you'd need to keep retrieving the data from
    the XYgraph, adding the new datapoint and writing it back. Messy and I
    suspect incredibly inefficient.
    You're going to use the memory in any case- a better option would be to
    pre-initialise an array and fill it slowly. At the end of each 24 hour block
    zap all the data and start again without destroying and recreating the
    arrays. Or if you're only doing the 24 hour wipes to save memory, simply
    start again at the start of the buffer woithout erasing the previous data
    and you always have 24 hours of data to liik at once the system's running.
    Do a search for keywords like "pre initialise" or "circular buffer" on
    ni.com
    [Attachment xy-time_modified.vi, see below]
    Attachments:
    xy-time_modified.vi ‏51 KB

  • I need to convert PDF file to Word Document, so it can be edited. But the recognizing text options do not have the language that I need. How I can convert the file in the desired of me language?

    I need to convert PDF file to Word Document, so it can be edited. But the recognizing text options do not have the language that I need. How I can convert the file in the desired of me language?

    The application Acrobat provides no language translation capability.
    If you localize the language for OS, MS Office applications, Acrobat, etc to the desired language try again.
    Alternative: transfer a copy of content into a web based translation service (Bing or Google provides a free service).
    Transfer the output into a word processing program that is localized to the appropriate language.
    Do cleanup.
    Be well...

  • Does anyone know how i can view PDF files using Galaxy Note 2?

    Does anyone know how i can view PDF files using Galaxy Note 2?
    This is what i have been doing;
    I click on the file i wish to view (via a portal)
    this file goes to notification widget (i drag down screen)
    notification/message says download complete
    i click on notification/message
    nows it says complete action using (here i only have 2 icon options 1= DB Text Editor 2 = HTML Viewer)
    I have installed Adobe Reader.

    Can you confirm if the downloaded file is a pdf file, that is it ends with .pdf?

Maybe you are looking for