X

API How-To

Web Dictation II

Introduction

This How-To provides a quick jump-start for embedding nVoq medical dictation in web applications. Sample TypeScript applications are provided that illustrate use of our WebSocket API as well as asynchronous client-side processing of audio and dictation results. Instructions for building with Node.js and editing with Visual Studio Code are also provided.

Before You Begin

API User Account

If your organization has not already been in contact with our Sales team, please complete this short form on the Developer Registration Page and we will reach out to you regarding a user account and development with our APIs.

Once you have an account, you must change your password before the account can be used for API calls.

Audio Format

The nVoq API supports ogg Vorbis, PCM, WebM Opus, and MPEG-4 encoded audio sampled at 16kHz.  For more information on Audio Formats, click here

Note: the best audio processing performance occurs when audio chunks are about 300ms long.

Let's Go!

Node.js

If not already installed, download and install Node.js.

Visual Studio Code (optional)

If you don't already have VS Code, another IDE, or a great editor like Emacs, download and install Visual Studio Code.

Download Sample App

Download the sample application and unzip it.

Build and Run Sample App

Edit web_dictation/example-ui/src/ts/config.ts to set your hostname, username, and password.

Open a command prompt (Windows) and cd to the web_dictation/nvoq-api-client directory and run:
    npm install
    npm run build
Now, cd to the web_dictation/example-ui directory and run:
    npm install
    npm run build
With the API client and example UI projects built, use the Node.js development server to serve up the example UI application. While still in the web_dictation/example-ui directory, run:
    npm run serve
When the server starts, it will output URLs from which the application can be loaded. Copy the loopback URL that contains localhost and paste it into your browser. It should look something like this: http://localhost:9000/.

Using the Sample App

Placing your cursor into a form field will start a dictation via the nVoq API, begin recording audio, stream the audio to the API, receive text streamed back via the API, and place the text in the form field. Clicking into, or tabbing to, another field will start a new dictation. The application will continue to place the results for the previous dictation in the previous field as it finishes, while placing the results for the new dictation in the new text field. To stop dictating, click on the page and remove focus from all text areas.

Open Samples in VS Code

If you use or installed VS Code, use it to look at the sample application code. To open the Example UI project, open a command prompt (Windows) and cd to the web_dictation directory and run:
    code example-ui
To open the nVoq API Client project, open a command prompt (Windows) and cd to the web_dictation directory and run:
    code nvoq-api-client
Congratulations. You now have a running web application with real-time dictation using the nVoq API.

If you have any questions, please reach out to support@nvoq.com.

© 2024 nVoq Inc. | Privacy Policy