This is best answered by the jspeex folks, as it is the interfacing<br><div class="gmail_quote">code that you are having problems with.<br><br>That being said, it looks like, just as it says, you have asked for a<br>conversion it cannot do -- you want it to convert PCM data to speex
<br>data at 44.1kHz sample rate -- speex only supports 8kHz in standard<br>operation. It can also support 16kHz (wb) and 32kHz (uwb), but nothing<br>outside of those rates. Just tune the requested target rate to 8000 Hz<br>
and you should get further.<br><div><div></div><div><br>On Jan 8, 2008, at 2:50, Rich Carlson <<a href="mailto:jrc@brainhotel.org" target="_blank">jrc@brainhotel.org</a>> wrote:<br><br>> I'm having difficulty encoding audio using the JSpeex Speex
<br>> Encoder. My<br>> program throws an "Unsupported conversion" exception and I can't<br>> figure<br>> out why. I've read the related posts and I think I'm doing<br>> everything that
<br>> was recommended. I'm working on Linux, by the way.<br>><br>> Any help would be greatly appreciated.<br>><br>> Richard<br>><br>><br>> Here is my program output:<br>><br>> $ java -classpath ".:jspeex/src/java" SpeexSave
in.wav out.wav<br>> Exception in thread "main" java.lang.IllegalArgumentException:<br>> Unsupported<br>> conversion: SPEEX_quality_3, 44100.0 Hz, -1 bit, stereo, audio data<br>> from<br>> PCM_SIGNED,
44100.0 Hz, 16 bit, stereo, little-endian, audio data<br>> at<br>> javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:<br>> 571)<br>> at SpeexSave.main(SpeexSave.java:36)<br>>
<br>><br>> And here is my program:<br>><br>> import java.io.*;<br>> import javax.sound.sampled.*;<br>><br>> // Speex imports.<br>> import org.xiph.speex.*;<br>> import org.xiph.speex.spi.*;<br>
>
<br>> class SpeexSave {<br>> public static void main(String args[]) {<br>> if (args.length != 2) {<br>> System.out.println("Arguments: IN_WAVE_FILE<br>> OUT_WAVE_FILE");<br>> return;
<br>> }<br>> File srcFile = new File(args[0]);<br>> File outFile = new File(args[1]);<br>><br>> AudioInputStream audioInputStream = null;<br>> try {<br>> audioInputStream =
AudioSystem.getAudioInputStream<br>> (srcFile);<br>> }<br>> catch (Exception e) {<br>> System.out.println("Exception: " + e.getMessage());<br>> e.printStackTrace
();<br>> return;<br>> }<br>> AudioFormat srcFormat = audioInputStream.getFormat();<br>><br>> AudioFormat targetFormat =<br>> new AudioFormat(SpeexEncoding.SPEEX_Q3
,<br>> srcFormat.getSampleRate(),<br>> -1, // sample size in bits<br>> srcFormat.getChannels(),<br>> -1, // frame size
<br>> -1, // frame rate<br>> srcFormat.isBigEndian());<br>> AudioInputStream audioInputStream2 =<br>> AudioSystem.getAudioInputStream(targetFormat,
<br>> audioInputStream);<br>> }<br>> }<br>><br>> _______________________________________________<br>> Speex-dev mailing list<br>> <a href="mailto:Speex-dev@xiph.org" target="_blank">Speex-dev@xiph.org
</a><br>>
<a href="http://lists.xiph.org/mailman/listinfo/speex-dev" target="_blank">http://lists.xiph.org/mailman/listinfo/speex-dev</a><br></div></div></div><br><br clear="all"><br>-- <br>Keith Kyzivat<br><br>SIPez LLC.<br>SIP VoIP, IM and Presence Consulting
<br><a href="http://www.SIPez.com" target="_blank">http://www.SIPez.com</a><br>tel: +1 (617) 273-4000