Selecting a Sample Rate

The audio sample rate is quite possibly the single most important factor in determining audio quality. The higher the sampling rate, the better the audio quality. Of course, the bandwidth requirements are increased as well. Technically, Intercom can support any sample rate your hardware can, however, as the remote caller must also support the sample rate, it is recommended that you stick to the standard rates. These are 8000 (8k), 11025 (11k), 16000 (16k), 22050 (22k) and 32000 (32k).

Note

Some sound cards do not support the 16k sample rate. However, some do and it is often a good one to use if you know that both parties support it.

The sampling rate is controled in one of two ways. You can either set the snd_rate variable to your desired sample rate or specify a one-time sample rate when placing a call. To set the variable, use a command like set snd_rate 11025 to set the sample rate to 11k. In order to place a call with a sample rate other than that in the snd_rate variable, specify the -r option such as call -r 22050 192.168.1.2 which will set the rate to 22k for the duration of the call.

Compression Settings

Another setting which plays a large part in audio quality and an even larger part in bandwidth usage is the compression format (CODEC) selected. Certain CODECs give better compression at the expense of audio quality or CPU utilization. Alternatively, you can disable compression altogether if your connection can handle the increased data throughput.

The following table lists the currently supported codecs as well as the bandwidth they use at several sample rates. The bandwidth usage is displayed in killobits per second. 1 killobit equals 1000 bits which is 125 bytes. Also note that this does not account for Intercom's protocol overhead which varies depending on other factors.

Table 4-1. Audio CODEC Bandwidth Usage

Sample rate8 K11 K16 K22 K32 K
CODECKbit/secKbit/secKbit/secKbit/secKbit/sec
none128.00176.40256.00352.80512.00
G.71164.0088.20128.00176.40256.00
G.72132.0044.1064.0088.20128.00
G.723-4040.0055.1280.00110.25160.00
G.723-2424.0033.0848.0066.1596.00
GSM13.2018.1926.4036.3852.80

Software Gain Control

If you or your remote party is sounding too quiet, the first thing which should be attempted is to adjust the sound mixer for the capture source. Bringing up the input gain can usually help. Also, some audio hardware has an analogue mic boost option which you might try enabling. However, if all else fails, Intercom does have the ability to amplify or de-amplify the audio signal (either incoming or outgoing). The reason you should use the mixer before trying this is when you amplify a signal, you also amplify the hiss along with it whereas a hardware gain usually is better at keeping things clean.

The variables controling gain are input_gain and output_gain respectively. The input_gain variable with amplify the signal coming from your mic before it goes out over the wire. The output_gain variable amplifies the incoming signal. These variables are decimal numbers which express the gain in decibels. A value of 0 turns off gain control, a positive value amplifies the signal by that many decibels and a negative value will de-amplify the signal.

Audio Devices

If you have more than one sound card, you may wish to specify the audio device Intercom uses. There are two variables which control this, snd_capture_device and snd_play_device. By default, they are both set to /dev/dsp but can be modified by the user. The changes will not take affect immediately if a call is in progress.

You are free to set snd_capture_device and snd_play_device to different physical devices. This might be useful if your Mic and speakers happen to be on different cards>

Handling Silence

Another set of options which you will probably want to configure is how Intercom handles audio silence. That is, when you are not speaking, there is really no reason audio data needs to be sent to your remote party. Configuring silence squelching is a bit technical but shouldn't be too hard. The option you want to adjust is the silence_thresh variable. This is an integer between 0 and 32767 which denotes the minimum sample value below which is considered silence. When set to 0, there will be no silence suppression and all audio data is sent as-is. Likewise, when set to 32767, all audio data is squelched and you are essentially muted. You want to set this option to a value depending on your mic and surroundings. Common values are between 1000 and 7000 but your mileage may vary. Play with it until you find the correct value for your setup

The other variable related to silence squelching is silence_time. This is a decimal variable which controls how many seconds of silence to allow before squelching. By default, this is set to 1.0 (1 second) but some people like to adjust it. For example, if you wanted to squelch only if there is an extended period of silence, you could set it to 30 or so.