[speex-dev] q about jspeex

Ulrich B. Staudinger us at die-horde.de
Fri Oct 31 05:10:27 PST 2003


Hi Marc,
thanks for the quick reply.

Marc Gimpel wrote:

>    It would appear the the 'pcm2speex.read(frame, 0, frame.length)' is 
> blocking which means that it is waiting for data from the underlying 
> inputstream (i.e.AudioInputStream(t.input)). If it could read 
> sufficient data it would transcode it. If it recieved an EOF, it 
> should do some zero padding and then transcode it. Are you sure that 
> you are receiving data from the underlying inputstream??? 

Yes, it can recieve data from the underlying input stream.
If i read directly from the audioinputstream with

auin=new AudioInputStream(t.input);
//int n=pcm2speex.read(frame, 0, frame.length);
int n=auin.read(frame, 0, frame.length);

i can read the specified frame length of bytes repetively. What else 
could be the cause for blocking? I am really glad about every hint!

>    One point to note though is that is you are receiving 44kHz audio, 
> it will try to encode this as UWB (i.e. pretending it's 32kHz sampling 
> rate), which means that to encode 1 speex packet you are going to need 
> 640 samples, or 1280 bytes (which should compress down to something 
> like 29 bytes because the quality setting should be 3 by default). 

what about piping the input streams? can't i manually read 640 samples 
from my AudioInputStream (which works) and hand them to a pipe 
(PipedInputStream connected with an PipedOutputStream) which ends in an 
InputStream in the Pcm2Speex constructor?

>    Having said this, jspeex does provide an SPI interface so you 
> should be able to ask JavaSound to give you directly a a Speex 
> AudioInputStream. It's coded although I admit that I never got round 
> to testing it so it might not work. It does work for the decoding, 
> that I'm sure of in any case.

that's interesting ... i have to look into this, but am not really that 
familiar with SPI ... more with Swing and user interfaces ;-)

I attached my TestClient.java, maybe it's of help ... Just press 'join' 
if you actually start it ...

best regards,
ulrich

-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestClient.java
Type: text/x-java
Size: 14776 bytes
Desc: TestClient.java
Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20031031/28efc5ae/TestClient.java


More information about the Speex-dev mailing list