If your board has a microphone, it can detect claps (or other loud sounds). The clap count block from the Microphone library can be used to count a squence of claps. The number of claps can be used to trigger different responses, such as displaying different faces on a micro:bit display. By choosing commands with the right number of syllables and speaking loudly, you can use your voice instead of claps to issue commands.
Add the Microphone library from the Sensors folder and create the scripts or download and import the project. Start the project, then clap several times in a row. The number of claps will be displayed. Certain numbers of claps also trigger a response. One clap shows a frowny face, two claps shows a happy face, and three claps clears the display.
You may need to adjust the clap threshold for best results. If you are in noisy room, you may need to increase the threshold. You can open the graph and run the graphing script to see how the loudness changes as you clap and talk. The threshold should be just a little higher than the highest peaks in the graph when you talk quietly. That level will allow you to speak commands by raising your voice.
This this project uses the clap count block from the Microphone library, which in turn uses the loudness block to detect spikes in the loudness profile. To get a better sense of how this works, you can graph the loudness. Here is a graph of someone talking in an ordinary voice:
And here is a graph of hand clapping. It shows one clap, then a little pause, then three claps close together:
The clap counter works by detecting the spikes associated with claps. It does that by sensing when the loudness goes above the level set by the set clap threshold block. You may need to adjust that threshold based on the sensitivity of your microphone and the amount of background noise in your environment.
If you choose the right words and speak them carefully, you can use voice commands instead of claps. To make that work you'll need to speak each syllable loudly and leave a little space between syllables. You may also need to adjust the threshold. This graph shows the three commands "sad", "hap-py", and "go to sleep":
You will notice that these commands have one, two, and three syllables, so they trigger the same actions as one, two, or three claps. Real speech recognition is much more complex than this. It takes into account not only loudness but also the pitch and the frequency spectrum of the sound signal. Speech recognition systems can distinguish among words with the same number of loudness peaks, whereas this simple clap counter will trigger the "one clap" response for any one-syllable word.