500 likes | 910 Views
“Speech Compression”. Texas Instruments University Programme Teaching Materials. Speech Compression. Introduction. Speech compression is widely used in digital communications: A-Law in Europe μ-Law in North America and Japan
E N D
“Speech Compression” Texas Instruments University Programme Teaching Materials
Introduction • Speech compression is widely used in digital communications: • A-Law in Europe • μ-Law in North America and Japan • Compression increases the coding efficiency by reducing the number of bits in the transmitted signal.
Objectives • To introduce A-Law and μ-Law audio compression. • To introduce companding. • To run the TMS320C5505 USB stick with and without audio compression.
Diagram of Audio Compression Input Audio Compression Algorithm Output
Uses of Compression • Compression can be used to: • Increase the amount of data that can be sent across a communication channel for a given bandwidth. • Increase the amount of data that can be stored on a device such as a CD ROM or in RAM.
Types of Compression • There are two types of compression widely used for speech transmission: • A-Law in Europe • μ-Law in North America and Japan • A-Law uses 13 bits • μ-Law uses 14 bits.
Equation for A-Law • The equation for A-Law compression is:
Graph of A-Law • 13-bit input on x axis. 8-bit output on y axis.
A-Law Table • A-Law can be implemented using a table:
A-Law Floating-point Format • The 13-bit linear input is converted into a 8-bit floating-point value:
Why Does Compression Work? • Human hearing is logarithmic. • Sound recorded at high levels does not require the same resolution as low-level sound.
A-Law Resolution • Resolution varies with input magnitude:
Diagram of Audio Expansion Input Audio Expansion Algorithm Output
A-Law Table Expansion Error • Because an 8-bit value is expanded to 16-bits, there is some loss of information. • This means that the expanded output may not be the same as the original input.
Equation for μ-Law Compression • The equation for μ-Law compression is:
Graph of μ-Law • 14-bit input on x axis. 8-bit output on y axis.
μ-Law Table • μ-Law can be implemented using a table:
Equation for μ-Law Expansion • The equation for μ-Law expansion is:
The Compander • Some Texas Instruments CODECs contain a compander • Compander = Compressor Expander • This allows the A-Law and μ-Law conversions to be performed in silicon using the McBSP interface • Note that the CODEC on the TMS320C5505 USB Stick does not contain a compander.
C Code Implementation of A-Law • Open source code is available from Sun Microsystems: • G711.c • G711.h • This has been used in this application.
Assembly Language Implementation • The TMS320C55xx instruction set has two instructions used for floating-point maths that can be used for A-Law and μ-Law operations: • exp • norm • The instruction exp is used to calculate the exponent • The instruction norm is used to format the mantissa.
Microphone Setup TMS320C5505 USB Stick USB to PC Microphone Headphones
Installing the Application • Copy the code provided in Application 13 Speech Compression to the workspace • Follow the steps previously given in Chapter 1 to set up the new project.
About the Program • Sampling rate 8000 Hz for microphone • Performs record and delayed playback • Longer delays possible with compression, but some loss of quality.
Remove Buffer Clear • Comment out the line buffer_clear() to no longer clear the buffer each time the LED flashes.
Output Filter • Add your own FIR output filter (as per Application 6) to reduce the noise caused by the output error • Use one of the filter design tools to produce a low pass 3400 Hz filter based on 8000 Hz sampling rate.
Questions • Why is audio compression used? • What are the differences between A-Law and μ-Law?
References • Digital Signal Processing, A Practical Approach by Emmanuel C. Ifeachor and Barrie W. Jervis. ISBN 0201-59619-9 • A-Law and mu-Law Companding Implementations using the TMS320C54x. SPRA163 • Wikipedia. A-Law and G.711 • www.hazelware.luggle.com/tutorials/mulawcompression.html