Voice Intents Overview
Magic Leap recommends using the Voice Intent Development Toolkit (VIDTK) to create and deploy custom voice commands. The toolkit provides validation and guidance within the toolkit UI that are not available in the Unity Editor. For more information, see Voice Commands.
Magic Leap 2 allows users to trigger events using custom verbal commands called Voice Intents. This section outlines how to set up Voice Intents in your project, example scripts, and an API overview.
Note that :
- Voice Intents can only be used by one app at a time.
- To avoid conflicts between system and app voice intents, the API automatically stops voice processing when the application is paused and resumes it when resuming the app.
Unlike system-wide voice commands that are initiated by saying "Hey Magic Leap", you do not need to say "Hey Magic Leap" for voice input to work in your Unity app.
- Within the System Settings, the Magic Leap Inputs Voice must be enabled for this API to work. The API could return unknown failures if it is not. To enable:
- Navigate to Settings > Magic Leap Inputs > Voice.
- Toggle Voice Commands on.
This feature requires the
VOICE_INPUT
permission to be requested at runtime and enabled in your project's Manifest Settings (Edit > Project Settings > Magic Leap > Manifest Settings).Magic Leap supports a maximum of 100 voice intents per configuration. If your configuration requires more than 100 voice intents, consider combining the values of related voice intents. For example, instead of using
Next Step
andContinue
as two different intents, combine them by setting the value of the intent toNext Step | Continue
.
📄️ API Overview
Namespace
📄️ Runtime Configuration
This section provides details on how developers can create and register voice commands dynamically at runtime. This feature can be helpful when loading content dynamically.
📄️ Runtime Voice Intents Example
This section provides details on how developers can create voice commands at runtime. This feature can be helpful when loading content dynamically.
📄️ Start/Stop Input
This section provides details on how developers can start and stop tracking voice intents inside their applications.
📄️ Voice Input System Settings
The Voice Intent API will only register voice commands if Voice Input is enabled inside the Magic Leap 2's System Settings (Settings > Magic Leap Inputs > Voice). This section demonstrates how to check if a user has enabled Voice Input.
📄️ Voice Slots
A Slot is a placeholder string for a set of potential values. The utterance will use one of the values and the developer can have different logic based on which value was spoken. To indicate use of a slot, put the slot name within { } for the command.
📄️ Simple Example
This section includes code examples for developers to reference when implementing voice input in their applications.