File Exchange

image thumbnail

G.723.1 Speech Coder and Decoder

version 3.0.0 (1.94 MB) by Peter Kabal
Matlab implementation of ITU-T G.723.1 speech coder and decoder


Updated 08 Dec 2020

View Version History

View License

This package implements the ITU-T G.723.1 speech coder and decoder in Matlab. The goal of the package is to provide a well-documented and modular program that was designed to facilitate experimentation and research using a practical coder as a base.

The coder implements the multipulse mode of G.723.1 (running at 6.3 kb/s). The decoder can decode all modes of the coder (ACELP at 5.3 kb/s, multipulse at 6.3 kb/s, discontinuous-transmission, packet loss concealment).

The standard interface between the coder and decoder is a bit file (compatible with the bit files generated by the ITU-T reference code). A second option passes information between the coder and decoder using a Matlab data file. This option allows for testing by passing quantized or unquantized information between the coder and the decoder.

A report [1] describing the G.723.1 and the Matlab implementation is included with the distribution. ITU-T Recommendation G.723.1 [2] is available on-line. The recommendation includes reference code (in C) and test files.

Version 3 of the package (Dec. 2020) updates the audio file reading routines to use newer Matlab functions. This package has been tested on Matlab 2015b and later versions.

1. P. Kabal, ITU-T G.723.1 Speech Coder: A Matlab Implementation, MMSP Lab Technical Report, Dept. Electrical & Computer Engineering, McGill University, updated December 2017 (available on-line at

2. ITU-T Recommendation G.723.1, Dual Rate Speech Coder for Multimedia Communications Transmitting at 5.3 and 6.3 kbit/s, March 1996.

Cite As

Peter Kabal (2021). G.723.1 Speech Coder and Decoder (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (23)

Milka Elias

What are the parameters that you can change/control from the "LPanal" and "LPanalFrame" functions? Can the number of samples "p" be changed? If yes, what is its impact on LP coefficients (and hence on prediction error)? On the decoding side, what is the impact of varying "n", which is the number previous samples?

hamza kheddar

zahra esmaeilbayg : please remove this variable " versn" in
[dirn name ext versn] = fileparts (File);
and remove it from the ligne after.

zahra esmaeilbayg

this how I'm using this encoder:


but i get this error
Error using fileparts
Too many output arguments.

Error in FullName>ls_File (line 69)
[dirn name ext versn] = fileparts (File);

Error in FullName (line 46)

can you please tell me what is wrong?

Juan Baldan

there is any way to implement this in Simulink model?


Small error
line 23 in LPanal.m file should be swapped to
ap = zeros(Np+1,1);



Thank you man. this is great

Bharath Seelam

Thank you for the code.Can you please tell me the steps for the execution.I have problem with execution.

unnati shah

hello sir , i want to find section wise output,so suggest me , how its possible and i got error in tG7231CODER coderfile and

unnati shah

hello sir , i want to find section wise output,so suggest me , how its possible and i got error in coderfile

satish chandra


thank you, it helps me a lot in my master degree studies.



I processed a WAV file with 128.044 bytes (sampling frequency 8000Hz, 16 bits/sample, 64000 samples (8s)).
The compressed file has a size of 154.497 bytes, but it should have not more than 6.3kbits/s * 8 s / 8 bits/bytes = 6300 bytes, should it?
What went wrong?


thanks a lot

gomal university

thank u for providing the code but when i run, it doesn't work.
i am using Matlab 7 R14
can u please tell me the version u have used???
thank u

MP Sivakumar

hi kabal,

thank you for the code. well i have one question. after implimentation of the coder the data is written to a structure. i want the data to be written to a row matrix, thereafter i will be implementing QPSK modulation to this data..can u help me out


g raja

Hi Kabal,

In post filter folder, you have an option like SetPFpar to setting up the parameter values for PFpar. Similarly, How to setting up the FPmem vaules? Is there any provision for it?



Peter Kabal

Hi Ibraheem,
G.723.1 only accepts 8 kHz sampling rate (the link in your message is to 16 kHz files). I will put an explicit check on the sampling rate if and when I update the code. I need to see an explicit case of a file that exhibits a problem with poly2lsf (Matlab build-in routine) to be able to diagnose the problem. I have not seen any problems with normal speech files (all files in the official G.723.1 test suite work).

Ibraheem Al-Dhamari

hi again,
after fight with the wav files i found that after i deleted the first half second the problem is solved. looks like it happens when we have no sound at the beginning of the file.
hope you can solve it with the next edition of your package.
you may try these data sets :


Ibraheem Al-Dhamari

I get this error when I have tried to code a file.
??? Error using ==> roots at 30
Input to ROOTS must not contain NaN or Inf.

Error in ==> poly2lsf at 33
if (max(abs(roots(a))) >= 1.0),

Error in ==> LPxLSFQ at 8
lsf = poly2lsf (ap); % lsf's are in radians

Error in ==> G7231Coder at 98
LSFC = LPxLSFQ (a(:,LPpar.SFRef), CoderMem.lsfQ, LSFpar);
the file is the same as the file in the TestFiles directory with these proprieties:
Bitrate=128 kbps
Audio Sample Size= 16 bit
Channels =1 (mono)
Audio Sample rate =8 KHz
Audio format = PCM

I wonder whats is the cause of the error ???



Nice job!

MATLAB Release Compatibility
Created with R2020a
Compatible with R2015b and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!