Voice modules

Some time ago I had found an experimental extension of Scratch for voice recognition. I have seen that Snap has a "Text to Speech" module. Did someone experiment with adding voice recognition to Snap?

I implemented some Snap! blocks for speech recognition that rely upon Chrome's support for this. (FireFox has been working on adding support for a while now.)

There is a guide to the new speech recognition blocks and you can import this library to get the blocks.

Thanks a lot Ken, this is exactly what I needed. It works very well.

I found really interesting the way you added the interactive sample blocks in the guide. Could you please give me a few details on how this has been done?

Thanks in advance

At first I did the simple thing of just placing iframes with the project URL in the HTML page. This worked fine for 2 or 3 iframes but with more the page loaded very very slowly since each Snap! had to load along with each project. So I created some JavaScript that turned screenshots into clickable elements that load the project when clicked.

Here's the JavaScript but it has be customised to my particular context - https://github.com/ecraft2learn/ai/blob/master/js/ai-guide.js

Thanks a lot. And how do you select the Snap area that is shown in the iframe element?

I put the iframe in a DIV container with the desired width and height of the Snap! area. The container uses the CSS style "overflow: hidden". The iframe itself has a much larger width and height that pretty much covers the whole Snap! canvas. I also scale the iframe by 1.5 for readability. Once I found values I liked it wasn't hard to adjust them for each instance.

Excellent. And how do you center the DIV on, e.g., the script area of the Snap! canvas?

I think what happens is that the CSS centers based upon the difference of the widths and heights of the containing DIV and the IFRAME.

I see. Thanks a lot