Inherits from NSObject
Declared in BZMediaParams.h

Overview

This interface describes the audio codec used to process and play audio. Warning: Defining and using some specific codecs is not supported and is not guaranteed to worlk, resulting with unexpected effects on audio playpabk, recording, speech recognition, text to speech and realtime media event signalling. It is recommended to use “AF_PCM_16KHZ” BZAudioFormat for raw audio files, and the “AF_WAV” BZAudioFormat for wav header files with 16Khz PCM audio format.

A BZAudioCodec object can be created as follows:

BZAudioCodec* audioCodec = [[BZAudioCodec alloc] init];

Swift
let audioCodec = BZAudioCodec()


The *audioCodec payload created will be autamically initialized for “AF_PCM_16KHZ” BZAudioFormat:

  • m_pltype = 93
  • m_plName = L16
  • m_plFreq = 16000
  • m_PacSize = 160
  • m_Channels = 1
  • m_Rate = 256000


The *audioCodec payload created will be autamically initialized for “AF_PCM_16KHZ” BZAudioFormat:

  • m_pltype is the codec type. Look at samples below
  • m_plName is the name of the codec. Look at the samples below
  • m_plFreq is the sampling rate, Number of samples per second
  • m_PacSize is the size of the packet frame. Usually it is sampling rate divided by 100 for a 10ms frame and multiplied by number of bytes per sample. It can also be just sampling rate divided by 100 for a 10ms frame. Number of channels is int included this calculation.
  • m_Channels is the number of channels: 1 for mono, 2 for stereo
  • m_Rate is the bit rate per second, Usually equals to sampling rate multiplied by number of bytes per sample multiplied by number of bits per byte. Number of channels is int included this calculation.

To update the paramaters of the audio codec payload then simply assign the right values to the public audio codec parameters as in the following example:

BZAudioRecorder* audioCodec = [[BZAudioRecorder alloc] init];
audioCodec.m_pltype = 0;
audioCodec.m_plname = @"PCMU";
audioCodec.m_plfreq = 8000;
audioCodec.m_pacsize = 320;
audioCodec.m_channels = 1;
audioCodec..m_rate = 64000;


If an audio codec is not created then the default audio codec for “AF_PCM_16KHZ” BZAudioFormat is used for audio files without a wav header. If an audio file has a wav header, then BZMedia framework derives the audio codec from the information in the wav header.

The following default audio codecs will be used internally by BZMedia Framework for the following BZAudioFormats:
(Template: BZAudioFormat: Codec = {plType, plName, plFreq, PacSize, Channels, Rate})

  • - AF_PCM_8KHZ: Codec = {93, “L16”, 8000, 80, 1, 128000}
  • - AF_PCM_16KHZ: Codec = {93, “L16”, 16000, 160, 1, 256000} (default, recommnended)
  • - AF_PCM_32KHZ: Codec = {93, “L16”, 32000, 320, 1, 512000}
  • - AF_PCM_48KHZ: Codec = {93, “L16”, 48000, 480, 1, 768000}
  • - AF_WAV: Codec used is dependent on the BZAudioFormat specified in the Wav Header. Make sure that sample rate is 8,16 or 32 kHz. E.g. WAVE files may have other sampling rates. 16000 sample rate is used for 11000, 32000 for 22000, 32000 for 44100 and 32000 for 48000
  • - AF_COMPRESSED: Not used.
  • - AF_PREENCODED: A BZAudioCodec must be created - EXPERIMENTAL ONLY - NOT FULLY TESTED
  • - AF_MEDIA: Support of media files that contain audio streams e.g. mp3.
  • - AF_RAW_AUDIO: Support of raw audio data files. A BZAudioCodec must be valid. If BZAudioCodec is not created then AF_PCM_16KHZ is used as default - - EXPERIMENTAL ONLY - NOT FULLY TESTED

Available Custom Codecs - Not guaranteed to work and not supported

Template: {plType, plName, plFreq, PacSize, Channels, Rate}:

  • { 0, “PCMU”, 8000, 320, 1, 64000 }
  • { 110, “PCMU”, 8000, 320, 2, 64000 }
  • { 8, “PCMA”, 8000, 320, 1, 64000 }
  • { 118, “PCMA”, 8000, 320, 2, 64000 }
  • { 107, “L16”, 8000, 320, 1, 128000 }
  • { 108, “L16”, 16000, 320, 1, 256000 }
  • { 109, “L16”, 32000, 320, 1, 512000 }
  • { 111, “L16”, 8000, 320, 2, 128000 }
  • { 112, “L16”, 16000, 320, 2, 256000 }
  • { 113, “L16”, 32000, 320, 2, 512000 }
  • { 9, “G722”, 16000, 320, 1, 64000 }
  • { 119, “G722”, 16000, 320, 2, 64000 }
  • { 103, “ISAC”, 16000, 320, 1, 32000 }
  • { 104, “ISAC”, 32000, 320, 1, 56000 }
  • { 102, “ILBC”, 8000, 320, 1, 13300 }
  • { 13, “CN”, 8000, 320, 1, 0 }
  • { 98, “CN”, 16000, 320, 1, 0 }
  • { 99, “CN”, 32000, 320, 1, 0 }
  • { 127, “red”, 8000, 320, 1, 0 }
  • { 120, “opus”, 48000, 320, 2, 64000 }
  • { 106, “telephone-event”, 8000, 320, 1, 0 }

Warning: Defining and using some specific codecs is not supported and is not guaranteed to worlk, resulting with unexpected effects on audio playpabk, recording, speech recognition, text to speech and realtime media event signalling. It is recommended to use “AF_PCM_16KHZ” BZAudioFormat for raw audio files, and “AF_WAV” BZAudioFormat for wav header files with 16Khz PCM audio format.

Tasks

  •   m_plType

    The codec payload type. Default value: 93.

      property
  •   m_plName

    The codec payload name. Default value: L16.

      property
  •   m_plFreq

    The codec payload frequency. Default value: 16000.

      property
  •   m_PacSize

    The audio packet size in bytes. Default value: 320.

      property
  •   m_Channels

    The number of channels per audio sample. Default value: 1.

      property
  •   m_Rate

    The audio sample rate in bits per second. Default value: 320000.

      property

Properties

m_Channels

@property int m_Channels

Discussion

The number of channels per audio sample. Default value: 1.

Declared In

BZMediaParams.h

m_PacSize

@property int m_PacSize

Discussion

The audio packet size in bytes. Default value: 320.

Declared In

BZMediaParams.h

m_Rate

@property int m_Rate

Discussion

The audio sample rate in bits per second. Default value: 320000.

Declared In

BZMediaParams.h

m_plFreq

@property int m_plFreq

Discussion

The codec payload frequency. Default value: 16000.

Declared In

BZMediaParams.h

m_plName

@property NSString *m_plName

Discussion

The codec payload name. Default value: L16.

Declared In

BZMediaParams.h

m_plType

@property int m_plType

Discussion

The codec payload type. Default value: 93.

Declared In

BZMediaParams.h