Web Home

SDK Home


Test PHP

Test ASP









Contact Us


JavaSonics ListenUp is no longer for sale.

Converting Speex to WAV Files on your Server

Speex is a handy format for uploading and storing voice data because it is so small. But not every program can read Speex files. If you want to send someone a message as an email attachment, or import the message into an audio editor, then you might need to convert the Speex file to a WAV file.

ListenUp has the ability to decode Speex data, and the ability to write WAV files. We have combined those abilities into a tool called SpeexToWAV. It is a Java application that must be run using a Java virtual machine. You can run this program on your server to convert Speex files to WAV files.


  1. Your server must have a version of the Java Virtual Machine installed. We recommend that you have Version 1.3 or later.
  2. Your server must have the ListenUp JAR files from the SDK. The SpeexToWAV program is in those JAR files along with the ListenUp Applets.

How To Convert

Assume you have a Speex file called msgxyz.spx and you want to create a WAV file called outmsg.wav.

The application class name is "com.softsynth.javasonics.recplay.SpeexToWAV". Your command line must include this name and a classpath that includes JavaSonicsListenUpUnsigned.jar file and OggXiphSpeexJSUnsigned.jar. The command line finishes with command arguments, as we show below.

Assuming that these two ListenUp JAR files are in a directory called "codebase", here is the command line that you would enter for this example:

java -cp codebase/JavaSonicsListenUpUnsigned.jar;codebase/OggXiphSpeexJSUnsigned.jar   com.softsynth.javasonics.recplay.SpeexToWAV   msgxyz.spx  outmsg.wav

That must all be on one line. Or you can use a "\" continuation character in Unix.

Output Compression

The output WAV file will be in signed 16 bit format, similar to a CD. You can reduce the size of the output file by a factor of almost 4 by using the IMA ADPCM compression option. Just add "-a" at the end of the command line. Almost every program that can read WAV files supports the IMA ADPCM format.

You can also use "-u" for uLaw compression for a factor of 2 size reduction. Some telephony devices require uLaw compression.

Restrictions on Command Arguments

  1. InFile must be before OutFile
  2. InFile name must end with ".spx"
  3. OutFile name must end with ".wav"

Calling from JSP

If you are running JSP on your server, then you can call the SpeexToWAV methods directly. The Java documentation on these methods follows. Note that your JSP should import the converter resource like so:

<%@ page import="com.softsynth.javasonics.recplay.SpeexToWAV" %>
<%@ page import="com.softsynth.javasonics.util.WAVWriter" %>

Note also that you will need to put JavaSonicsListenUpUnsigned.jar file and the OggXiphSpeexJSUnsigned.jar file in YourWebApp/WEB-INF/lib

package com.softsynth.javasonics.recplay;

 * Read a Speex stream, decode it and write to a WAV file image stream.
 * @param inStream Speex input stream
 * @param outStream WAV output stream
 * @throws IOException
public void convertSpeexToWAV( InputStream inStream,
             OutputStream outStream, int format ) throws IOException

 * Convert a Speex file to a Wav file.
 * @param inFile Speex input file, must end with ".spx"
 * @param outFile WAV output file, must end with ".wav"
 * @throws IOException
 public void convertSpeexToWAV( File inFile, File outFile, int format ) throws IOException

[Top]  [Previous]  [Next]

© 2001-2006 Mobileer, Inc.   This page is from the ListenUp SDK. You can download the SDK from here.