mindtrove Collecting ideas since 1980

22Nov/090

pyttsx

pyttsx is a cross-platform text-to-speech package for Python. It has a simple API for producing speech, setting some basic engine properties, and getting start/stop/word callbacks. pyttsx currently supports SAPI5, NSSpeechSynthesizer, and espeak, but it can be extended to support other engines and libraries.

The project BSD licensed and hosted on Launchpad. PyPI tracks downloads for the latest stable version and documentation.

Tagged as: , , No Comments
24Jun/090

Outfox in Greasemonkey revisited

There was some traffic in the Outfox group about my GMail announcer userscript failing in Outfox 0.3.x. The Outfox API has improved quite a bit since 0.1.0, so it's no surprise my script no longer works.

Here's a new example script that does work with the latest Outfox 0.3.5 release. Instead of polluting the example with all the complications of navigating the GMail DOM, I've picked a much simpler target. This script simply speaks the number of major sections (level 2 headings) in a Wikipedia article when the page loads. It's not as sexy, but the code is much easier to understand.

To try this script, make sure you have the Greasemonkey 0.8 and Outfox 0.3.5 extensions installed on Firefox 3.0 or 3.5. Then visit the following link to have GM install the script: citation_announcer.user.js.

// ==UserScript==
// @name Sections count
// @namespace http://www.mindtrove.info/
// @description Speaks the number of h2 sections in a Wikipedia article
// @include http://*.wikipedia.org/wiki/*
// @require http://www.json.org/json2.js
// @require http://outfox.googlecode.com/svn/trunk/js/outfox.js
// ==/UserScript==
 
// number of major sections
var sections = 0;
 
function onOutfoxAudioInit(response) {
    // say the number of main sections
    outfox.audio.say(sections + ' main sections');
    // return the parameter for other outfox deferred callbacks
    return response;
}
 
function onOutfoxInit(version) {
    var content = document.getElementById('bodyContent');
    // count the number of main sections
    sections = content.getElementsByTagName('h2').length;
    // take one back for the TOC heading if it's present
    if(document.getElementById('toc')) {
        --sections;
    }
    // start the outfox audio service
    var def = outfox.startService('audio');
    def.addCallback(onOutfoxAudioInit);
    // return the parameter for other outfox deferred callbacks
    return version;
}
 
function onDOMContentLoaded() {
    // create a node for outfox use
    var div = document.createElement('div');
    document.body.appendChild(div);
    // initialize outfox
    var def = outfox.init(div, JSON.stringify, JSON.parse);
    def.addCallback(onOutfoxInit);
}
 
// this event triggers execution of the GM script
onDOMContentLoaded();
24May/090

Spaceship!

When Gary announced Outfox back in 2008, all manner of ideas for using speech and sound in the browser popped into my head. I've always had the boring demos (i.e., for adults) at Maze Day, so I decided to work first on a fun, somewhat educational, self-voicing browser game for the 2009 rendition. After all, keeping the mostly under-13, soda drinking, pizza eating, game playing clientele happy is always priority #1 at Maze Day.

The result is Spaceship!, a JavaScript game for Firefox built using Creative Commons licensed music, sound, speech, and graphics; the Dojo toolkit; and the Outfox add-on. In the primary portion of the game, the player fires shots at a grid of tiles trying to hit enemy ships. When the player runs out of ammo, he or she plays a set of minigames in an attempt to earn more shots. Of course, hazards and bonuses abound to keep things interesting.

A text description is nice, but you're better off watching the gameplay video below to really understand what I'm jabbering about. Or, better yet, grab Outfox and Firefox 3 and play it yourself online at http://spaceship.mindtrove.info.

What a great exercise this turned out to be!  The payoff has been manyfold:

  1. I learning a ton more about Dojo and writing custom widgets.
  2. I developed some interesting MVC techniques for aural+visual event driven apps in Dojo. I hope to blog about these.
  3. I built some nice, reusable Dojo components for future browser games.
  4. I got to show off client-side music, sound, and speech in Firefox with pure JS. Maybe this will spur development of other audio apps?
  5. I drummed up some interest in extending Spaceship! with new minigames. Hopefully more coming soon.
  6. My wife was entertained. Yes, she will actually ask to play the game if she sees me working on it.
  7. I had lots of teachers ask when the game will be online at Maze Day. Well, here it is, a month later.
  8. And, most importantly, a steady stream of kids (and adults) got to play it at Maze Day. Hopefully even more can enjoy it now online.

If you try it out, leave a comment. It's new, there are bugs, and there is room for improvement. But anything you report will help in making the game better.

I owe many thanks to the artists who made their wonderful images, songs, and sounds available under open licenses. Their names appear in the Credits section off the main game menu. Be sure to check them out.

Oh, and of course the game code itself is BSD-licensed. Grab the code from http://svn.mindtrove.info/spaceship http://github.com/parente/spaceship if you're feeling adventurous.

11Mar/092

iPod Shuffle with TTS

It's about time! Now when can I expect it on the other iPods? Just because they have screens doesn't mean I'm always looking at them.

Article at Gizmodo

Tagged as: , 2 Comments
3Oct/083

Stopping Maintenance

Gary and I are stopping maintenance and support on various developer libraries we've created over the years. If anyone is actually using these libraries and wants take over their maintenance, please let one of us know:

  • Audio Enriched Links
  • PMIDI
  • pyAA
  • pyFMOD
  • pyIFC
  • pyOpenAL
  • pyHook
  • pySonic
  • pySonicEx

The code and builds for these projects currently posted at http://sf.net/projects/uncassist and http://sf.net/projects/pysonic will remain in place, but we will no longer update them.

Two fellows have already contacted me about maintaining pyHook, but haven't set up shop yet. I'll provide a link to the new pyHook home page when they're ready.

We will continue maintaining pyTTS.