Friday, March 07, 2014

The Talking Map

This is probably completely pointless but I've just used the Web Speech API to create a Speaking Map. If you click anywhere on this map the address will be spoken out loud.

To get the map to speak only required one line of code (where the address is the reverse geo-coded address from clicking on the map). Here's the magic line of code:

var msg=new SpeechSynthesisUtterance(address);window.speechSynthesis.speak(msg);

The Web Speech API isn't widely supported yet - so to hear the map talk you will have to use a compliant browser. In this case you will probably need to view the Speaking Map in Chrome. This map obviously isn't that useful but it would be easy to add speech to directions and create your own navigation system.

No comments: