|
|
|
Open Source Java Voice Command Sound recorder with file upload to a web server using Java Swing |
|
|
|
This program was conceived / coded / copyright by Bert Szoghy, email: webmaster@quadmore.com
Last code update: March 12 2005
Last page update: March 12 2005
Credits:
The SimpleAudioRecorder.java code is by Matthias Pfisterer of jsresources.org.
SYSTEM REQUIREMENTS
This demo has been tested to run properly on the following operating systems: Linux Redhat 9, Windows 2000 and Windows XP Pro. It should also run with no problem on all operating systems with a Java Runtime.
We used the j2sdk version 1.4.2_07 to compile. If you have the JDK 5, you will need to recompile (from what we can tell because of the new I/O functionality in that version).
What you are recording will depend on your system settings. On Windows, make sure your audio settings are working right for the recording method you want to use (line-in or microphone).
PURPOSE
This program is the second step in a robotics project using speech-based remote control. This program will create a uniquely-named sound file of a voice recording, then automatically upload it to a designated web server (you provide the bandwidth).
The next phase in the project will use server-side speech recognition on the uploaded file, the text ouput will be parsed and a robotics device will execute the deciphered voice command.
The WAV files are also saved client side in the application's directory (to test and resolve any microphone volume issues). Recording limit is 10 seconds. A checkbox option is provided to prevent uploads of recordings made only for "test test test one two one two" purposes.
The web server processing page in PHP is provided as well. On the web server a new directory is created based on the email address provided by Java and that's where the files are placed. If the email address is invalid, the file is not uploaded. The Java Swing client does not validate the email, doing so would bloat it with external libraries. If no email is entered, the default email used is "unknown@localhost.com". The PHP script also sends a confirmation email saying the file was received. Your Apache will need to be configured to allow this. Note: on Windows you might want to install an SMTP server, hmailserver worked for us well using the WAMP Apache/MySQL/PHP distribution.
BEFORE BEGINNING
On Windows, download and unzip SwingRec.zip preserving the directory structure (assuming to the C: drive).
Next, place the PHP file on an Apache web server and start it. If you are using Linux Redhat 9 like me, there is a silly block you need to add to your httpd.conf to be able to upload files bigger than 500K. The lines are:
<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 5000000
</Files>
(You might also want to search for the text "MAX" in the php.ini file and double a few values just to be on the safe side... and restart the web server).
RUNNING THE PROGRAM
If you unzip this directory to the C: drive on the Windows platform, and you have Java 1.4 installed, the two following commands in a DOS prompt will run the program:
cd C:\SwingRec
java SwingRec
This should bring up the Swing program:
The cd quality WAV files are saved in the same directory before being uploaded (PCM 44.1 kHz, 16 bit signed stereo).
Here's a screen capture of the running program on Linux.
FEEDBACK
You can email me here.
OUR OTHER SOFTWARE
BabyTalk: Open Source text-to-speech in Java
BabyTalk Web: Open Source text-to-speech in Java SWING, with JAXB and Java Web Services, along with the Simpletext SQL database
FreeTTS demo using MBROLA for Windows
Java Sound Recorder in Swing
Quadmore Java to Microsoft SAPI bridge for Windows: Sun Java to Microsoft Speech API 5.1
Johanne's Time Organizer: Open Source time tracking in Powerbuilder
|
|
|
|