From "Hello" to "Bonjour": Bringing AI to Life
I recently revisited one of my favourite projects based around using Machine Learning for Kids and Scratch 3, and the result was surprisingly elegant. For STEM educators and makers, this is more than just a coding trick; it’s a gateway to AI literacy and global communication.
It started with a simple question: Could I make a computer not just hear me, but understand my intent across languages? I’m always looking for that "Aha!" moment—the point where the complexity of high-level tech melts away into a simple, working project - and is cool. The end goal has changed since the original project from getting it to just saying a prescribed phrase to translating typed-in phrases when it hears "French" - it is even cooler than before.
The Journey: Making the Connection
I sat down with the goal of creating a "Polyglot Sprite." The setup through the Machine Learning for Kids Scratch template was remarkably straightforward. I didn’t need to be a data scientist; I just needed a clear logic flow.
The magic happens when you combine three specific extensions:
Speech to Text: To let the computer "listen."
Translate: To bridge the language gap.
Machine Learning Blocks: To handle the triggers.
The logic was simple: if I said "Hello," the sprite responded in English. If I say "French," the system toggles a state, and the next "Hello" triggers a "Bonjour." Seeing it work for the first time—realising that I had built a functional translator with just a few blocks—was incredibly satisfying. It’s that specific moment of success I want every student to feel.
How to Build It: A Step-by-Step Guide
This project doesn’t require you to train a new model from scratch. We’re going to use the pre-trained models available in the special ML4K version of Scratch 3.
1. Launch the Environment
Open the
2. Add Your "Superpowers" (Extensions)
Click the Blue Extension Button (bottom-left corner) and add these three tools:
| Figure 1: Extension for Speech to Text |
Speech to Text: This allows the computer to use your microphone.
Translate: This gives your sprite its "inner dictionary."
Text to Speech: So your sprite can talk back!
3. Coding the "English" Logic
First, let's make the sprite respond to a basic "Hello."
Drag a
when green flag clickedblock (from the standard Events menu).Add a
listen and waitblock (from the Speech to Text menu).Using a
Inside the block, use the
speakblock to say "Hello!" back.
| Figure 3: The code for Coding the "English" Logic |
What to Expect: When the Green Flag is clicked, it will start listening (once your microphone is set up), and when hello is said, it will say hello back.
- Drag a translate block into the speak block. Change the language to French
5. The "Switch" (Adding French)
Now, we create the logic to switch languages.
So it will wait until it hears the word "French" - Using the When I hear block anf this time instead of hello, French.
Have an input/ask block that waits for the a message to be typed in.
Using a speak block say the message in English (stored as answer)
Wait 1 second and then using a combination of the speak block and translation block turn the message (answer) into the French equivalent.
| Figure 5: Translating English to French |
How Does It Actually "Hear"? (The CS Bit)
When we talk to a computer, it doesn't "hear" words the way humans do. To keep it simple for students:
The Sound Library: Imagine the computer has a massive library of sound patterns (waveforms).
The Match Game: When you speak, the computer turns your voice into a digital pattern and quickly compares those sound waves to its library patterns.
The Verdict: If the pattern of your "Hello" matches the pattern in its library closely enough, it triggers the code.
A Note on Ethics: This is a great time to talk to students about Privacy. If a computer is waiting for a "trigger word," is it always listening? It’s a vital conversation for the modern digital citizen.
Taking it Off-Screen: The Maker Challenge
To turn this from a screen activity into a "Physical Computing" project, we need to build a home for our AI using "low-tech" recycled materials.
The Translation Booth: Use a cardboard box to create a mini-kiosk for the laptop or tablet. Decorate it with flags from around the world. It transforms the experience from "using a computer" to "interacting with a station."
The Robot Head: Cut a slot in a sturdy box for the screen (the "face"). When the sprite speaks "Bonjour," the "Robot" is talking to you!
The Educator’s Challenge: Once the basic "Hello" project (all the steps up to and including step 4) works, challenge your students: Can you make the sprite change its costume? If it detects 'French,' can it switch to a costume of a croissant or the Eiffel Tower?
Why This Matters
We are moving beyond teaching kids how to code; we are teaching them how to build systems that interact with the real world. By using a "one-word trigger" project, we remove the frustration of complex syntax and focus on the logic of AI and the joy of creation.
I’d love to hear how you might use this in your classroom or makerspace. What "Aha!" moments have your students had with AI? Let’s chat in the comments below!
Comments
Post a Comment