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

Developers looking to integrate wake word detection into an enterprise .NET C# application can do so using the Porcupine Wake Word engine. Whether the goal is to enable voice activation with phrases like "Hey Jarvis," "Computer," or a custom branded wake word, Porcupine Wake Word provides a lightweight, on-device solution that delivers the same experience as Alexa, Siri, or Google Assistant—without relying on cloud services.

In this tutorial, you'll learn how to add Porcupine Wake Word into a .NET project, including package installation, custom keyword training, and implementation in code.

The term Wake Word Detection is also commonly referred to as Keyword Spotting, Hotword Detection, and Voice Activation.

How to Add Wake Word Detection to a .NET App

Ensure your system meets the required .NET version:

  • 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 free Picovoice Console account and obtain your AccessKey. It is required only for authentication and authorization.

2. Train Custom Wake Word Models

While Porcupine Wake Word comes with several built-in keywords, you can also create and train custom wake word models for your application using the Picovoice Console. Before training, refer to our guide on choosing an effective wake word to ensure your custom keyword works optimally within your .NET application.

Check out our complete guide on creating custom wake words on Picovoice Console. If you'd like to see a video walkthrough, check out Picovoice Console Tutorial: Porcupine Wake Word on YouTube.

3. Install the NuGet Package

Install the Porcupine Wake Word NuGet package:

4. Initialize Porcupine Wake Word

If you are using built-in keywords, use FromBuiltInKeywords. For custom keywords, use FromKeywordPaths. If you are using a non-English keyword, download the corresponding language model.

Porcupine Wake Word can listen for multiple keywords simultaneously—simply initialize it with a list of the keywords you want it to detect.

Option 1: Built-in Keywords

Option 2: Custom Keywords

5. Start Listening For Keywords

Feed audio frames from your application to Porcupine to detect keywords:

If your application isn't set up to record audio, follow our guide Recording Audio in .NET Applications.

6. Clean Up Resources

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

Complete Demo: Wake Word Detection 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 Porcupine Wake Word .NET demo on GitHub.

This tutorial uses the following package:

Explore our documentation for more details:

Tips & Best Practices: Wake Word Detection

  • Audio format: Ensure your audio input is recorded in the format expected by the detection engine. Porcupine Wake Word requires mono, 16-bit PCM audio. The sample rate should match porcupine.SampleRate, and the frame length should be set to porcupine.FrameLength.
  • Keyword uniqueness: When selecting or creating wake words, choose keywords that are distinctive and unlikely to be confused with other common words. This improves detection accuracy. Refer to our detailed guide on choosing effective wake words.
  • Efficient threading: For optimal performance, capture and process audio in a separate thread or use a non-blocking loop to prevent UI or application logic from becoming unresponsive. This ensures a smooth user experience while continuously monitoring for wake words.

Next Steps

Once wake word detection is set up, you can expand your application with additional voice functionality, such as:

Start Free