[Speex-dev] JSpeex - Unsupported conversion

Keith Kyzivat kkyzivat at sipez.com
Tue Jan 8 10:39:35 PST 2008


This is best answered by the jspeex folks, as it is the interfacing
code that you are having problems with.

That being said, it looks like, just as it says, you have asked for a
conversion it cannot do -- you want it to convert PCM data to speex
data at 44.1kHz sample rate -- speex only supports 8kHz in standard
operation. It can also support 16kHz (wb) and 32kHz (uwb), but nothing
outside of those rates. Just tune the requested target rate to 8000 Hz
and you should get further.

On Jan 8, 2008, at 2:50, Rich Carlson <jrc at brainhotel.org> wrote:

> I'm having difficulty encoding audio using the JSpeex Speex
> Encoder.  My
> program throws an "Unsupported conversion" exception and I can't
> figure
> out why. I've read the related posts and I think I'm doing
> everything that
> was recommended.  I'm working on Linux, by the way.
>
> Any help would be greatly appreciated.
>
> Richard
>
>
> Here is my program output:
>
> $ java -classpath ".:jspeex/src/java" SpeexSave in.wav out.wav
> Exception in thread "main" java.lang.IllegalArgumentException:
> Unsupported
> conversion: SPEEX_quality_3, 44100.0 Hz, -1 bit, stereo, audio data
> from
> PCM_SIGNED, 44100.0 Hz, 16 bit, stereo, little-endian, audio data
>        at
> javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:
> 571)
>        at SpeexSave.main(SpeexSave.java:36)
>
>
> And here is my program:
>
> import java.io.*;
> import javax.sound.sampled.*;
>
> // Speex imports.
> import org.xiph.speex.*;
> import org.xiph.speex.spi.*;
>
> class SpeexSave {
>    public static void main(String args[]) {
>        if (args.length != 2) {
>            System.out.println("Arguments: IN_WAVE_FILE
> OUT_WAVE_FILE");
>            return;
>        }
>        File srcFile = new File(args[0]);
>        File outFile = new File(args[1]);
>
>        AudioInputStream audioInputStream = null;
>        try {
>            audioInputStream = AudioSystem.getAudioInputStream
> (srcFile);
>        }
>        catch (Exception e) {
>            System.out.println("Exception: " + e.getMessage());
>            e.printStackTrace ();
>            return;
>        }
>        AudioFormat srcFormat = audioInputStream.getFormat();
>
>        AudioFormat targetFormat =
>            new AudioFormat(SpeexEncoding.SPEEX_Q3 ,
>                            srcFormat.getSampleRate(),
>                            -1, // sample size in bits
>                            srcFormat.getChannels(),
>                            -1, // frame size
>                            -1, // frame rate
>                            srcFormat.isBigEndian());
>        AudioInputStream audioInputStream2 =
>            AudioSystem.getAudioInputStream(targetFormat,
> audioInputStream);
>    }
> }
>
> _______________________________________________
> Speex-dev mailing list
> Speex-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/speex-dev



-- 
Keith Kyzivat

SIPez LLC.
SIP VoIP, IM and Presence Consulting
http://www.SIPez.com
tel: +1 (617) 273-4000
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20080108/e3b600b7/attachment.html


More information about the Speex-dev mailing list