Solved

Applet to capture audio and save .wav at the web server

Posted on 2000-02-19
7
345 Views
Last Modified: 2012-06-27
Hi,
   I have developed an applet that captures audio from mic
   and saves sound on the client machine. However, I need to
   to store this file at the web server, without creating any
   file at the web server.

   Can anyone help me out ?

regards,
Raghu.
0
Comment
Question by:raghurani
  • 3
  • 2
  • 2
7 Comments
 
LVL 1

Author Comment

by:raghurani
ID: 2539337
More details :

I do not wish to go for RTP as it does not guarantee no-loss transmission. More over, I do NOT wish to
play the sound at the web-server, on the fly. I just need to save it as a file.
0
 
LVL 8

Expert Comment

by:diakov
ID: 2539498
"...However, I need to
   to store this file at the web server, without creating any
   file at the web server..."

This is a bit difficult to understand.

The applet actually runs on the client machine, and you need something at the server side to be able to accept the data stream you send to it and save it to a file.
You can ise a servlet, CGI program, separate application that listens on a socket, etc.

Servlet would be the best choice.

Cheers,
  Nik
0
 
LVL 7

Accepted Solution

by:
Ravindra76 earned 200 total points
ID: 2539692
I agree with diakov

Ur comments
>>

"...However, I need to
   to store this file at the web server, without creating any
   file at the web server..."

is not clear.

Storing the file at webserver without creating any file is confusing..

If U want applet to write to webserver
see the below text otherwise ignore my comment..
Write all the code in servlet to write into the file.
Call this servlet from applet by using URLConnection class.

I think You know the syntax of connecting applet to servlet

URLConnection conn = new URL("http://yoursite:yourport/servlet/YourServlet"').openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.connect();

Nothing to do in your applet because all will handle by servlet


Your servlet basically contains the following code

// Write code to inport necessary.

public class YourServlet extends HttpServlet {

   // Write code for init method if needed
  // write code for service or doget or dopost method depending on your strategy

public void service(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException {

  String filename = "a.txt";
  /* If you want filename from applet,append it like this in your appletcode

   URL url = new URL("http://yoursite:yourport/servlet/yourservlet?filename=a.txt");
    URLConnection =  url.openConnection(); */
// in this case

 // String filename = req.getParameter("filename");
   
// Write normal code to open file and print it.Put it in try,catch block

 FileWriter fw = new FileWriter(filename);
 fw.pritln("HelloWorld")
   



 
Comment  
From: mbormann
 Date: Friday, October 22 1999 - 11:00PM CST    
(1)
http://www.j-nine.com/pubs/applet2servlet/index.htm 
http://www.devx.com/upload/free/features/javapro/1999/05may99/lo0599/lo0599.asp 

(2)
http://www.servletsource.com/code/writefile.html 
http://www.servletsource.com/code/ReadFile.html

 
Best of luck
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 8

Expert Comment

by:diakov
ID: 2539739
Well, a database on the server is also an option, then a direct JDBC connection (depends on the DBMS) or again through a servlet are the possibilities.

Nik
0
 
LVL 1

Author Comment

by:raghurani
ID: 2553349
Well,

  I need to capture the audio and save it in a file
  at the server end. I am able to capture the sound
  & store it in javax.sound.sampled.AudioInputStream.
  However I was not able to pass it no to the servlet
  as it requires the object to be serialized. For this I
  "wrapped" AudioInputStream object in my own
  defined AudioStream object. But, the error continues
  to exist and expects AudioInputStream object also
  to be serialized.

  How can I overcome this ?

  I understand that this question is out of the scope.
  I would be glad if you friends can give me some
  pointers.
  I am sure to close this question as soon as my
  this comment is addressed. Any helpful URLs
  are also welcome.

  Thanks for the support.

regards,
Raghu
0
 
LVL 1

Author Comment

by:raghurani
ID: 2578970
Thanks for the excellent work, ravindra76.
Congrats and sorry for the delay.
0
 
LVL 7

Expert Comment

by:Ravindra76
ID: 2582858
No Problem

:) :) :)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
stackato and cloud 4 87
session migration servlets 2 39
null output 3 25
pagenation logic how it is working in my code 1 32
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This video teaches viewers about errors in exception handling.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question