Take the 2-minute tour ×

I am building an online web application which offers clients to test their language skills.

The application consists of series of different test the clients can freely do. One of these tests is one where the client sees a sentence on the web-page and then is required to speak the sentence to a microphone. The idea would be to record the audio stream, send it to server and save it there to a file.

Is this possible using PHP, Java, or something similar to them?

Thank you for any help :)

share|improve this question
Flash is your best bet I think. it's not possible in php. php runs on the server, not on the client side. Java can do too, but I don't recommend. flash is much more wide-spread and you can easily learn and write your own code or use free code –  Dreaded semicolon Jul 10 '12 at 2:09
add comment

5 Answers

up vote 7 down vote accepted

The only realistic solutions for solving the problem are with flash, as suggested by another answer, or a java applet. In a year or two that will hopefully change and you'll be able to use javascript and HTML5, but this is now.

I would say this is a problem better and more easily solved with flash, but for java, You need to write a java applet to do the recording. Here are some hints to get you started:

http://docs.oracle.com/javase/tutorial/deployment/applet/ http://www.java2s.com/Tutorial/Java/0120__Development/CapturingAudiowithJavaSoundAPI.htm http://www.jsresources.org/

You do not need java speech API or JMF, just java sound. You might WANT JMF to compress the audio file to make uploading go faster, but you can get this working without. Note that you may need to "sign" your applet in order to record audio in a browser.

If you are averse to flash, you could also use haxe to write your flash code.

share|improve this answer
add comment

I know you asked for PHP, I'm guessing that's your language of choice, but have you considered using html5 to record your audio? Note: browser support is still lacking but it might be worth looking into depending on your requirements.

Check out this tutorial; it uses the GETUSERMEDIA API to access you camera and microphone hardware.

Update: Here is another good tutorial on the subject.

share|improve this answer
See this for the browser support: caniuse.com/#feat=stream –  Martin Konicek Jul 15 '12 at 15:04
add comment

Not 100% what you're looking for but I think it'll at least give you some ideas.

How to record streaming audio to the server

share|improve this answer
Thank you for your reply :) I saw this answer unfortunately already and were wondering if there's anything like that with PHP or Java... but thanks anyway! =) –  user1498926 Jul 3 '12 at 15:11
add comment

It is possible to solve this problem using Flash and Java both. You can use Flash component to record sound and send it in chunks to server side which can be implemented using java.

Pros to create sound recorder in Flash are many.

  • Flash is widely installed plugin in Browser
  • Java Applet gives warning before running it which many times turns off users.
  • Numerically checked, most media applications are created using Flash thereby providing you nice support.
  • Java Applets are used where thick client has to fit into browser and must also be secure. You will still find many real time treading applications are written in java applets.

Here are couple of tutorials to create Sound Recorder in Flash


Adobe record sound and save

This collected stream of sound can be stored in chunks on client side and can be synced with backend server(any server side language shall be fine.).

Implementing your server in Java has advantage. If tomorrow need arises, you can stream the same sound using Red5 server which is implemented in Java.

See more here: http://www.red5.org/

share|improve this answer
add comment

There is an audio recording SDK for this which is written in PHP, Flash and HTML5. http://recordmp3online.com

I am actually the author of that SDK (full disclosure)

share|improve this answer
add comment

Your Answer


