Say Sentences with an AI Speaker (Premium Only)
CreatiCode last edited by info-creaticode
You can easily make the computer say a word or sentence using the “say” block in the AI category. You can also store that speech as a sound clip in the “Sounds” tab, so that you can replay it later.
Let’s go through each input for this block below.
Most of the time, you should put a complete sentence into each “say” block instead of individual words. It will give the AI a better way to decide how to say these words. In addition, there is a short waiting time for each “say” block.
For example, this is what you get when you use 2 blocks to say “Good” and “morning”:
On the other hand, this is what you get when you use one block for both words:
You can pick which language the AI speaker uses. The most common languages are listed at the top of the list:
Note that the same language may appear multiple times with different dialects. For example, the sentence “Good afternoon” sounds differently between English speakers from the USA vs the UK:
Most of the time, the language selected should match the sentence in the first input box. However, sometimes you may want the same AI speaker to talk in 2 languages, then you should make sure the same language is used. For example, these 2 blocks are using a Chinese AI speaker to say both Chinese and English:
Within the same language, you can pick what type of AI speaker to use:
Note that not all speaker types are available for all languages. If the speaker type is not available for the language you have selected, then you will get a warning message in the console panel at the bottom of the code editor.
You can control how fast the speaker talks. A value of 100 means the normal speed. The larger the value, the faster the speed. For example, a value of 200 would double the talking speed, and a value of 50 would be half of the speed.
The pitch controls how high or low the AI speaker sounds. Usually, you want to keep it at 100, which is the normal pitch.
The volume controls how loud the AI speaker talks. For example, if you want the AI speaker to raise her voice in a sentence, then you can use a value larger than 100.
The last input allows you to specify a sound clip name. If it is not blank, then the sound from the AI speaker will not only be played out, but also be stored as a sound clip under the “Sounds” tab.
This can be very useful if your program makes the AI speaker repeatedly say some sentences: you can play the pre-generated sound clips, which will be much faster compared to generating the AI speech in real-time each time.
In this demo, we make the AI speaker say “How are you?” and store the sound in a clip named “greetings”. After that, we can use the “start sound” block to play the same sentence.