DSP Blockset Previous page   Next Page

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:

  1. Open the LPC Analysis and Synthesis of Speech demo by typing dsplpc at the MATLAB command line.
  2. Save dsplpc the model file as scalar_quantizer_example.mdl in your working directory.
  3. From the DSP Sinks library, click-and-drag two Signal To Workspace blocks into your model.
  4. Connect the output of the Levinson-Durbin block to one of the Signal To Workspace blocks.
  5. Double-click this Signal To Workspace block. For the Variable name parameter, enter K. Click OK.
  6. Connect the output of the Time-Varying Analysis Filter block to the other Signal To Workspace block.
  7. Double-click this Signal To Workspace block. For the Variable name parameter, enter E. Click OK.
  8. Run the simulation. The variables K and E are now defined in the MATLAB workspace.
  9. From the Quantizers library, click-and-drag a Scalar Quantizer Design block into your model.
  10. Double-click this block.

  1. The SQ Design Tool GUI opens.

  1. For the Training Set parameter, enter K. The variable K represents the reflection coefficients you want to quantize.

  1. 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.

  1. For the Number of levels parameter, enter 128. This number is equal to the total number of codebook values.
  2. For the Block name parameter, enter Scalar Quantizer - Reflection Coefficients.

  1. Leave the rest of the parameters at their default values.

  1. 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.
  2. In the SQ Design Tool GUI, click the Design and Plot button to apply the changes you made to the parameters.

  1. The SQ Design Tool GUI should look similar to the following figure.

  1. Click the Realize Block button.

  1. A new block called Scalar Quantizer - Reflection Coefficients appears in your model file.

  1. 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.

  1. A new block called Scalar Quantizer - Residual appears in your model file.

  1. 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.


Previous page  Analysis and Synthesis of Speech Quantizing an Input Signal Next page

Learn more about the latest releases of MathWorks products:

 © 1994-2009 The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS