🎯 Voice AI Consulting
Get dedicated support and consultation to ensure your specific needs are met.
Consult an AI Expert

Looking to integrate custom voice commands into an enterprise .NET C# application? Imagine users interacting naturally with commands like "Make me a large espresso" or "Set the temperature to 72 degrees". Adding voice command functionality to your C# application is simpler than ever with Rhino Speech-to-Intent.

With Rhino Speech-to-Intent, developers can train AI models with custom voice commands, allowing your app to understand and act on spoken language. These commands run entirely on-device, eliminating cloud dependencies, latency issues, and privacy concerns—all while delivering exceptional accuracy.

In this tutorial, we'll walk you through the process of integrating voice command functionality into your .NET application using Rhino Speech-to-Intent. You'll learn everything from creating a custom context to implementing the code.

If you haven't already, you may want to add wake word detection to your .NET app first. With Porcupine Wake Word, your app can stay idle to conserve resources and only "wake up" when a user says a custom wake phrase.

Implement Voice Commands in a .NET App

Ensure your environment meets Rhino Speech-to-Intent's .NET requirements:

  • Windows (x86_64): .NET Framework 4.6.1+, .NET Standard 2.0+, or .NET Core 3.0+
  • macOS (x86_64): .NET Standard 2.0+ or .NET Core 3.0+
  • macOS (arm64), Windows (arm64), Linux (x86_64), Raspberry Pi (3, 4, 5): .NET 6.0+

1. Get Your AccessKey

Sign up for a Picovoice Console account for free and obtain your AccessKey.

2. Train Custom Voice Command Models

Rhino Speech-to-Intent uses a context file to define what voice commands your app should recognize. Here's how to create one:

  1. Go to the Rhino page on Picovoice Console.
  2. Create a context (e.g. SmartHomeCommands)
  3. Add intents (like TurnOnLight or SetThermostat)
  4. Define phrases for each intent (e.g. "Set the thermostat to 72 degrees")

Once complete, download the context model file (.rhn). If your context is in a non-English language, download the corresponding language model.

Check out our full guide on creating a custom Rhino context or watch the Picovoice Console Tutorial: Rhino Speech-to-Intent on YouTube.

3. Install the NuGet Package

Install the Rhino NuGet package:

4. Initialize Rhino Speech-to-Intent

Initialize Rhino with your Picovoice AccessKey, your context file, and model file (if your context file is not in English):

5. Start Listening For Voice Commands

Send audio frames to Rhino and handle the resulting inferences:

Whenever speech is detected, Rhino returns an Inference object containing the detected intent and slots values.

If your application isn't set up to capture audio, see our guide Recording Audio in .NET Applications to learn how to record audio for Rhino Speech-to-Intent.

6. Clean Up

Once you no longer need Rhino, call Dispose() to free acquired memory:

Complete Demo: Voice Commands in .NET

Putting it all together, here's a fully functional console demo in C#. PvRecorder is used for audio capture:

For a complete .NET application, see the Rhino .NET demo on GitHub.

This tutorial uses the following package:

Explore our documentation for more details:

Best Practices for Voice Command Systems

  • Audio format: Record audio in the format expected by your voice command engine. Rhino Speech-to-Intent requires mono, 16-bit PCM audio, with the sample rate set to rhino.SampleRate and frame length set to rhino.FrameLength.
  • Intent clarity: Ensure the phrases in your custom context closely match what users are likely to say, so voice commands are accurately understood.
  • Threading: Run audio capture and processing on a separate thread to keep your UI or main application logic responsive.

Next Steps

Enhance your voice-controlled app by combining Rhino Speech-to-Intent with:

Start Free