Read the phrases you type
In this project, we will use text to speech function of the Magicblocks. We will use inject node, play audio node and debug node for this project.
Shown below is the inject block.
Inject node can be used to Inject/send a message into a flow either manually or at regular intervals.
The payload can be a variety of types, including Strings, Numbers, Boolean, etc.
- Payload: The message that is to be injected should be entered here(this can be of different types such as String, Number, Boolean)
- Topic: An optional property that can be configured in the node.
- Repeat: You can choose to inject in between specified intervals.
- Name: Lets the user name the node.
What is a String?
A string is a sequence of characters. It can consist of numbers, letters, and special characters. Given below are some examples of strings.
- “Hello world”
- “My name is John”
You can use debug node to identify problems in your program.
It will display selected message properties in the debug sidebar tab.
What is Debugging?
It is often very common when we make a program, that there are errors in it. It might not do what we want or it might not work at all sometimes! Debugging is the process where we try to identify these errors and eliminate them.
Let’s connect some nodes to better understand what we learned so far.
Use the below codes.
Double click on the inject node to access its properties. Change the payload type to string(We will try to send a string to the debug window)
Type a message to send.
What is a Payload?
In computing, a payload is the part of the transmitted data, that is the actual intended message. The rest of the data is sent so that it can enable the delivery of the payload successfully.
As an example, you can simply think of the payload as the amount of cargo that is being delivered on a truck.
Connect two blocks with a wire. You can use wires to connect blocks. They enable the data flow between the nodes.
Deploy the playground. (Right top corner).
Click on the button on the inject node.
Check the debugger side tab. You will see the message(payload) there.