Sniff is a "Scratch-like" programming language that's designed to help Scratchers move gently from Scratch to more conventional languages. They can start writing programs, without having to learn a new language because Sniff is based on Scratch. They learn a little more about variables, compiling, syntax errors (!), and they can have fun controlling real hardware while they're doing it.

Wednesday, 1 June 2016

Talk to me Sniff!

In all the excitement over the microbit, we forgot a fun little feature we added in release 27. On "hosted" systems (Mac, Windows and Linux) you can now make Sniff speak. On Mac and Windows it uses the built in voices which sound pretty good. On Linux you may need to install the speech software (using apt-get, or yum).

To make the computer talk to you, all you need to do is create a speech device:

make voice speech device
make message string

Then just set the message and tell it to "speak"

when start
.set message to "hello world"
.tell voice to "speak"
.wait 3 secs

It's that easy! It'll read out any text you like, so to make it count:

make counter number
when start
.set counter to 1
.repeat 10
..set message to [counter]
..tell voice to "speak"
..change counter by 1
..wait 1 secs

That's pretty much all there is to it!