Sunday, September 20, 2015

Talking Moose

Lately I've been fooling around with Bluetooth speakers so I suggested that we take some of my daughters toys and make it talk. She was obviously very excited. Imagine if someone suggested this when you were a kid. I'd personally had gone nuts. Well, she chose her dear Moose. 

So I went to buy a cheap'n'small bluetooth speaker for 17 euros and we started by makingthe bluetooth speaker talk using the Mac's fabulous say command line tool. First we connected the Bluetooth speaker by fiddling with the Mac's Bluetooth preferences. After that, the speaker is ready to use. Now, when you type something like

    say "Hello world"

You'll hear speech from the bluetooth speaker. There's even a bunch of different voices available and you can add more from the Text-to-speech preferences. For the Finnish language, there's a nice voice called Mikko. To use a specific voice, you do like

    say -v Mikko "Huomenta Suomi!"

And it was fun, once again. We've played with the say command before, but now the sound comes from a different box, so it was even more fun. Even our 3-year-old made the box talk. She can type her own name and learning more words every day.

Then I suggested we break the bluetooth speaker to pieces, just for the heck of it. And sure we did. We found a lithium battery, a circuit board and a speaker element. And I do find my daughter to be much like me when I was a kid. I always broke things to pieces and usually was unable to put them back together. We, however succeeded also at putting the speaker back together too. And yes, we tried if it works when in pieces too.

Later today, she came back and asked whether we are going to make the moose talk. And we stuffed the speaker into the Moose's butt. Now it speaks. Through its butt. Great! We even added some velcro so that you can close the gap and hide the electronics. And open it to recharge the speaker via USB.

By the way, you can actually connect several bluetooth speakers to your Mac. And you can address each of the individually using the -a parameter of the say command. What this mean in practise is that you can make a theatrical play with several soft toys speaking (through their butts) with different voices, by programming! 


Monday, September 14, 2015

Hello Ruby!

A while ago we got mail.

The long-awaited Hello Ruby book by Linda Liukas arrived! We read it as a good-night story the same night and both the girls (6 and 3 years) seemed to love it. Even with about 60 pages of story, it was an easy and quick read and even the 3-year old was all ears and had no problem concentrating. 

I was expecting a bit more "programming" in the story though. There are references to algorithmic thinking (Ruby thinks like a programmer), but without extra explaining, the kids won't notice that. The references to Python, Django, Snowleopard, Androids et al are also cute but don't ring any bells to small kids. Not sure that it makes sense to add that kind of a layer on the story.

Nevertheless, the most fun part in the book are the excercises though. From page 65 or so starts a "workbook" (not sure about the wording as my book's in Finnish) section, which is a real treasure chest full of fun and graphical programming exercises that you can do without a computer. This is the section that makes the book twice worth its price even if there wasn't a story at all!

Working on the 1st exercise

The exercises may seem simplistic, but at least for my quite-a-bit experienced 6-year old coder girl, they were just perfect. Easy and fun. We covered the first three exercises in half an hour or so. The first exercise was about writing written instructions for stuff like eating breakfast. Below there are the 6-year old's instructions. She even managed to make a loop to make sure that all the oatmeal gets eaten. She wasn't sure how you make a loop in this Finnish pseudo-language, and asked me how to "make a repeat" in Finnish, as she didn't know the right "coding words" in her mother tongue.

The exercises involve not just writing step-by-step procedures, but also breaking things into parts, boolean logic and so on. As an extra, she got to draw Ruby in her weekend costume, the rules of which she had to write in exercise three. You can probably guess the rules from the picture?

And how about the 3-year old? She was busy too, and also drew a picture of Ruby.

Ruby pictured by 3-year old artist

So, Ruby is not just cute, but smart too. Well done, Linda!