<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kyle Craig on Medium]]></title>
        <description><![CDATA[Stories by Kyle Craig on Medium]]></description>
        <link>https://medium.com/@craigjk?source=rss-10f5b7c16def------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ATcmR4Sy-O8_pBBC02uhwg.jpeg</url>
            <title>Stories by Kyle Craig on Medium</title>
            <link>https://medium.com/@craigjk?source=rss-10f5b7c16def------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 23:30:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@craigjk/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Implement Speech Interactions in Virtual Reality]]></title>
            <link>https://medium.com/@craigjk/how-to-implement-speech-interactions-in-virtual-reality-1556d776ac8?source=rss-10f5b7c16def------2</link>
            <guid isPermaLink="false">https://medium.com/p/1556d776ac8</guid>
            <category><![CDATA[htc-vive]]></category>
            <category><![CDATA[speech-recognition]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[virtual-reality]]></category>
            <category><![CDATA[ibm]]></category>
            <dc:creator><![CDATA[Kyle Craig]]></dc:creator>
            <pubDate>Mon, 24 Oct 2016 15:45:29 GMT</pubDate>
            <atom:updated>2016-12-21T17:18:36.500Z</atom:updated>
            <content:encoded><![CDATA[<p>As Virtual Reality evolves, so do the various ways of interacting within the experience. Most current control schemes use game pads or game pad-like controllers. If you dig a bit deeper, you’ll find solutions that use Leap Motion or some other form of fine-grained hand tracking or body tracking. At IBM, we’re experimenting with augmenting these traditional control schemes with voice because we discovered that in Virtual Reality, where you truly “inhabit” the space, speech sometimes feels like a more natural interface than other methods. In this post, I’ll walk you through how we developed a game to incorporate speech interactions. I will share overview information about the Watson Services we used (Speech to Text and Conversation), how to recreate our project and implement the services using Unity, and a couple user experience best practices when designing a speech interface.</p><p>For this project, our team chose to develop on the HTC Vive because it offers:</p><ol><li>Room-Scale VR, which opens up possibilities well beyond a seated experience.</li><li>Built-in camera for flexibility to incorporate Watson visual services in the future.</li><li>Simplified SteamVR-Unity integration.</li></ol><h3>The Project</h3><p>After a month or so of getting used to developing for the Vive and experimenting with different ideas and Watson services to use, we finally arrived on what we felt was a simple, yet fun, use of Watson services in VR: A Physics Sandbox.</p><p>Our sandbox acts as a weird combination between <a href="http://www.garrysmod.com/">Garry’s Mod</a> and <a href="https://www.scribblenauts.com/">Scribblenauts</a>. After a short tutorial that teaches you the basics of how to use your voice to control the world, we drop you into a scene populated with all sorts of different objects and let you see how they interact with each other. We have a relatively large selection of objects you can create using simple voice commands. Once you’ve created your objects, you can toss them around, blow them up, and in some cases “eat” them. It creates a very loose scenario completely driven by the player, all using Watson’s speech services at the core.</p><h3>Why Unity?</h3><p>Aside from it being the platform I’m most familiar with, Unity enables unique capabilities that make it super easy to add voice control. Namely, the <a href="https://www.ibm.com/watson/developercloud/">IBM Watson Developer Cloud</a> has an amazing <a href="https://github.com/watson-developer-cloud/unity-sdk">Unity SDK</a> that gives access to almost all of the Watson services. A lot of the services even come in the form of prefab objects that you can drag into your scenes to get them up and running quickly without writing code. Using different environments would require us to write out all of the REST requests ourselves (which you can do, UE4 developers).</p><h3>The Implementation</h3><p>Our voice control implementation is very simple and only relies on two Watson services, <a href="http://www.ibm.com/watson/developercloud/speech-to-text.html">Speech To Text</a> and the new <a href="http://www.ibm.com/watson/developercloud/conversation.html">Conversation</a> service. It only requires about 60 lines of code (all shown in this post) to get running, so it’s easy to implement.</p><p>The Conversation service is the backbone of this entire system, so before diving into our Unity project or code, it would be best to explain a bit about how it works. There are three core components to the Conversation service: Intents, Entities, and Dialog. Since we don’t have the player carry on an actual conversation with “Watson”, we only use the Natural Language Processing components (Intents and Entities) of the service.</p><p>Our game uses four intents: Create, Destroy, Help, and Null. The Conversation service assigns one of these four intents (as well as a confidence level) to every string of text we give it. It determines what the intent is based on a number of example text entries you feed to it. In addition to determining the intent of a statement, Conversation can also be asked to listen to specific entities (keywords). We currently use three entity classes: Object, Material, and Scale. Each entity class has a set of values it looks for, and each value has a set of synonyms. These synonyms are very important for a game like ours because it allows us to assign multiple words or phrases to a single value. For example: One of our object entities is “ball” and “sphere” is a synonym to “ball”. So when a statement such as “Create a green sphere.” is given to conversation it tells us a few things:</p><ol><li>The intent is Create.</li><li>There is a Material entity with a value of “green”.</li><li>There is an Object entity with a value of “ball”.</li></ol><p>Notice that even though I said “sphere”, it still returned the value as “ball”. Later on down the line, this makes grabbing objects out of our dictionary much simpler.</p><p>Now that you have a basic understanding of how we’re using the Conversation service, let’s see how we tie all of that together in our game. I’m not going to go into detail on how to import and configure the Watson Unity SDK, but you’ll find a very detailed description on how to do that in the README on the GitHub repository <a href="https://github.com/watson-developer-cloud/unity-sdk">here</a>. What I am going to discuss is how we use the tools in the SDK to create our voice spawning system.</p><p>Upon opening the SDK, you’ll notice that it has quite a few prefabs (mostly called widgets) that correspond to various Watson services. The ones we’re going to use are the MicWidget, the SpeechToTextWidget, and the SpeechDisplayWidget. The MicWidget listens for speech to begin, then outputs the audio. The SpeechToTextWidget takes this audio and sends it up to the Speech-To-Text service, which returns with a transcript of what it heard. The SpeechDisplayWidget then takes this text and displays it in the game world. We only use the SpeechDisplayWidget for debugging purposes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*wGK2eun9GvdpPYlFS1Q3FA.png" /><figcaption>Watson Unity SDK Prefabs</figcaption></figure><p>For those who have done SteamVR development in Unity before, you’re probably familiar with the [CameraRig] object. This is how we have ours set up:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*yaQUW0wpoK8pVUUKVwyNNg.png" /><figcaption>The Camera Rig outfitted with widgets</figcaption></figure><p>You may notice a widget in there that isn’t part of Watson SDK. That is our VoiceSpawnerWidget and it contains the code that I will share with you next. Below is what the widget looks like in the inspector. There are a few important things here to note:</p><ol><li>It is set up to take Speech Input in the form of SpeechToTextData just like the SpeechDisplayWidget.</li><li>It maintains a reference to the scene’s Game Manager, which is where we store our object dictionary.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*t0NNBbFa1kzwxZ3-BRfIbQ.png" /><figcaption>Inspector view of the VoiceSpawnerWidget</figcaption></figure><p>The Game Manager for this scene only has three objects in its dictionary, but it gives you an idea of how our dictionary is set up. Each key is an Object entity value that we may get back from the Conversation service. These keys then map to a prefab of an object the player can create.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*3Z4TUGkziHl_FfCSLssMXA.png" /><figcaption>Tutorial Manager Objects Dictionary</figcaption></figure><p>Let’s see what’s inside that Voice Spawner script that takes a voice transcript and turns it into a key to give to the Game Manager.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/329a52903bdf7d626da7f392aa410092/href">https://medium.com/media/329a52903bdf7d626da7f392aa410092/href</a></iframe><p>This class variable declaration is how we tell the script that it is looking for SpeechToTextData (the output of the SpeechToTextWidget) and that when it receives that data to call the OnSpeechInput function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e624fdbbd6f0c6387add881ad379aaff/href">https://medium.com/media/e624fdbbd6f0c6387add881ad379aaff/href</a></iframe><p>The OnSpeechInput function is fairly simple and contains a lot of loops. First, it takes in the SpeechToTextData and checks to see if it has a result (meaning it heard something). If it did hear something, it then loops through everything it heard and all the potential alternatives it could have heard. In this game, we have our confidence threshold set to 0 because we simply want to pass everything through to the Conversation service, but we could make it be more confident in the future. The last line of this function is what sets up the call to the Conversation service. This line tells the Conversation service which work space to use, what the text to analyze is (our transcript), and finally to call the OnMessage function when it gets its result.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5044e7c8e842c3a827ddc624614784c0/href">https://medium.com/media/5044e7c8e842c3a827ddc624614784c0/href</a></iframe><p>Before diving into the OnMessage function, there are a few pre-requisites. Here we declare both the Conversation service variable and the WorkspaceID variable as global class variables.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d63664c40a6f44962eabceead576c6b5/href">https://medium.com/media/d63664c40a6f44962eabceead576c6b5/href</a></iframe><p>Then, in the objects Start() function, we set the WorkspaceID to a value we pull out of our Watson configuration. Now we can get into the OnMessage function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f8ed4946d9c16dc95070e92f2288eb81/href">https://medium.com/media/f8ed4946d9c16dc95070e92f2288eb81/href</a></iframe><p>In this function, we parse the results from the Conversation service. Similar to the OnSpeechInput function, we first check to make sure we even have any results. This is done by checking to see if we have any intents or entities, conveniently stored in the intents and entities arrays. If we do, we move on with the function. Next, we check to see what the intent is with a few simple if statements. If the intent is to create, we loop through all of the entities to see which Material or Object entities it contains. Then we pass those values into the Game Manager to actually instantiate the object. If the intent is to create, but there were no object entities recognized, we play a sorry message to the player, so they know they can stop waiting for the object to appear. The other intents are much simpler. The destroy intent tells the Game Manager to destroy whichever object the player is currently pointing at with either their left or right hand. The help intent plays a simple help message with suggestions on what to create.</p><h3>The User Experience</h3><p>After implementing the Conversation service in our app, we were faced with the challenge of designing the world in such a way that voice commands felt like an intuitive method of interaction. After a little trial and error, we discovered a few interaction patterns that worked for our game world:</p><p><strong>1. Set Expectations</strong> — When designing a game with a limited number of intents, it is a good idea to let the user know what aspects of the world can be affected by voice commands and to demonstrate the commands. With voice, there is an infinite number of interaction options, and you may be surprised how off-script users can go when testing the versatility of conversation interactions, especially with no guidance. In our game, users can use their voice to create an object, destroy an object, or ask for help. At the beginning of the demo, we set this expectation by having a short tutorial where users create an object then destroy it using voice commands. Once we walk users through the commands, they are much less likely to try to interact with the game using unsupported phrases.</p><p><strong>2. Users shouldn’t have to press a button to initiate Conversation</strong> — Pressing a button any time you want to use a voice command feels unnatural. This is even the case outside of a Virtual Reality environment, but inside a Virtual Reality environment the disruption is exaggerated. With most VR setups, the only physical buttons that users can interact with are located on hand-held controllers. This means that whenever the user is issuing a voice command to a specific target in the game, they must also be pressing the button on the hand-held controller, which is often outside their field of vision entirely. This results in a situation where many users simply forget to press the button altogether and are left wondering why the voice command didn’t work.</p><p>Interestingly enough, we found that whenever users did understand the push-to-talk functionality, they would almost universally hold the controller up to their mouth as if it were a microphone (despite the fact that the microphone is located on the headset). Even users that <em>knew</em> there was no microphone on the controller were inclined to do this. This behavior indicates that the natural inclination when pressing a button to issue a voice command is to speak directly into the area where the button is being pressed. In our game, because users can create objects at any place and time, we solved this issue by eliminating button presses entirely and using ambient listening. Rather than waiting for a button press to understand that the user intends to do something, we listen for intents using Conversation.</p><h3>Final Thoughts</h3><p>It’s that simple to get powerful Natural Language Processing and Speech Recognition into your Unity games using the Watson services. As mentioned earlier, we’re only using the Intents and Entities that the Conversation service gives us. The third Dialog component allows for more fine-grained conversation-like interfaces with characters in your game. What’s discussed in this post is just the tip of the iceberg in getting voice control into your VR experiences.</p><p>To see our implementation in action, check out the video <a href="https://www.youtube.com/watch?v=C56OZyQ_oFo">here</a>. Get started with the Watson Unity SDK on GitHub by going <a href="https://github.com/watson-developer-cloud/unity-sdk">here</a>, or if you would like to contribute to the Watson Unity SDK, go <a href="https://developer.ibm.com/open/watson-developer-cloud-unity-sdk/">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1556d776ac8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>