To Enable codecs select the codecs in the "Use" column, the primary codec will be the selected codec in the "Primary" column.
To change the Speex settings uncheck the "Use Speex defaults" checkbox, the Speex Option dialog will be displayed, then apply the changes and press the Apply button.
Configuring speex bitrates
For CBR, there is a 1:1 correlation between "quality" and bitrate. The speex documentation has a table which describes this here .
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.
So, the settings I'd recommend for 8kbps speex would then be:
[speex]
;0-10
quality => 4
;0-10
complexity => 3
; 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..
Other notes
Enhancement is a perceptual enhancer for decoding. Other than this, all settings apply to the encoder only.
Question: But what will it negotiate to (with different speex settings on two Asterisk boxes)?"
- The speex settings are set on the encode side: speex decoders can decode any valid speex bit-stream: This is just like mp3 encoders: You can encode with whatever encoder and settings you want, and any decoder can decode them.
- These settings, in particular, will tell asterisk how to encode speex. So, if you set these settings on server (A), it will affect all outgoing speex streams. It will _not_ affect how other servers using speex send things to you. They'll use either the default settings, or whatever they're configured to send.