Voice Recognization Using Speech Synthesis In Game Construct 2

Introduction

 
Constructor is based on 2D game creation, without using coding. Thus, it is easy for game development, it is similar to the time necessary to make your ideas a reality. Some of the initial concepts using constructor for game creation are given below. From this article, I will explain about voice recognization using speech synthesis Construct2 .This article also explains the basics which would be same for all basic insertion of the object that has been added.
 
Prerequisites
 
constructor-2(free edition), it can be downloaded from the link here.
 

Layout condition

 
Step 1
 
Click File->New. Open NEW->Default new empty project.
 
Voice Recognization Using Speech Synthesis In Game Construct 2
 
Voice Recognization Using Speech Synthesis In Game Construct 2
 
Step 2
 
After opening a new project an empty layout sheet will be displayed so that we can change the size of the layout sheet in the layout properties, the layout sheet size must be (1000, 700) and after that, a new event sheet must be added.
 
Voice Recognization Using Speech Synthesis In Game Construct 2
 

Inserting many objects

 
Now let’s take a look at adding more objects, for that double click->in layout sheet and select->insert a new object in dialog box and now we can select and add more objects.
 
The layout sheet template is shown below.
 
For Example,
  1. Button
  2. List
  3. User Media
  4. Text
  5. Text box.
Voice Recognization Using Speech Synthesis In Game Construct 2

Voice Recognization Using Speech Synthesis In Game Construct 2
 
Voice Recognization Using Speech Synthesis In Game Construct 2

Voice Recognization Using Speech Synthesis In Game Construct 2
Voice Recognization Using Speech Synthesis In Game Construct 2
Voice Recognization Using Speech Synthesis In Game Construct 2
 
From the above image, we can see the layout objects that have been inserted, in the right side of the corner.
 
Now let’s take a small dive into the event sheet.
 
We have taken a look about the layout sheet handling, now we can take a look at the event sheet.
 
Step 4
 
Now, we need to open the event sheets & right-click on the Window stage, & now again double click->event sheet and a window box will appear.
 
Add event->Click-On,
  1. System
  2. On start of layout
Add action->Click-On,
 
First Conditions,
  1. List
  2. Clear
  3. Done.
Second Conditions
  1. List
  2. Add item
  3. “Default”
Third Conditions
  1. List
  2. Set Selection
  3. Index: 0
Voice Recognization Using Speech Synthesis In Game Construct 2

Voice Recognization Using Speech Synthesis In Game Construct 2
 
Step 5
 
From the completion of add event, now we need to add-> add action. For that:
 
Add action->Click on,
 
After clicking add action a dialog box will appear and click system and follow the conditions of it,
  1. System
  2. Repeat
  3. UserMedia.VoiceCount
  4. After, Done.
Add action->Click-on,
  1. List
  2. Text: UserMedia.VoiceLangAt (loop index) & ": " & UserMedia.VoiceNameAt (loop index) & " (" & UserMedia.VoiceURIAt (loop index) & ")"
  3. Done
Voice Recognization Using Speech Synthesis In Game Construct 2
 
Step 6
 
Row condition 2 is on the way and again we are going to add-> add action and select user media object in the appeared dialog box.
 
Add event->Click-On,
  1. User Media
  2. Support Speech Synthesis
  3. After, Done.
Add action->Click-On,
 
First Conditions
  1. Speech Support
  2. Set Text
  3. Text: "Sorry, this browser does not support speech synthesis"
  4. Done.
Second Conditions
  1. Speech Support
  2. Set font color
  3. #000000
Third Conditions
  1. Speak
  2. Set enabled
  3. Mode: Disabled
  4. Done.
Voice Recognization Using Speech Synthesis In Game Construct 2
 
Step 7
 
In this following event sheet, now we are going to add the speak object according to following conditions mentioned below,
 
Add Event->Click-On,
 
First Conditions
  1. Speak
  2. on-clicked
  3. Done.
Second Conditions
  1. List
  2. Compare Selection
  3. Done.
Add action->Click-on,
  1. User Media
  2. Speak Text
  3. Text: SpeakText.Text
  4. Rate: float (Rate. Text)
  5. Pitch: float (Pitch. Text)
  6. After, Done.
Voice Recognization Using Speech Synthesis In Game Construct 2
 
Step 8
 
The row condition 3 states, the system object will be available by default in dialog box and we need to select that object from the event sheet.
 
Add Event->Click-on,
  1. System
  2. Else
  3. Done.
Add action
  1. User Media
  2. Text: SpeakText.Text
  3. Voice URI: UserMedia.VoiceURIAt (List.SelectedIndex - 1)
  4. Rate: float (Rate. Text)
  5. Pitch: float (Pitch. Text)
  6. After, Done.
Voice Recognization Using Speech Synthesis In Game Construct 2
 
The objects in the layout sheet must be selected from the event sheet.
 
Step 9
 
Again, Add Event->Click-on,
  1. Pause
  2. on-Clicked
First Conditions
 
Add action->Clicked-on,
  1. User Media
  2. Pause Speaking
  3. After, Done.
Voice Recognization Using Speech Synthesis In Game Construct 2
 
Step 10
 
The upcoming condition states that the resume object that is being added in the layout sheet  earlier must be added in event sheet.
 
Again, Add Event->Click-on,
  1. Resume
  2. On-Clicked
First Conditions
 
Add action->Clicked-on,
  1. User Media
  2. Resume Speaking
  3. After, Done.
Voice Recognization Using Speech Synthesis In Game Construct 2

Voice Recognization Using Speech Synthesis In Game Construct 2
 
Finally, Speech Synthesis Demo is created on the layout sheet's given template,
 

Output

 
Here comes the final stage of completion of the speech synthesis demo button and let’s take a look at the output of it.
 
After, press F5 to run layout and the browser will display the following output.
 
Voice Recognization Using Speech Synthesis In Game Construct 2
 
Voice Recognization Using Speech Synthesis In Game Construct 2
 

Conclusion

 
Hence the voice recognization using speech synthesis Construct2 is displayed with output using html5. I hope this article will be useful, and thank you for reading,


Similar Articles