Are you fascinated by voice assistants like Alexa or Siri? Do you want to build your own digital assistant in Scratch that can respond to voice commands and share the current date and time?
In this comprehensive Scratch virtual assistant tutorial, you’ll learn step-by-step how to build a Scratch date and time project that uses text-to-speech, senses the system clock, and speaks just like a chatbot.
What You’ll Learn in This Scratch Voice Assistant Tutorial
- How to use Text-to-Speech extension in Scratch
- How to fetch and speak the current date and time
- How to build an interactive assistant character
- Voice settings (Alto, Tenor, Kitten, etc.)
- Programming logic for Scratch AI assistant projects
- Ways to enhance your Scratch chatbot project
Getting Started with Your Scratch AI Project
Before diving into code, make sure you have:
- A Scratch account (or just visit scratch.mit.edu)
- A stable internet connection
- Curiosity to create something fun and futuristic!
Step 1: Set Up the Stage and Sprite
- Delete the default sprite (the cat).
- Click on “Choose a Backdrop”, search for “Jurassic”, and add it.
- Click on “Choose a Sprite”, search for “Character 2”, and select the Character2-F costume.
- Rename your sprite to “Ria” — your virtual assistant!
- Adjust her size to fit nicely on the screen.
Step 2: Add the Text-to-Speech Extension
- Click on the blue block icon (bottom left corner).
- Choose the “Text to Speech” extension.
- This will add new blocks like:
speak [Hello]
set voice to [Alto]
Step 3: Program Ria’s Greeting Using Text-to-Speech
Go to Events and drag when green flag clicked
. Then build the following:
when green flag clicked
set voice to [Alto]
speak [Hello, friends! Do you want to know today’s date and current time? Just click on me!]
👉 Pro Tip: Use wait 0.5 seconds
between blocks for smooth speech timing.
Step 4: Make Ria Respond When Clicked
Now, we want Ria to speak the current date and time when clicked.
Get the Current Date
Go to Sensing and use:
current [year]
current [month]
current [date]
Use the “join” operator block to format the date like MM/DD/YYYY
.
Sample Script:
when this sprite clicked
set voice to [Alto]
speak [Today's date is join (join (join (current [month]) / (current [date])) / (current [year]))]
This joins the values and reads them out loud.
Step 5: Add Current Time Feature
Do the same for current time:
Use these blocks from Sensing:
current [hour]
current [minute]
current [second]
Format them using colons and “seconds”:
speak [The current time is join (join (current [hour]) : (current [minute])) and join (current [second]) seconds]
Combine Date & Time Script:
when this sprite clicked
set voice to [Alto]
speak [Today's date is join (join (join (current [month]) / (current [date])) / (current [year]))]
speak [The current time is join (join (current [hour]) : (current [minute])) and join (current [second]) seconds]
You now have a working virtual assistant in Scratch.
Customize Voice & Style
Explore different voices using:
set voice to [Giant/Squeak/Kitten/Tenor/Alto]
Voice Type | Description |
---|---|
Alto | Female assistant (default) |
Tenor | Male voice |
Kitten | Meow voice (funny!) |
Giant | Deep voice |
Squeak | Cartoonish |
You can use them to give personality to your Scratch chatbot project!
See It in Action
🎬 Watch Omaansh Aggarwal’s Scratch Virtual Assistant Project on YouTube – Date and Time Virtual Assistance using Text-to-Speech
This video tutorial demonstrates every step visually.
Enhancement Ideas for Your Scratch Smart Assistant
Want to take it to the next level? Here are some ideas:
1. Add Weather Updates
Use web-to-Scratch integrations like TurboWarp or Scratch Addons to fetch live weather via APIs.
2. Multi-Language Support
Use multiple “speak” blocks with different languages:
set language to [Spanish]
speak [Hola, amigos!]
set language to [French]
speak [Bonjour!]
3. Ask and Respond (Mini Chatbot)
Use ask [What do you want to know?] and wait
, then analyze answers using if/else
conditions to respond accordingly.
when green flag clicked
ask [What do you want to know: date or time?] and wait
if <(answer) = [date]> then
speak [Today’s date is...]
else
speak [The time is...]
4. Add Emojis & Visuals
Combine “say” with emojis to display cute messages on the screen.
say [Today's Date is...]
5. Add Animation or Sound Effects
Use looks and sound blocks to animate your assistant or add intro music.
Why This Project Matters
Creating a Scratch AI assistant project empowers kids and beginners to:
- Think creatively
- Understand how voice assistants work
- Apply programming to real-world scenarios
- Boost confidence in coding
In fact, this Scratch project mimics real NLP (Natural Language Processing) at a very introductory level.
Final Thoughts
You’ve just built a mini-Alexa in Scratch using:
- Text-to-speech
- Live sensing
- Voice configuration
- Date-time logic
- Interactive sprite clicking
If you loved this Scratch project,
- Don’t forget to check out the full video tutorial by Kodex Academy here: Scratch Project – Date and Time Virtual Assistance using Text-to-Speech by Omaansh Aggarwal
- Like, comment & share the video
- Visit kodexacademy.com
- subscribe to the Kodex Academy YouTube channel for deeper Scratch content.
Happy coding with Kodex Academy! 🚀