Saturday, July 8, 2006

Lights and Sound

Among quite a few small things that I've been working on over the last week, I've added `proof of concept` Sound Synthesizer and some fancier formatting to the output.

The sound synthesizer has no dependencies outside of the Python built-in library modules (wave, ossaudiodev and winsound) and should be completely cross-platform (OK, maybe not mac-compatible :-( ), although I haven't had a chance to test it on Windows yet. Admittedly this isn't really a feature of crunchy, more a demo of what is possible with crunchy - but it should still be interesting for kids.

The formatting uses HTML in the webpage to show stdout output blue and stderr output red, which makes errors that bit more readable. The project to handle errors more gracefully has stalled somewhat because of the huge number of different ways most errors can occur - for instance SystemError - you really can't do much with it other than display the whole lot.

One problem that has become more pressing with the introduction of the SoundSynth is the way program execution blocks the interface. I'm working on a way of simulating a remote tty using AJAX which will solve both the asynchronous execution and the raw_input problems. I don't have all that much experience at threaded programming, so it's very much a learning experience for me!

Once we have integrated the graphics canvas into the normal interpreter (so that graphics commands can be called from anywhere within crunchy and they will still load) I think we'll be ready for a new release of crunchy and I will be ready to start writing tutorials.