Solved

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

Posted on 2000-02-19
7
336 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
Comment Utility
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
Comment Utility
"...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
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 8

Expert Comment

by:diakov
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks for the excellent work, ravindra76.
Congrats and sorry for the delay.
0
 
LVL 7

Expert Comment

by:Ravindra76
Comment Utility
No Problem

:) :) :)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

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…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This video teaches viewers about errors in exception handling.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now