Add voice command to virtual instrumentation

-May 30, 2002

Debates still persist in the engineering community about the relative merits of analog and digital controls of instrumentation. Meanwhile, a revolutionary new type of control—voice-command control—is gaining acceptance in many application areas (Reference 1). This Design Idea focuses on the practical implementation of the Voice Commander voice-command interface in a virtual-instrumentation project. The beauty of the method lies in the fact that a single Microsoft Excel file, vScope VC.xls, encapsulates the entire voice-command system. The Excel file comprises two worksheets, vScope and vScopeData; two standard code modules; and a small portion of code in the This Workbook code module. Click here to download the relevant software. Using the terminology and the concept of modern multitiered software architecture, the voice-command method embraces the user-interface and the business-logic layers.

The simulated-data layer is in the vScopeData worksheet. Column A contains the samples' ordinal numbers (i=1, 2, ...64), Column B contains simulated signal-amplitude samples (V=sin(6.28×2×i/64)+0.5cos(6.28×10×i/64)), and columns C and D contain calculated complex-FFT and signal-amplitude spectra, respectively. By adding the actual data source (signal samples captured by a data-acquisition board or database query for historical data analysis) and linking it to Column B, you can expand the technique to a "full-flavored" virtual instrument or analytical tool with voice-command interface.

The vScope worksheet contains the Chart Object (called "Chart1" in the downloadable macros), formatted to emulate the actual oscilloscope screen (Figure 1). A custom toolbar appears at the top of the display, which contains control buttons. The buttons are associated with macros that execute when you press the button or say the command, corresponding with button's caption. Note that the voice-command feature is available only in the latest Excel 2002 Office application. Table 1 shows the list of custom commands. The Chart Object dynamically links via macros to the simulated data in the vScopeData worksheet. The Business Logic portion of the routine is programmed in VBA (macros) and partially in Excel worksheet functions. It contains a 64-point FFT, based on the Excel add-in functions. To use this feature, install Analysis Tool-VBA from the Tools-Add-Ins menu item. You can expand the business-logic and user-interface layers by including different digital-filtering and windowing techniques and by adding multiple channels, for example.

Upon opening the Demo file, a temporary custom toolbar appears at the top of the display (Figure 1). In Excel 2002, activate the speech tools: Go to the Tools—Speech—Speech Recognition menu item and then choose the Voice Command mode. In this mode, you can enter the command either by saying it or by clicking the button on the toolbar. For example, by clicking on or saying "go scope," you can maximize the view by temporarily removing some standard screen components. You can restore the components by clicking or by saying, "reset Excel." The Split command allows you to open two pseudowindows with independent horizontal scrolling. This feature lets you see the rising and falling edges of the long, or horizontally "zoomed," signal at the same time. When you say, "spectra," the signal-amplitude spectra screen appears (Figure 2). You can use this technique with Excel 95, 97, and 2000, but you must use the custom toolbar instead of voice commands. Note that when you enable macros in Excel or other applications, some macros could perform potentially dangerous and harmful actions, and some may contain viruses. The code for this Design Idea is on an as-is basis without warranty of any kind. The vScope VC.xls file is for demo purpose only, and commercial use of this file is prohibited.

Is this the best Design Idea in this issue? Select at


  1. Bell, Alexander, "Add voice commands to your CAD system," EDN, May 2, 2002, pg 77.

Loading comments...

Write a Comment

To comment please Log In