| DSP Blockset |
 |
Creating a Scalar Quantizer
In the previous topic, Analysis and Synthesis of Speech, you learned the theory behind the LPC Analysis and Synthesis of Speech (dsplpc) demo. In this topic, you create two scalar quantizers and add them to this demo model. One scalar quantizer is capable of quantizing the residual that is the output of the Time-Varying Analysis Filter block. The other scalar quantizer quantizes the reflection coefficients that are the output of the Levinson-Durbin block:
- Open the LPC Analysis and Synthesis of Speech demo by typing dsplpc at the MATLAB command line.
- Save
dsplpc the model file as scalar_quantizer_example.mdl in your working directory.
- From the DSP Sinks library, click-and-drag two Signal To Workspace blocks into your model.
- Connect the output of the Levinson-Durbin block to one of the Signal To Workspace blocks.
- Double-click this Signal To Workspace block. For the Variable name parameter, enter
K. Click OK.
- Connect the output of the Time-Varying Analysis Filter block to the other Signal To Workspace block.
- Double-click this Signal To Workspace block. For the Variable name parameter, enter
E. Click OK.
- Run the simulation. The variables K and E are now defined in the MATLAB workspace.
- From the Quantizers library, click-and-drag a Scalar Quantizer Design block into your model.
- Double-click this block.
- The SQ Design Tool GUI opens.
- For the Training Set parameter, enter
K. The variable K represents the reflection coefficients you want to quantize.
| Note
Theoretically, the signal that is used as the Training Set parameter should contain all the possible combinations of the parameter to be quantized. However, this example provides an approximation to a global training process.
|
- By definition, your reflection coefficients range from -1 to 1. Assume also that your cellular phone has 7 bits to represent each reflection coefficient. This means it is capable of representing
or 128 values.
- For the Number of levels parameter, enter
128. This number is equal to the total number of codebook values.
- For the Block name parameter, enter
Scalar Quantizer - Reflection Coefficients.
- Leave the rest of the parameters at their default values.
- Make sure that your desired destination model,
scalar_quantizer_example.mdl, is the current model. Type gcs in the MATLAB Command Window to display the name of your current model.
- In the SQ Design Tool GUI, click the Design and Plot button to apply the changes you made to the parameters.
- The SQ Design Tool GUI should look similar to the following figure.
- Click the Realize Block button.
- A new block called Scalar Quantizer - Reflection Coefficients appears in your model file.
- Click on the SQ Design Tool GUI and repeat steps 11-16 for the variable E that represents the residual signal you want to quantize.
- A new block called Scalar Quantizer - Residual appears in your model file.
- Close the SQ Design Tool GUI. You do not need to save the SQ Design Tool session.
You have now created two scalar quantizers and added them to your model. In the following topic, Quantizing an Input Signal, you learn how to use these scalar quantizers to quantize the residual, the output of the Time-Varying Analysis Filter, and the reflection coefficients, the output of the Levinson-Durbin block.
| Analysis and Synthesis of Speech | | Quantizing an Input Signal |  |
Learn more about the latest releases of MathWorks products:
|