[speex-dev] Java bindings

Jean-Marc Valin jean-marc.valin at hermes.usherb.ca
Fri Dec 13 22:23:26 PST 2002

> I have writen a simple JNI wrapper for speex so i could use it from Java, so far i managed to record from a raw pcm file and from the javasound inputLine and to decode the output in narrowband CBR mode and play it back still using javasound.
> And it sounds quite good.
> I haven't tried anything else because my project has no use for wideband and ultra wideband.

Maybe you can put your work online so I can link to it from the Speex

> The native interface should compile on every plateform that has a jdk and libSpeex (or was it speexLib ?). I used the jdk1.4 and Windows but a friend of mine got it to work under FreeBSD and jdk1.3 without any modifications (That i'm aware of at least).

Actually, it's libspeex...

> 1/bytesex
> First It will probably have endianess problem, java is big endian by the spec,
> while the host machine i've considered is little endian (x86). So everything 
> that is received from java is converted to little endian. As far as i understand
> speex (not much) it expects to receive byte (floats?) in the host machine order so it will probably fails under a big endianned architecture like powerpc or sparc.

Speex expects to receive floats in the host endianness...

> On the same input (a file) while CBR is working just fine, VBR doesn't seem to work at all, the number of byte returned if not zero average 2 or 3 for an input of 256 (i think). And when decoded, well, it doesn't sounds like anything.

Have you made sure that the argument you give to SPEEX_SET_VBR_QUALITY
is a *float* (while SPEEX_QUALITY is int)

> Encoding N "frame" in a speexbits without reseting it (like it's done in speexenc) "accelerate" the sound N time when playing it back. Is that the normal behaviour?

you need to decode N time too?

> All this probably has to do with the fact i don't have any clue on how to use in-band signalling.
> Anyway, if someone is interested by this, send me a mail as i have no place to host it.

Send it to me so I can put it on the site...

> The only "Licensing term" i put over the code is that you must send back to me/the speex user community any enhancement and bug fix for the rest BSD license applies.

Well, what you're describing is in fact GPL :) (though I have nothing
against it).

> That's all.
> Thank you Jean Marc for this great audio codec.

You're welcome ;-)


Jean-Marc Valin, M.Sc.A.
LABORIUS (http://www.gel.usherb.ca/laborius)
Université de Sherbrooke, Québec, Canada

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 242 bytes
Desc: signature.asc
Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20021214/53f0cc4c/signature-0001.pgp

More information about the Speex-dev mailing list