[Asterisk-Users] Speex codec for 8Kbps setting ?

Steve Kann stevek at stevek.com
Mon Jan 3 09:31:57 MST 2005


Waldek wrote:

> Hi,
> I am looking how to setup speex codec in codecs.conf for 8 Kbps and 6 
> Kbps.
> In config file are many parameters for setting.
> I don't know what is need to change for narrowbad like 8 Kbps and 6 kbps.
> Any suggestion?
>
> [speex]
> ;0-10
> quality => 4
> ;0-10
> complexity => 4
> ; true / false
> enhancement => true
> ; true / false
> vad => false
> ; true / false
> vbr => false
> ; 0 = off, otherwise, target bitrate in bps
> abr => 0
> ;0-10
> vbr_quality => 5
> ; true / false
> dtx => false
>

For CBR, there is a 1:1 correlation between "quality" and bitrate. The 
speex documentation has a table which describes this:
here:
http://speex.org/manual2/node9.html

*Table 4:* Quality versus bit-rate
Mode 	Bit-rate (bps) 	mflops 	Quality/description
0 	250 	N/A 	No transmission (DTX)
1 	2,150 	6 	Vocoder (mostly for comfort noise)
2 	5,950 	9 	Very noticeable artifacts/noise, good intelligibility
3 	8,000 	10 	Artifacts/noise sometimes noticeable
4 	11,000 	14 	Artifacts usually noticeable only with headphones
5 	15,000 	11 	Need good headphones to tell the difference
6 	18,200 	17.5 	Hard to tell the difference even with good headphones
7 	24,600 	14.5 	Completely transparent for voice, good quality music
8 	3,950 	10.5 	Very noticeable artifacts/noise, good intelligibility


Of course, this table isn't helpful unless you also know this:mapping 
between "quality" setting, and modes:
modes_noglobals.c:  int quality_map[11] = {1, 8, 2, 3, 3, 4, 4, 5, 5, 6, 7};

so:
quality 0 = mode 1 = 2,150kbps.
quality 1 = mode 8 = 3.950kbps
quality 2 = mode 2 = 5.950kbps
quality 3 = mode 3 = 8.000kbps
quality 4 = mode 3 = 8.000kbps
quality 5 = mode 4 = 11.000kbps
quality 6 = mode 4 = 11.000kbps
quality 7 = mode 5 = 15.000kbps
quality 8 = mode 5 = 15.000kbps
quality 9 = mode 6 = 18.200kbps
quality 10 = mode 7 = 24.600kbps

Maybe that should go into the docs somewhere.  (it might have been 
easier if the "bitrate" parameter was specified, so you could just 
choose a bitrate, but that's not the way it was done.

I just contributed the fix to CVS for ABR mode, however.  ABR mode will 
use a variable bitrate in order to meet an "average" bitrate target.  
It's easy to specify, and works really well.

To use this, just choose set the bitrate, in bps, you want in the abr => 
parameter.  For example, use abr => 8000.  This will in general, sound 
significantly better than the CBR mode at the same bitrate, since it 
will use more bits for more complex parts of speech, and less bitrates 
for less complex parts.  It does use more CPU, of course, in this 
mode..  Which brings me to the next point:

The "complexity" parameter basically tells the codec how much CPU to 
use.  If it's using too much CPU, set the complexity down a bit.  2 or 3 
are usually good choices, although 1 works fine if you're short of CPU.  
This only affects encoding, and doesn't affect the bitrate, but 
basically tells the codec how hard to search for the "best" bits to 
represent the speech.

To directly answer your question, I'd suggest these settings for you:

[speex]
;0-10
quality => 4
;0-10
complexity => 4
; true / false
enhancement => true
; true / false
vad => false
; true / false
vbr => false
; 0 = off, otherwise, target bitrate in bps
abr => 8000
;0-10
vbr_quality => 5
; true / false
dtx => false

And if you are CPU bound, lower the complexity..

-SteveK



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20050103/46a568ad/attachment.htm


More information about the asterisk-users mailing list