How to manage different audio codec types?
This article is a brief introduction about the differences between 8 bit and 16 bit audio codecs in relation with Ozeki VoIP SIP SDK. After reading through this page you will be fully familiar with all the essential terms concerning audio codec types and what you will need for creating your own solution using Ozeki VoIP SIP SDK.
What are audio codecs? How do they work?
An "audio codec" is a computer program implementing an algorithm that compresses and decompresses digital audio data according to a given audio file format or streaming media audio format. The object of the algorithm is to represent the high-fidelity audio signal with minimum number of bits while retaining the quality. This can effectively reduce the storage space and the bandwidth required for transmission of the stored audio file. Most codecs are implemented as libraries which interface to one or more multimedia players.
The audio codecs can be classified into two main groups. There are compression and non-compression codecs. The compression codecs can be lossless or lossy compression codecs.
Sample rate is the number of samples of a sound that are taken per second to represent the event digitally. The more samples taken per second, the more accurate the digital representation of the sound can be.
Bit depth defines how many bits are used to describe each of the samples taken from the sample rate. It describes the potential accuracy of a digital audio file. Higher bit depth audio will sound better than smaller bit-depth audio. 8 and 16-bit audio are currently the most common sample sizes. 8-bit audio takes up less hard drive space but is inherently noisier than 16 or 24 bit-depth audio. CD quality is 16-bit.
How to manage audio codecs using C#?
Ozeki VoIP SIP SDK has the support for some codecs from every type, you can decide on using these when implementing your own VoIP solution.
The following table contains the audio codecs supported by Ozeki VoIP SIP SDK:
Codec format | Sample rate | Bit rate | Bits per sample |
---|---|---|---|
G.711 | 8 KHz | 64 kbit/sec | 8 bit |
PCMA | 8 bit | ||
PCMU | 8 bit | ||
iLBC | 8 KHz | 13.33, 15.2 kbit/sec | 8 bit |
G.722 | 16 kHz | 64 kbit/sec | 8 bit |
GSM | 8 KHz | 5-12 kbit/sec | 8 bit |
Speex | 8, 16, 32 KHz | 2.15-24 kbit/sec | 8 bit |
L16 | 8 bit | ||
Speex | 8, 16, 32 KHz | 2.15-24 kbit/sec | 16 bit |
G.729 | 8 KHz | 8 kbit/sec | 13 bit |
G.723 | 8 KHz | 24 or 40 kbit/sec | 13 bit |
G.726 | 8 KHz | 16, 24, 32 or 40 kbit/sec | 13 bit |
G.728 | 8 KHz | 16 kbit/sec | 13 bit |
A codec can be disabled the same way as it is enabled, just in that case, you need to call the DisableCodec method with the payload parameter.
Setting the proper codec is very important as the SIP communication can only be done if both communicating parties use the same transmission codec. If you do not set the codec manually, the Ozeki SDK sets the right codec for the communication instead of you.
Audio codec management example in C#
You can find a well-detailed step-by-step guide with a simple example application about codec management at the Training chapter's How to enable and disable different codecs article.
Related Pages
More information
- How to manage different audio codec types in charp using Ozeki voip sip sdk
- How to use the jitter buffer and how to handle latency
- How to implement voip acoustic echo cancellation
- How to implement voip noise reduction
- How to implement voip automatic gain control