Working with speech
Earlier in this chapter, we generated music melodies using the Micro:bit. The Micro:bit can also be used to generate speech. This means we can generate words, sentences, and even poems using the Micro:bit. We will use a speech
library to generate speech using the Micro:bit. Let us try generating a simple speech message using the speech
library:
import speech from microbit import * speech.say("Hey!") sleep(500) speech.say("How are you friend") sleep(1000)
This program will generate the speech Hey! How are you friend? We can hear the sound from the internal speaker or any external speaker connected to the Micro:bit.
The speech that’s generated by the preceding program does so using the Text-to-Speech (TTS) default settings. The TTS conversion in the Micro:bit is done with Software Automated Mouth (SAM), which was originally released in 1982 for the Commodore 64. More details about SAM are available at https://simulationcorner.net...