The usual answer to your question is "Read the manual", but you are
obviously trying.
Speex encodes 20 ms frames of audio. This translates into 160 for Speex
narrowband mode (8kHz speech samples), 320 for wideband mode (16kHz speech
samples), and 640 for ultra-wideband mode (32kHz speech samples). You must
use the proper value for your mode, or you will get garbled speech. The
encoded data rate is set with the Quality parameter, and that is probably
what you want to be experimenting with. The comment in sampleenc.c:
/*The frame size in hardcoded for this sample code but it doesn't have to
be*/
is a little misleading. What it really means is that your code can make the
mode selectable between NB, WB, and UWB, as it is in speexenc.c. You might
want to look at testenc.c and testenc_wb.c in the libspeex directory. These
files just loop the encoder to the decoder, but they still produce the
encoded file.
Of course, if you are sending Speex over a network, you are free to put
multiple Speex frames into a packet, but this is done outside of the codec.
The IP/UDP/RTP overhead of 40 bytes per packet yields a depressing 16kbps at
50 packets/second.
- Jim
----- Original Message -----
From: "Jean-Marc Valin" <jean-marc.valin@usherbrooke.ca>
To: "Nichole Arel" <nichole.arel@gmail.com>
Cc: <speex-dev@xiph.org>
Sent: Wednesday, May 02, 2007 8:57 PM
Subject: Re: [Speex-dev] Re: Sending speex over a network
>> In sampleenc.c and sampledec.c, if I change the FRAME_SIZE to any other
>> value, I get very garbled speech. Can anyone tell me if I need to set
>> something else if I would like to change the frame size ?
>
> No, you need to write another codec :-)
>
> Jean-Marc
>
> _______________________________________________
> Speex-dev mailing list
> Speex-dev@xiph.org
> http://lists.xiph.org/mailman/listinfo/speex-dev