MSDN Magazine - April 2008 - (Page 60) the QuestionAnswer activity lets the user give a response either through speech recognition or touch-tone (Dual Tone MultiFrequency or DTMF) key presses. the activity has been played to the user and what kind of response they gave. You can define what is spoken at a given point in time by assigning the text you want spoken for a corresponding prompt type. Building Prompts The QuestionAnswer activity has four Each activity that provides information more prompt types than a Statement acto the user through either TTS or preretivity: Silence, Escalated Silence, No Reccorded prompts has a property named ognition, and Escalated No Recognition. MainPrompt, which is of type PromptWhile MainPrompt is mandatory to set, Builder. MainPrompt defines what is these prompts are optional. The Silence spoken to the user when the activity is prompt is spoken to the user when a user first executed. The PromptBuilder type doesn’t give any response before the time provides multiple methods for fine-tun- Figure 2 Statement Activity Order of Event specified in the InitialTimeout property. Execution ing how a prompt will sound. The three If the user still doesn’t give a response, the most commonly used methods are SetText, ClearContent, and Ap- Escalated Silence prompt will play. The No Recognition and EscapendText. Here is an example of using SetText to create the mes- lated No Recognition prompts follow the same rules as the Silence sage “Thank you for calling.”: and Escalated Silence prompts, but are used when the user gives a response the application doesn’t recognize. this.statementActivity.MainPrompt.SetText(“Thank you for calling.”); Dynamic prompts create some problems when converting the These two lines use ClearContent and AppendText to send the text resource into spoken words, and two of the most common same “Thank you for calling.” message: problems are dates and times. Typical data sources store dates in a this.statementActivity.MainPrompt.ClearContent(); this.statementActivity.MainPrompt.AppendText(“Thank you for calling.”); readable format such as 01/01/2008. However, when spoken, you Both of these snippets accomplish the same objective, so you can want to hear “January first two thousand eight.” The solution for use either one. My general rule is, if I have a line containing Clear- translating this commonly understood date format into a commonly Content immediately followed by an AppendText method, I’ll re- understood spoken format is the AppendTextWithHint method. place it with the SetText method for the simple reason that one line This method accepts the same string parameter as AppendText of code is easier to maintain than two. does, but it also takes a SayAs parameter. The SayAs parameter is In a Statement activity (see Figure 2), there are a standard set of a simple Enum containing the different options for manipulating events that fire each time the prompt is rendered. Setting a static readable text into spoken text. In the example of converting a date, prompt in any of these events would cause your app to write the the code would look like the following: same value of the prompt each time the prompt was rendered. this.statementActivity.MainPrompt.AppendTextWithHint( It’s more efficient to set static prompts before the activity is ini“01/01/2008”, Microsoft.SpeechServer.Synthesis.SayAs.Date); tialized, such as in the Initialize event of the workflow instead of the activity. If the prompt is dependent on a dynamic value of some Prerecorded Prompts sort, it’s still more efficient to set the value before the activity is iniBy default, your Voice Response Workflow will use the TTS entialized. In fact, the most efficient method for setting static prompts gine’s voice to speak the text defined in your prompts. Using the is to use the Visual Studio tools, which put the prompt text in a TTS engine, however, requires a lot of processing power and can resource file that is loaded only once when the constructor of the end up sounding like every other system using TTS. workflow calls the InitializeComponent method. Your other option is to use prerecorded prompts. While you can As for dynamic prompts, the story starts to change when you code your prompts to play a WAV file instead of assigning text, it’s look at activities that not only speak to the user but also look for better to simply add a prompt database project to the solution. A user input. A good example is the QuestionAnswer activity. While prompt database enables you to easily create, edit, and manage QuestionAnswer follows the same order of execution, it also ac- the WAV files used in your application as well as storing them in a cepts user input. This means that if the user says something the compressed format. This compressed format allows the prompts system doesn’t recognize, the TurnStarting event fires again. This to be loaded faster. If you use a prompt database, you won’t have to would be inefficient, as you are setting the same dynamic prompt make any coding changes to your application’s prompts. again as well as duplicating the use of the dynamic resource, such When you import or create WAV files in the prompt database, as a database lookup. If the dynamic prompt must be set at the you can assign the transcription of the WAV file. When the applitime of activity execution, set it during the Executing event over cation encounters text to be spoken, it looks in the prompt data for the TurnStarting event. This is because the Executing event is only a match on the transcription field. For example, if the application fired once per session, while the TurnStarting event is fired every needs to speak “Thank you for calling.” and there is a transcription time the QuestionAnswer activity is rendered. of “Thank you for calling.” in the prompt database, it will play the The text that is actually spoken is dependent on how many times associated WAV file instead of rendering the text using the TTS. 60 msdnmagazine Voice Response Workflows
Table of Contents Feed for the Digital Edition of MSDN Magazine - April 2008 MSDN Magazine - April 2008 Contents Toolbox CLR Inside Out Basic Instincts Cutting Edge Foundations Test Run Service Station Windows with C++ Going Places { End Bracket } MSDN Magazine - April 2008 MSDN Magazine - April 2008 - (Page Intro) MSDN Magazine - April 2008 - Contents (Page Cover1) MSDN Magazine - April 2008 - Contents (Page Cover2) MSDN Magazine - April 2008 - Contents (Page 1) MSDN Magazine - April 2008 - Contents (Page 2) MSDN Magazine - April 2008 - Contents (Page 3) MSDN Magazine - April 2008 - Contents (Page 4) MSDN Magazine - April 2008 - Contents (Page 5) MSDN Magazine - April 2008 - Contents (Page 6) MSDN Magazine - April 2008 - Contents (Page 7) MSDN Magazine - April 2008 - Contents (Page 8) MSDN Magazine - April 2008 - Contents (Page 9) MSDN Magazine - April 2008 - Contents (Page 10) MSDN Magazine - April 2008 - Toolbox (Page 11) MSDN Magazine - April 2008 - Toolbox (Page 12) MSDN Magazine - April 2008 - Toolbox (Page 13) MSDN Magazine - April 2008 - Toolbox (Page 14) MSDN Magazine - April 2008 - Toolbox (Page 15) MSDN Magazine - April 2008 - Toolbox (Page 16) MSDN Magazine - April 2008 - CLR Inside Out (Page 17) MSDN Magazine - April 2008 - CLR Inside Out (Page 18) MSDN Magazine - April 2008 - CLR Inside Out (Page 19) MSDN Magazine - April 2008 - CLR Inside Out (Page 20) MSDN Magazine - April 2008 - CLR Inside Out (Page 21) MSDN Magazine - April 2008 - CLR Inside Out (Page 22) MSDN Magazine - April 2008 - CLR Inside Out (Page 23) MSDN Magazine - April 2008 - CLR Inside Out (Page 24) MSDN Magazine - April 2008 - Basic Instincts (Page 25) MSDN Magazine - April 2008 - Basic Instincts (Page 26) MSDN Magazine - April 2008 - Basic Instincts (Page 27) MSDN Magazine - April 2008 - Basic Instincts (Page 28) MSDN Magazine - April 2008 - Basic Instincts (Page 29) MSDN Magazine - April 2008 - Basic Instincts (Page 30) MSDN Magazine - April 2008 - Basic Instincts (Page 31) MSDN Magazine - April 2008 - Basic Instincts (Page 32) MSDN Magazine - April 2008 - Basic Instincts (Page 33) MSDN Magazine - April 2008 - Basic Instincts (Page 34) MSDN Magazine - April 2008 - Cutting Edge (Page 35) MSDN Magazine - April 2008 - Cutting Edge (Page 36) MSDN Magazine - April 2008 - Cutting Edge (Page 37) MSDN Magazine - April 2008 - Cutting Edge (Page 38) MSDN Magazine - April 2008 - Cutting Edge (Page 39) MSDN Magazine - April 2008 - Cutting Edge (Page 40) MSDN Magazine - April 2008 - Cutting Edge (Page 41) MSDN Magazine - April 2008 - Cutting Edge (Page 42) MSDN Magazine - April 2008 - Cutting Edge (Page 43) MSDN Magazine - April 2008 - Cutting Edge (Page 44) MSDN Magazine - April 2008 - Cutting Edge (Page 45) MSDN Magazine - April 2008 - Cutting Edge (Page 46) MSDN Magazine - April 2008 - Foundations (Page 47) MSDN Magazine - April 2008 - Foundations (Page 48) MSDN Magazine - April 2008 - Foundations (Page 49) MSDN Magazine - April 2008 - Foundations (Page 50) MSDN Magazine - April 2008 - Foundations (Page 51) MSDN Magazine - April 2008 - Foundations (Page 52) MSDN Magazine - April 2008 - Foundations (Page 53) MSDN Magazine - April 2008 - Foundations (Page 54) MSDN Magazine - April 2008 - Foundations (Page 55) MSDN Magazine - April 2008 - Foundations (Page 56) MSDN Magazine - April 2008 - Foundations (Page 57) MSDN Magazine - April 2008 - Foundations (Page 58) MSDN Magazine - April 2008 - Foundations (Page 59) MSDN Magazine - April 2008 - Foundations (Page 60) MSDN Magazine - April 2008 - Foundations (Page 61) MSDN Magazine - April 2008 - Foundations (Page 62) MSDN Magazine - April 2008 - Foundations (Page 63) MSDN Magazine - April 2008 - Foundations (Page 64) MSDN Magazine - April 2008 - Foundations (Page 65) MSDN Magazine - April 2008 - Foundations (Page 66) MSDN Magazine - April 2008 - Foundations (Page 67) MSDN Magazine - April 2008 - Foundations (Page 68) MSDN Magazine - April 2008 - Foundations (Page 69) MSDN Magazine - April 2008 - Foundations (Page 70) MSDN Magazine - April 2008 - Foundations (Page 71) MSDN Magazine - April 2008 - Foundations (Page 72) MSDN Magazine - April 2008 - Foundations (Page 73) MSDN Magazine - April 2008 - Foundations (Page 74) MSDN Magazine - April 2008 - Foundations (Page 75) MSDN Magazine - April 2008 - Foundations (Page 76) MSDN Magazine - April 2008 - Foundations (Page 77) MSDN Magazine - April 2008 - Foundations (Page 78) MSDN Magazine - April 2008 - Foundations (Page 79) MSDN Magazine - April 2008 - Foundations (Page 80) MSDN Magazine - April 2008 - Foundations (Page 81) MSDN Magazine - April 2008 - Foundations (Page 82) MSDN Magazine - April 2008 - Foundations (Page 83) MSDN Magazine - April 2008 - Foundations (Page 84) MSDN Magazine - April 2008 - Foundations (Page 85) MSDN Magazine - April 2008 - Foundations (Page 86) MSDN Magazine - April 2008 - Foundations (Page 87) MSDN Magazine - April 2008 - Foundations (Page 88) MSDN Magazine - April 2008 - Foundations (Page 89) MSDN Magazine - April 2008 - Foundations (Page 90) MSDN Magazine - April 2008 - Foundations (Page 91) MSDN Magazine - April 2008 - Foundations (Page 92) MSDN Magazine - April 2008 - Foundations (Page 93) MSDN Magazine - April 2008 - Foundations (Page 94) MSDN Magazine - April 2008 - Foundations (Page 95) MSDN Magazine - April 2008 - Foundations (Page 96) MSDN Magazine - April 2008 - Foundations (Page 97) MSDN Magazine - April 2008 - Foundations (Page 98) MSDN Magazine - April 2008 - Test Run (Page 99) MSDN Magazine - April 2008 - Test Run (Page 100) MSDN Magazine - April 2008 - Test Run (Page 101) MSDN Magazine - April 2008 - Test Run (Page 102) MSDN Magazine - April 2008 - Test Run (Page 103) MSDN Magazine - April 2008 - Test Run (Page 104) MSDN Magazine - April 2008 - Test Run (Page 105) MSDN Magazine - April 2008 - Test Run (Page 106) MSDN Magazine - April 2008 - Service Station (Page 107) MSDN Magazine - April 2008 - Service Station (Page 108) MSDN Magazine - April 2008 - Service Station (Page 109) MSDN Magazine - April 2008 - Service Station (Page 110) MSDN Magazine - April 2008 - Service Station (Page 111) MSDN Magazine - April 2008 - Service Station (Page 112) MSDN Magazine - April 2008 - Service Station (Page 113) MSDN Magazine - April 2008 - Service Station (Page 114) MSDN Magazine - April 2008 - Windows with C++ (Page 115) MSDN Magazine - April 2008 - Windows with C++ (Page 116) MSDN Magazine - April 2008 - Windows with C++ (Page 117) MSDN Magazine - April 2008 - Windows with C++ (Page 118) MSDN Magazine - April 2008 - Windows with C++ (Page 119) MSDN Magazine - April 2008 - Windows with C++ (Page 120) MSDN Magazine - April 2008 - Windows with C++ (Page 121) MSDN Magazine - April 2008 - Windows with C++ (Page 122) MSDN Magazine - April 2008 - Going Places (Page 123) MSDN Magazine - April 2008 - Going Places (Page 124) MSDN Magazine - April 2008 - Going Places (Page 125) MSDN Magazine - April 2008 - Going Places (Page 126) MSDN Magazine - April 2008 - Going Places (Page 127) MSDN Magazine - April 2008 - { End Bracket } (Page 128) MSDN Magazine - April 2008 - { End Bracket } (Page Cover3) MSDN Magazine - April 2008 - { End Bracket } (Page Cover4)
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.