Back to All
Project

Deploy Smart Speaker Simulink® Model with Speech Command Recognition AI to Qualcomm® Hexagon™ NPU

This example shows you how to deploy a Simulink® model designed as smart speaker system on Hexagon eNPU using Embedded Coder® Support Package for Hexagon Processors.

This Simulink model comprises two main parts:

  • An audio input path, representing microphone processing. This path has preprocessing followed by the speech command recognizer.
  • An audio output path, representing loudspeaker output processing. This path has preprocessing for audio playback stream and applies an action to the playback.

 

Objective

Through the MathWorks and Qualcomm Technologiescollaboration, we seek to lower the barrier of entry to Qualcomm® hardware with a hardware support package. This support package allows those with no prior knowledge of Qualcomm hardware to build optimized C code and deploy it to the Hexagon NPU from Simulink.

To demonstrate this increase ease of use we developed this example that helps customers install, set up, and deploy AI to the Hexagon NPU or simulator. With is example, we hope to help companies large and small accelerate their time to market and simplify deployment to Hexagon hardware.

 

Materials Required / Parts List / Tools

MATLAB R25a or newer

https://www.mathworks.com/company/aboutus/contact_us/req_quote.html?s_eid=QCprojectpage

Simulink

https://www.mathworks.com/company/aboutus/contact_us/req_quote.html?s_eid=QCprojectpage

Embedded Coder

https://www.mathworks.com/company/aboutus/contact_us/req_quote.html?s_eid=QCprojectpage

MATLAB Coder

https://www.mathworks.com/company/aboutus/contact_us/req_quote.html?s_eid=QCprojectpage

Embedded Coder Support Package for Hexagon NPU Download Link

https://www.mathworks.com/hardware-support/qualcomm-hexagon.html?s_eid=QCprojectpage

Audio Toolbox

https://www.mathworks.com/company/aboutus/contact_us/req_quote.html?s_eid=QCprojectpage

Hexagon NPU

Any Qualcomm board supplier

Qualcomm® SDK

Qualcomm Package Manager

LPAI Addon

Qualcomm Package Manager

 

Source Code / Source Examples / Application Executable

Deploy Smart Speaker Model on Hexagon NPU Example Page

https://www.mathworks.com/help/ecoder/qualcommhexagon/ug/deploy-smart-speaker-model-qualcomm-hexagon-dsp.html?s_eid=QCprojectpage

 

Additional Resources

Hexagon Support Package Installation and Setup Guide

https://www.mathworks.com/help/ecoder/qualcomm-setup-and-configuration.html?s_eid=QCprojectpage

Build / Assembly Instructions

Sample outline:

  1. Download Qualcomm® Package Manager
  2. Download supported Hexagon SDK
  3. Download supported LPAI SDK Addon
  4. Download Android Debug Bridge if using hardware
  5. Download the Embedded Coder® Support Package for Hexagon Processors

Project Walkthrough

Sample outline:

openExample('qualcommhexagon/DeploySmartSpeakerModelOnQualcommHexagonDSPExample')
1. Open Example with the following command in MATLAB R25a or newer
open_system('SmartSpeakerHexagon');
2.Open Simulink model with the following command.
Qualcomm-image
sim('SmartSpeakerHexagon',SimulationMode='normal');
3. Observe the Spectrum Analyzer and AI classifications. For execution in host simulation, click on Run in the Simulation tab. The default simulation time is set to 3 seconds. Alternatively, you can use the command:
Qualcomm-image

4.       Configure Model for Optimized Code Generation

You can configure the model using either the Interactive Approach (Configuration Parameters in Simulink) or the Programmatic Approach (MATLAB programming interface). We will describe the interactive approach here.

 

Interactive Approach

To set the HVX ISE, under Code Generation Interface Optimization, select HVX for Leverage target hardware instruction set extensions parameter. Also, select the parameters Optimize reductions and FMA (Fused Multiply Add) to include the specific SIMD instructions.

Qualcomm-image

5.       Generate Code

You can now use the model to run the Smart Speaker model on the target.
Press Ctrl+B or go to Embedded Coder App and click Build.

Qualcomm-image

6.       To perform numerical accuracy verification of the generated code against the simulation output, use the SIL/PIL Manager App.

Go to SIL/PIL Manager, Set Mode to Automated Verification, Set the SIL/PIL Mode to Processor-in-loop (PIL), Click Run Verification.

Qualcomm-image

Usage Instructions

Sample outline:

  1. Install and set up hardware support package
  2. Open pre-built Simulink model
  3. Configure Simulink model for hardware deployment or simulator deployment
  4. Generate C code
  5. Verify performance on target using Software-in-the-Loop or Processor-in-the-Loop Manager
  6. Compare software vs hardware deployment performance

 

Contributor(s) Info

Name

Title Company

Reed Axman

 

Senior Partner Business Manager
MathWorks

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries ("Qualcomm"). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.

Qualcomm relentlessly innovates to deliver intelligent computing everywhere, helping the world tackle some of its most important challenges. Our leading-edge AI, high performance, low-power computing, and unrivaled connectivity deliver proven solutions that transform major industries. At Qualcomm, we are engineering human progress.

Stay connected

Get the latest Qualcomm and industry information delivered to your inbox.

Subscribe
Manage your subscription

© Qualcomm Technologies, Inc. and/or its affiliated companies.

Snapdragon and Qualcomm branded products are products of Qualcomm Technologies, Inc. and/or its subsidiaries. Qualcomm patented technologies are licensed by Qualcomm Incorporated.

Note: Certain services and materials may require you to accept additional terms and conditions before accessing or using those items.

References to "Qualcomm" may mean Qualcomm Incorporated, or subsidiaries or business units within the Qualcomm corporate structure, as applicable.

Qualcomm Incorporated includes our licensing business, QTL, and the vast majority of our patent portfolio. Qualcomm Technologies, Inc., a subsidiary of Qualcomm Incorporated, operates, along with its subsidiaries, substantially all of our engineering, research and development functions, and substantially all of our products and services businesses, including our QCT semiconductor business.

Materials that are as of a specific date, including but not limited to press releases, presentations, blog posts and webcasts, may have been superseded by subsequent events or disclosures.

Nothing in these materials is an offer to sell or license any of the services or materials referenced herein.